diff options
| -rw-r--r-- | app/assets/stylesheets/lines.css.scss | 1 | ||||
| -rw-r--r-- | app/assets/stylesheets/routes.css.scss | 2 | ||||
| -rw-r--r-- | app/controllers/lines_controller.rb | 1 | ||||
| -rw-r--r-- | app/controllers/routes_controller.rb | 27 | ||||
| -rw-r--r-- | app/helpers/routes_helper.rb | 7 | ||||
| -rw-r--r-- | app/views/lines/show.html.erb | 8 | ||||
| -rw-r--r-- | app/views/routes/_form.html.erb | 4 | ||||
| -rw-r--r-- | app/views/routes/_list.html.erb | 21 | ||||
| -rw-r--r-- | app/views/routes/index.html.erb | 20 | ||||
| -rw-r--r-- | app/views/routes/show.html.erb | 39 | ||||
| -rw-r--r-- | config/locales/directions.yml | 31 | ||||
| -rw-r--r-- | config/locales/lines.yml | 2 | ||||
| -rw-r--r-- | config/locales/routes.yml | 14 |
13 files changed, 120 insertions, 57 deletions
diff --git a/app/assets/stylesheets/lines.css.scss b/app/assets/stylesheets/lines.css.scss index 6c136af7c..c5370611c 100644 --- a/app/assets/stylesheets/lines.css.scss +++ b/app/assets/stylesheets/lines.css.scss @@ -58,6 +58,7 @@ .line_color{ color: white; font-weight: bold; padding: 0 5px 0 5px;} + h3.routes { clear: both; } .summary p label { font-weight: bold; diff --git a/app/assets/stylesheets/routes.css.scss b/app/assets/stylesheets/routes.css.scss index c845812c8..8da042a7a 100644 --- a/app/assets/stylesheets/routes.css.scss +++ b/app/assets/stylesheets/routes.css.scss @@ -3,7 +3,7 @@ // You can use Sass (SCSS) here: http://sass-lang.com/ @import "common"; -#workspace.routes.index +#workspace.lines.show { .route:after { @include after_div_for_object; diff --git a/app/controllers/lines_controller.rb b/app/controllers/lines_controller.rb index ac441f3ad..9d4ec18ae 100644 --- a/app/controllers/lines_controller.rb +++ b/app/controllers/lines_controller.rb @@ -8,6 +8,7 @@ class LinesController < ChouetteController def show @map = LineMap.new referential, resource + @routes = @line.routes.paginate(:page => params[:page], :per_page => 10) show! end diff --git a/app/controllers/routes_controller.rb b/app/controllers/routes_controller.rb index 958d23cf9..55a700315 100644 --- a/app/controllers/routes_controller.rb +++ b/app/controllers/routes_controller.rb @@ -8,10 +8,33 @@ class RoutesController < ChouetteController end def index - @per_page = 10 - index! + index! do |format| + format.html { redirect_to referential_line_path(@referential,@line) } + end end + def show + @stop_areas = resource.stop_areas.paginate(:page => params[:page], :per_page => 10) + show! + end + + def destroy + destroy! do |success, failure| + success.html { redirect_to referential_line_path(@referential,@line) } + end + end + + def create + create! 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/helpers/routes_helper.rb b/app/helpers/routes_helper.rb new file mode 100644 index 000000000..72915fd2f --- /dev/null +++ b/app/helpers/routes_helper.rb @@ -0,0 +1,7 @@ +module RoutesHelper + def line_formatted_name( line) + return line.publishedname if line.number.blank? + "#{line.publishedname} [#{line.number}]" + end +end + diff --git a/app/views/lines/show.html.erb b/app/views/lines/show.html.erb index cd0e6b2ac..23c65573f 100644 --- a/app/views/lines/show.html.erb +++ b/app/views/lines/show.html.erb @@ -51,10 +51,18 @@ </div> </div> +<h3 class="routes"><%= t('.itineraries') %></h3> +<%= will_paginate @routes %> +<div class="routes paginated_content"> + <%= render :partial => "routes/route", :collection => @routes %> +</div> +<%= will_paginate @routes %> + <% content_for :sidebar do %> <ul class="actions"> <li><%= link_to t('lines.actions.edit'), edit_referential_line_path(@referential, @line), :class => "edit" %></li> <li><%= link_to t('lines.actions.destroy'), referential_line_path(@referential, @line), :method => :delete, :confirm => t('lines.actions.destroy_confirm'), :class => "remove" %></li> + <li><%= link_to t('routes.actions.new'), new_referential_line_route_path(@referential, @line), :class => "add" %></li> <br> </ul> <% end %> diff --git a/app/views/routes/_form.html.erb b/app/views/routes/_form.html.erb index fb4604328..96a681b13 100644 --- a/app/views/routes/_form.html.erb +++ b/app/views/routes/_form.html.erb @@ -4,8 +4,8 @@ <%= form.input :published_name %> <%= form.input :number %> <%= form.input :comment %> - <%= form.input :oppositerouteid, :as => :select, :collection => Hash[@line.routes.map{|r| [r.name,r.id]}] %> - <%= form.input :direction, :as => :select, :collection => { "Aller" => 'A', "Retour" => "R"} %> + <%= form.input :opposite_route, :as => :select, :collection => Hash[@line.routes.map{|r| [r.name,r.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}") } %> <% if @route.new_record? %> <%= form.input :objectid %> diff --git a/app/views/routes/_list.html.erb b/app/views/routes/_list.html.erb deleted file mode 100644 index b253c3f75..000000000 --- a/app/views/routes/_list.html.erb +++ /dev/null @@ -1,21 +0,0 @@ -<%= title_tag t('routes.index.title') %> - -<%= search_form_for @q, :url => referential_line_routes_path(@referential, @line), :html => {:method => :get} do |f| %> - <%= f.text_field :name_cont %> - - <%= f.submit t('actions.search') %> <%= t("or") %> - <%= link_to t("cancel"), referential_line_path(@referential,@line) %> -<% end %> - -<%= will_paginate @line.routes %> -<div class="routes paginated_content"> - <%= render :partial => "route", :collection => @line.routes %> -</div> -<%= will_paginate @line.routes %> - -<% content_for :sidebar do %> -<ul class="actions"> - <li><%= link_to t('routes.actions.new'), new_referential_line_route_path(@referential, @line), :class => "add" %></li> -</ul> -<% end %> - diff --git a/app/views/routes/index.html.erb b/app/views/routes/index.html.erb deleted file mode 100644 index fba0ef859..000000000 --- a/app/views/routes/index.html.erb +++ /dev/null @@ -1,20 +0,0 @@ -<%= title_tag t('routes.index.title') %> - -<%= search_form_for @q, :url => referential_line_routes_path(@referential, @line), :html => {:method => :get} do |f| %> - <%= f.text_field :name_cont %> - - <%= f.submit t('actions.search') %> <%= t("or") %> - <%= link_to t("cancel"), referential_line_path(@referential,@line) %> -<% end %> - -<%= will_paginate @routes %> -<div class="routes paginated_content"> - <%= render :partial => "route", :collection => @routes %> -</div> -<%= will_paginate @routes %> - -<% content_for :sidebar do %> -<ul class="actions"> - <li><%= link_to t('routes.actions.new'), new_referential_line_route_path(@referential, @line), :class => "add" %></li> -</ul> -<% end %> diff --git a/app/views/routes/show.html.erb b/app/views/routes/show.html.erb index 1d43c4284..aef155fec 100644 --- a/app/views/routes/show.html.erb +++ b/app/views/routes/show.html.erb @@ -1,11 +1,11 @@ -<%= title_tag t('routes.show.title', :route => @route.name ) %> +<%= title_tag t('routes.show.title', :route => @route.name, :line => @line.name ) %> <div class="route_show"> <div class="summary"> <p> <label><%= @route.human_attribute_name(:line) %>: </label> - <%= link_to @line.name, [@referential, @line] %> + <%= link_to line_formatted_name( @line), [@referential, @line] %> </p> <p> <label><%= @route.human_attribute_name(:name) %>: </label> @@ -24,12 +24,30 @@ <%= @route.comment %> </p> <p> - <label><%= @route.human_attribute_name(:direction) %>: </label> - <%= @route.direction %> + <label><%= @route.human_attribute_name(:direction_code) %>: </label> + <% if @route.direction_code %> + <p><%= @route.direction_code.inspect %></p> + <p><%= @route.direction.inspect %></p> + <%= t("directions.label.#{@route.direction_code}").capitalize %> + <% else %> + <%= t(".undefined") %> + <% end %> </p> <p> - <label><%= @route.human_attribute_name(:wayback) %>: </label> - <%= @route.wayback %> + <label><%= @route.human_attribute_name(:wayback_code) %>: </label> + <% if @route.wayback_code %> + <%= t("waybacks.label.#{@route.wayback_code}").capitalize %> + <% else %> + <%= t(".undefined") %> + <% end %> + </p> + <p> + <label><%= @route.human_attribute_name(:opposite_route) %>: </label> + <% if @route.opposite_route %> + <%= link_to @route.opposite_route.name, [@referential, @line, @route] %> + <% else %> + <%= t(".no_opposite_route") %> + <% end %> </p> <p> <label><%= @route.human_attribute_name("objectid") %>: </label> @@ -37,7 +55,7 @@ </p> <p> <label><%= @route.human_attribute_name("creation_time") %>: </label> - <%= @route.creation_time %> + <%= l @route.creation_time %> </p> <p> <label><%= @route.human_attribute_name("creator_id") %>: </label> @@ -47,6 +65,13 @@ </div> +<h3 class="stop_areas"><%= t('.stop_areas') %></h3> +<%= will_paginate @stop_areas %> +<div class="stop_areas paginated_content"> + <%= render :partial => "stop_areas/stop_area", :collection => @stop_areas %> +</div> +<%= will_paginate @stop_areas %> + <% content_for :sidebar do %> <ul class="actions"> <li><%= link_to t('routes.actions.edit'), edit_referential_line_route_path(@referential, @line, @route), :class => "edit" %></li> diff --git a/config/locales/directions.yml b/config/locales/directions.yml new file mode 100644 index 000000000..82b87673a --- /dev/null +++ b/config/locales/directions.yml @@ -0,0 +1,31 @@ +en: + directions: + label: + straight_forward: straight forward + backward: backward + clockwise: clockwise + anti_clockwise: anticlockwise + north: north + north_west: north west + west: west + south_west: south west + south: south + south_east: south east + east: east + north_east: north east +fr: + directions: + label: + straight_forward: aller + backward: retour + clockwise: sens horaire + anti_clockwise: sens anti horaire + north: nord + north_west: nord ouest + west: ouest + south_west: sud ouest + south: sud + south_east: sud est + east: est + north_east: nord est + diff --git a/config/locales/lines.yml b/config/locales/lines.yml index a24422b9b..490a7b630 100644 --- a/config/locales/lines.yml +++ b/config/locales/lines.yml @@ -11,6 +11,7 @@ en: title: Update line %{line} show: title: Line %{line} + itineraries: "Line's route list" index: title: Lines name_or_number: Name or number @@ -52,6 +53,7 @@ fr: title: Modifier la ligne %{line} show: title: Ligne %{line} + itineraries: "Liste des itinéraires de la ligne" index: name_or_number: Nom ou indice title: Lignes diff --git a/config/locales/routes.yml b/config/locales/routes.yml index 6a9d690f4..a4cd3a366 100644 --- a/config/locales/routes.yml +++ b/config/locales/routes.yml @@ -11,6 +11,9 @@ en: title: Update route %{route} show: title: Route %{route} + stop_areas: "Routes's stop areas list" + no_opposite_route: No reversed route associated + undefined: Undefined index: title: Routes selection: Selection @@ -25,7 +28,7 @@ en: published_name: Published name comment: Comments number: Number - direction: Direction + direction_code: Direction wayback_code: Wayback opposite_route: Reversed route objectid: Neptune identifier @@ -45,7 +48,10 @@ fr: edit: title: "Modifier l'itinéraire %{route}" show: - title: Itinéraire %{route} + title: Itinéraire %{route} de la ligne %{line} + stop_areas: "Liste des arrêts de l'itinéraire" + no_opposite_route: Aucun itinéraire associé en sens opposé + undefined: Non défini index: title: Itinéraires selection: Sélection @@ -60,9 +66,9 @@ fr: published_name: Nom public number: Indice comment: Commentaire - direction: Direction + direction_code: Direction wayback_code: Sens - opposite_route: Itinéraire retour + opposite_route: Itinéraire associé en sens opposé objectid: Identifiant Neptune object_version: Version creation_time: Créé le |
