From 9d5b817bb9053b25cd5d3914ff95e1a592fc62e9 Mon Sep 17 00:00:00 2001 From: Michel Etienne Date: Wed, 5 Sep 2012 18:51:16 +0200 Subject: block journey_pattern and vehicle_journey link when less than 2 stop_points are defined on route --- Gemfile.lock | 3 +-- app/views/journey_patterns/show.html.erb | 4 ++++ app/views/routes/show.html.erb | 8 ++++++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index e8929de66..5af91e2b9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT remote: git://chouette.dryade.priv/ninoxe - revision: 55d3c3c3f8dde90dc1b30224cefbe679a4ee9786 + revision: ddc6b0f9adfb2df8aa2b521d6a749c229977383c specs: ninoxe (0.0.8) GeoRuby @@ -195,7 +195,6 @@ GEM jruby-rack (1.1.9) jruby-rack-worker (0.4-java) jruby-rack (>= 1.1.1) - json (1.7.5) json (1.7.5-java) json_pure (1.7.5) launchy (2.1.0) diff --git a/app/views/journey_patterns/show.html.erb b/app/views/journey_patterns/show.html.erb index 507a71cca..149f9df6a 100644 --- a/app/views/journey_patterns/show.html.erb +++ b/app/views/journey_patterns/show.html.erb @@ -4,6 +4,10 @@ <%= @map.to_html %>
+

+ + <%= link_to line_formatted_name( @line), [@referential, @line] %> +

<%= link_to @route.name, [@referential, @line, @route] %> diff --git a/app/views/routes/show.html.erb b/app/views/routes/show.html.erb index 970ab7981..f65761fc6 100644 --- a/app/views/routes/show.html.erb +++ b/app/views/routes/show.html.erb @@ -65,6 +65,7 @@

+<% if @route.stop_points.size > 0 %>

<%= t('.stop_points') %> <%= image_tag("icons/plus.png" , :class => "switcher") %> @@ -74,7 +75,9 @@ +<% end %> +<% if @route.stop_points.size >= 2 %>

<%= t('.journey_patterns') %> <%= image_tag("icons/plus.png" , :class => "switcher") %> @@ -84,6 +87,7 @@ +<% end %> <% content_for :sidebar do %>
    @@ -92,12 +96,16 @@
  • <%= link_to t('stop_points.actions.sort'), [@referential, @line, @route, :stop_points], :class => "edit" %>
  • +<% if @route.stop_points.size >= 2 %>
  • <%= link_to t('journey_patterns.actions.new'), new_referential_line_route_journey_pattern_path(@referential, @line, @route), :class => "add" %>
  • +<% if @route.journey_patterns.size > 0 %>
  • <%= link_to t('vehicle_journeys.actions.index'), [@referential, @line, @route, :vehicle_journeys], :class => "link" %>
  • +<% end %> +<% end %>
<% end %> -- cgit v1.2.3 From a54aa55e7d435ff0974c15723038278009a69683 Mon Sep 17 00:00:00 2001 From: Michel Etienne Date: Thu, 6 Sep 2012 10:28:33 +0200 Subject: refactor when no journey pattern on route --- app/views/routes/_route.html.erb | 8 +++++++- app/views/routes/show.html.erb | 9 +++------ config/locales/routes.yml | 12 ++++++++++++ config/locales/stop_points.yml | 3 ++- 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/app/views/routes/_route.html.erb b/app/views/routes/_route.html.erb index e99f418b1..416a032ea 100644 --- a/app/views/routes/_route.html.erb +++ b/app/views/routes/_route.html.erb @@ -10,10 +10,16 @@ <% if route.direction.blank? %> <%= route.human_attribute_name('direction') %> <%= route.direction %> - <% end %> - <%= route.human_attribute_name('wayback_code') %> <%= (route.wayback=="A") ? t('route.wayback.positive') : t('wayback.negative') %> + <%= route.human_attribute_name('wayback_code') %> <%= (route.wayback=="A") ? t('.wayback.positive') : t('.wayback.negative') %> + <% if route.journey_patterns.size > 0 %>
<%= link_to t("vehicle_journeys.actions.index"), referential_line_route_vehicle_journeys_path(@referential, @line, route), :class => "link" %>
+ <% else %> +
+ <%= t('.no_journey_pattern')%> +
+ <% end%> <% end %> diff --git a/app/views/routes/show.html.erb b/app/views/routes/show.html.erb index f65761fc6..ad2ba73b4 100644 --- a/app/views/routes/show.html.erb +++ b/app/views/routes/show.html.erb @@ -65,8 +65,7 @@

-<% if @route.stop_points.size > 0 %> -

+

<%= t('.stop_points') %> <%= image_tag("icons/plus.png" , :class => "switcher") %> <%= image_tag("icons/minus.png" , :class => "switcher" , :style => "display: none;") %> @@ -75,9 +74,7 @@ -<% end %> -<% if @route.stop_points.size >= 2 %>

<%= t('.journey_patterns') %> <%= image_tag("icons/plus.png" , :class => "switcher") %> @@ -87,7 +84,7 @@ -<% end %> + <% content_for :sidebar do %>
    @@ -100,12 +97,12 @@
  • <%= link_to t('journey_patterns.actions.new'), new_referential_line_route_journey_pattern_path(@referential, @line, @route), :class => "add" %>
  • +<% end %> <% if @route.journey_patterns.size > 0 %>
  • <%= link_to t('vehicle_journeys.actions.index'), [@referential, @line, @route, :vehicle_journeys], :class => "link" %>
  • <% end %> -<% end %>
<% end %> diff --git a/config/locales/routes.yml b/config/locales/routes.yml index 36de61539..7cba2523a 100644 --- a/config/locales/routes.yml +++ b/config/locales/routes.yml @@ -19,6 +19,12 @@ en: title: Routes selection: Selection selection_all: All + route: + no_journey_pattern: No Journey pattern + wayback: + positive: forward + negative: backward + activerecord: models: route: @@ -66,6 +72,11 @@ fr: title: "Séquences d'arrêts" selection: Sélection selection_all: Tous + route: + no_journey_pattern: Pas de mission + wayback: + positive: Aller + negative: Retour activerecord: models: route: @@ -91,5 +102,6 @@ fr: object_version: Version creation_time: Créé le creator_id: Créé par + no_journey_pattern: Pas de mission diff --git a/config/locales/stop_points.yml b/config/locales/stop_points.yml index d40ef7873..cea5debcf 100644 --- a/config/locales/stop_points.yml +++ b/config/locales/stop_points.yml @@ -27,7 +27,7 @@ en: other: stop points on route attributes: stop_point: - + lines: lines fr: stop_points: reorder_success: "La list des arrêts a été mise à jour" @@ -57,3 +57,4 @@ fr: other: "arrêts sur séquence d'arrêts" attributes: stop_point: + lines: lignes -- cgit v1.2.3