aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichel Etienne2012-09-06 16:05:35 +0200
committerMichel Etienne2012-09-06 16:05:35 +0200
commit292ba2bf171193b1a3daaa40dbea716e8b36b626 (patch)
treee6cb07cd8abf472c82ac10c541409e9927e336bf
parent388a40fc382c1abaf8f86883a153c6c9a8383bf8 (diff)
downloadchouette-core-292ba2bf171193b1a3daaa40dbea716e8b36b626.tar.bz2
refactor opposite_route management
-rw-r--r--Gemfile.lock2
-rw-r--r--app/controllers/routes_controller.rb10
-rw-r--r--app/views/routes/_form.html.erb2
-rw-r--r--app/views/routes/_route.html.erb12
-rw-r--r--app/views/routes/show.html.erb2
-rw-r--r--config/locales/routes.yml4
6 files changed, 21 insertions, 11 deletions
diff --git a/Gemfile.lock b/Gemfile.lock
index 5af91e2b9..5062ea705 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -1,6 +1,6 @@
GIT
remote: git://chouette.dryade.priv/ninoxe
- revision: ddc6b0f9adfb2df8aa2b521d6a749c229977383c
+ revision: a2fa3bf8ef30572bf91f64746b92a47653c1c0a6
specs:
ninoxe (0.0.8)
GeoRuby
diff --git a/app/controllers/routes_controller.rb b/app/controllers/routes_controller.rb
index fdad19dd9..078694ea0 100644
--- a/app/controllers/routes_controller.rb
+++ b/app/controllers/routes_controller.rb
@@ -33,11 +33,11 @@ class RoutesController < ChouetteController
end
end
- def update
- update! do |success, failure|
- success.html { redirect_to referential_line_path(@referential,@line) }
- end
- end
+# def update
+# update! do |success, failure|
+# success.html { redirect_to referential_line_path(@referential,@line) }
+# end
+# end
protected
alias_method :route, :resource
diff --git a/app/views/routes/_form.html.erb b/app/views/routes/_form.html.erb
index 050c6dd93..ddabcc528 100644
--- a/app/views/routes/_form.html.erb
+++ b/app/views/routes/_form.html.erb
@@ -4,7 +4,7 @@
<%= form.input :published_name %>
<%= form.input :number %>
<%= form.input :comment %>
- <%= form.input :opposite_route, :as => :select, :collection => Hash[@line.routes.map{|r| [r.name,r.id]}] %>
+ <%= form.input :opposite_route, :as => :select, :collection => @line.routes.select { |r| r.id != @route.id } %>
<%= form.input :direction_code, :as => :select, :collection => Chouette::Route.directions, :include_blank => false, :member_label => Proc.new { |mode| t("directions.label.#{mode}") } %>
<%= form.input :wayback_code, :as => :select, :collection => Chouette::Route.waybacks, :include_blank => false, :member_label => Proc.new { |mode| t("waybacks.label.#{mode}") } %>
<%= form.input :objectid, :required => !@route.new_record?, :input_html => { :disabled => !@route.new_record? } %>
diff --git a/app/views/routes/_route.html.erb b/app/views/routes/_route.html.erb
index 416a032ea..2c6e810fa 100644
--- a/app/views/routes/_route.html.erb
+++ b/app/views/routes/_route.html.erb
@@ -4,13 +4,19 @@
<%= link_to route.name, referential_line_route_path( @referential, @line, route) %>
</div>
<div class="info">
- <% if route.number.blank? %>
+ <% if ! route.number.blank? %>
<%= route.human_attribute_name('number') %> <%= route.number %> -
<% end %>
- <% if route.direction.blank? %>
- <%= route.human_attribute_name('direction') %> <%= route.direction %> -
+ <% if ! route.direction.blank? %>
+ <%= route.human_attribute_name('direction_code') %> <%= t('directions.label.'+route.direction_code) %> -
<% end %>
<%= route.human_attribute_name('wayback_code') %> <%= (route.wayback=="A") ? t('.wayback.positive') : t('.wayback.negative') %>
+ <br/>
+ <% if route.opposite_route %>
+ <%= t('.opposite') %> <%= link_to route.opposite_route.name, referential_line_route_path( @referential, @line, route.opposite_route) %>
+ <% else %>
+ <%= t('.no_opposite') %>
+ <% end %>
<% if route.journey_patterns.size > 0 %>
<div class="actions">
<%= link_to t("vehicle_journeys.actions.index"), referential_line_route_vehicle_journeys_path(@referential, @line, route), :class => "link" %>
diff --git a/app/views/routes/show.html.erb b/app/views/routes/show.html.erb
index ad2ba73b4..b2e8457d7 100644
--- a/app/views/routes/show.html.erb
+++ b/app/views/routes/show.html.erb
@@ -43,7 +43,7 @@
<p>
<label><%= @route.human_attribute_name(:opposite_route) %>: </label>
<% if @route.opposite_route %>
- <%= link_to @route.opposite_route.name, [@referential, @line, @route] %>
+ <%= link_to @route.opposite_route.name, [@referential, @line, @route.opposite_route] %>
<% else %>
<%= t(".no_opposite_route") %>
<% end %>
diff --git a/config/locales/routes.yml b/config/locales/routes.yml
index 7cba2523a..e5d631bd2 100644
--- a/config/locales/routes.yml
+++ b/config/locales/routes.yml
@@ -24,6 +24,8 @@ en:
wayback:
positive: forward
negative: backward
+ opposite: Opposite route
+ no_opposite: No opposite route
activerecord:
models:
@@ -77,6 +79,8 @@ fr:
wayback:
positive: Aller
negative: Retour
+ opposite: Séquence opposée
+ no_opposite: Pas de séquence opposée
activerecord:
models:
route: