aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/routes.coffee2
-rw-r--r--app/controllers/routes_controller.rb4
-rw-r--r--app/helpers/routes_helper.rb2
-rw-r--r--app/models/chouette/route.rb4
-rw-r--r--app/models/chouette/wayback.rb50
-rw-r--r--app/views/routes/_form.html.slim6
6 files changed, 9 insertions, 59 deletions
diff --git a/app/assets/javascripts/routes.coffee b/app/assets/javascripts/routes.coffee
index 2e36061b8..4492b381d 100644
--- a/app/assets/javascripts/routes.coffee
+++ b/app/assets/javascripts/routes.coffee
@@ -1,5 +1,5 @@
$(document).on("change", '#route_wayback', (e) ->
- way = if $(this).is(':checked') then "backward" else "straight_forward"
+ way = if $(this).is(':checked') then "inbound" else "outbound"
$('.opposite_route').hide().find('select').prop('disabled', true)
field = $(".opposite_route.#{way}")
diff --git a/app/controllers/routes_controller.rb b/app/controllers/routes_controller.rb
index 04f63c112..78daffb30 100644
--- a/app/controllers/routes_controller.rb
+++ b/app/controllers/routes_controller.rb
@@ -94,8 +94,8 @@ class RoutesController < ChouetteController
else
parent.routes.where(opposite_route: nil)
end
- @forward = scope.where(wayback: :straight_forward)
- @backward = scope.where(wayback: :backward)
+ @forward = scope.where(wayback: :outbound)
+ @backward = scope.where(wayback: :inbound)
end
private
diff --git a/app/helpers/routes_helper.rb b/app/helpers/routes_helper.rb
index a8c9a1f0c..4bffa99d4 100644
--- a/app/helpers/routes_helper.rb
+++ b/app/helpers/routes_helper.rb
@@ -6,7 +6,7 @@ module RoutesHelper
end
def fonticon_wayback(wayback)
- if wayback == 'straight_forward'
+ if wayback == 'outbound'
return '<i class="fa fa-arrow-right"></i>'.html_safe
else
return '<i class="fa fa-arrow-left"></i>'.html_safe
diff --git a/app/models/chouette/route.rb b/app/models/chouette/route.rb
index 49493d5b5..0bdccb36a 100644
--- a/app/models/chouette/route.rb
+++ b/app/models/chouette/route.rb
@@ -6,7 +6,7 @@ class Chouette::Route < Chouette::TridentActiveRecord
extend ActiveModel::Naming
enumerize :direction, in: %i(straight_forward backward clockwise counter_clockwise north north_west west south_west south south_east east north_east)
- enumerize :wayback, in: %i(straight_forward backward), default: :straight_forward
+ enumerize :wayback, in: %i(outbound inbound), default: :outbound
# FIXME http://jira.codehaus.org/browse/JRUBY-6358
self.primary_key = "id"
@@ -106,7 +106,7 @@ class Chouette::Route < Chouette::TridentActiveRecord
Chouette::Geometry::RoutePresenter.new self
end
- @@opposite_waybacks = { straight_forward: :backward, backward: :straight_forward}
+ @@opposite_waybacks = { outbound: :inbound, inbound: :outbound}
def opposite_wayback
@@opposite_waybacks[wayback.to_sym]
end
diff --git a/app/models/chouette/wayback.rb b/app/models/chouette/wayback.rb
deleted file mode 100644
index b2950449d..000000000
--- a/app/models/chouette/wayback.rb
+++ /dev/null
@@ -1,50 +0,0 @@
-class Chouette::Wayback < ActiveSupport::StringInquirer
-
- def initialize(text_code, numerical_code)
- super text_code.to_s
- @numerical_code = numerical_code
- end
-
- def self.new(text_code, numerical_code = nil)
- if text_code and numerical_code
- super
- elsif self === text_code
- text_code
- else
- if Fixnum === text_code
- text_code, numerical_code = definitions.rassoc(text_code)
- else
- text_code, numerical_code = definitions.assoc(text_code.to_s)
- end
-
- super text_code, numerical_code
- end
- end
-
- def to_i
- @numerical_code
- end
-
- def inspect
- "#{to_s}/#{to_i}"
- end
-
- def name
- to_s
- end
-
- @@definitions = [
- ["straight_forward", 0],
- ["backward", 1]
- ]
- cattr_reader :definitions
-
- @@all = nil
- def self.all
- @@all ||= definitions.collect do |text_code, numerical_code|
- new(text_code, numerical_code)
- end
- end
-
-end
-
diff --git a/app/views/routes/_form.html.slim b/app/views/routes/_form.html.slim
index bee86f91e..244b427dc 100644
--- a/app/views/routes/_form.html.slim
+++ b/app/views/routes/_form.html.slim
@@ -7,11 +7,11 @@
.form-group.has_switch
= f.label :wayback, class: 'col-sm-4 col-xs-5 control-label'
- = f.input :wayback, as: :boolean, checked_value: :straight_forward, unchecked_value: :backward, label: content_tag(:span, @route.wayback_text, class: 'switch-label', data: {checkedValue: t('enumerize.route.direction.straight_forward'), uncheckedValue: t('enumerize.route.direction.backward')}), wrapper_html: { class: 'col-sm-8 col-xs-7'}
+ = f.input :wayback, as: :boolean, checked_value: :outbound, unchecked_value: :inbound, label: content_tag(:span, @route.wayback_text, class: 'switch-label', data: {checkedValue: t('enumerize.route.wayback.outbound'), uncheckedValue: t('enumerize.route.wayback.inbound')}), wrapper_html: { class: 'col-sm-8 col-xs-7'}
- = f.input :opposite_route_id, collection: @forward, disabled: @route.wayback.straight_forward?, wrapper_html: {class: input_opposite_route_id_css(@route, 'straight_forward')}
+ = f.input :opposite_route_id, collection: @forward, disabled: @route.wayback.outbound?, wrapper_html: {class: input_opposite_route_id_css(@route, 'outbound')}
- = f.input :opposite_route_id, collection: @backward, disabled: @route.wayback.backward?, wrapper_html: {class: input_opposite_route_id_css(@route, 'backward')}
+ = f.input :opposite_route_id, collection: @backward, disabled: @route.wayback.inbound?, wrapper_html: {class: input_opposite_route_id_css(@route, 'inbound')}