diff options
| author | Alban Peignier | 2012-06-07 13:39:42 +0200 |
|---|---|---|
| committer | Alban Peignier | 2012-06-07 13:39:42 +0200 |
| commit | ba29325c18776daa28615b88eb6d75e874341b66 (patch) | |
| tree | 6abbb3ae2f6f4247bbce3f004eb87a5ef6ab2c79 | |
| parent | 7c0ae629a2ea0079c8b5efbd4c41b6ca661eae91 (diff) | |
| parent | cd34f2cbb0e29c7b59cb60af43571f6fd8cc5bda (diff) | |
| download | chouette-core-ba29325c18776daa28615b88eb6d75e874341b66.tar.bz2 | |
Merge branch 'master' of chouette.dryade.priv:/srv/git/chouette2
| -rw-r--r-- | Gemfile.lock | 2 | ||||
| -rw-r--r-- | app/assets/stylesheets/stop_areas.css.scss | 13 | ||||
| -rw-r--r-- | app/controllers/stop_areas_controller.rb | 10 | ||||
| -rw-r--r-- | app/views/journey_patterns/show.kml.erb | 12 | ||||
| -rw-r--r-- | app/views/stop_areas/show.html.erb | 36 | ||||
| -rw-r--r-- | config/locales/stop_areas.yml | 6 | ||||
| -rw-r--r-- | config/routes.rb | 16 |
7 files changed, 77 insertions, 18 deletions
diff --git a/Gemfile.lock b/Gemfile.lock index 854660c94..974b8e661 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT remote: git://chouette.dryade.priv/ninoxe - revision: 1b68352e83c2ef898fdab7cd4c4eeddba6a977d5 + revision: 18e831101b63ea349c9121137ab7210b5dfca958 specs: ninoxe (0.0.8) GeoRuby diff --git a/app/assets/stylesheets/stop_areas.css.scss b/app/assets/stylesheets/stop_areas.css.scss index e66f4dd28..3a5e70916 100644 --- a/app/assets/stylesheets/stop_areas.css.scss +++ b/app/assets/stylesheets/stop_areas.css.scss @@ -65,6 +65,19 @@ span { margin-left: 7px; } img { margin: 0px 5px 0px 5px;} } + .lines{ + float: left; + + .line{ + border: 2px solid black; + padding: 3px 15px 3px 3px; + height: 25px; + margin-bottom: 5px; + * { vertical-align:middle; } + span { margin-left: 7px; } + img { margin: 0px 5px 0px 5px;} + } + } .no_parent{ float: left; padding: 3px 15px 3px 3px; diff --git a/app/controllers/stop_areas_controller.rb b/app/controllers/stop_areas_controller.rb index 8fc9191a1..0c8da7838 100644 --- a/app/controllers/stop_areas_controller.rb +++ b/app/controllers/stop_areas_controller.rb @@ -24,6 +24,16 @@ class StopAreasController < ChouetteController @children = stop_area.children end + def add_lines + @stop_area = stop_area + @lines = stop_area.routing_lines + end + + def add_stops + @stop_area = stop_area + @stops = stop_area.routing_stops + end + def index request.format.kml? ? @per_page = nil : @per_page = 10 index! diff --git a/app/views/journey_patterns/show.kml.erb b/app/views/journey_patterns/show.kml.erb index 6fd8900b6..e08eb2255 100644 --- a/app/views/journey_patterns/show.kml.erb +++ b/app/views/journey_patterns/show.kml.erb @@ -1,16 +1,16 @@ <?xml version="1.0" encoding="UTF-8"?> <kml xmlns="http://www.opengis.net/kml/2.2"> <Document> - <Placemark id="route_<%= @journey_pattenr.id %>" > - <name><%= @journey_pattenr.name %></name> - <%= @journey_pattenr.geometry.kml_representation.html_safe %> + <Placemark id="route_<%= @journey_pattern.id %>" > + <name><%= @journey_pattern.name %></name> + <%= @journey_pattern.geometry.kml_representation.html_safe %> </Placemark> - <% @journey_pattenr.stop_areas.where("latitude is not null and longitude is not null").each_with_index do |stop_area, index| %> + <% @journey_pattern.stop_areas.where("latitude is not null and longitude is not null").each_with_index do |stop_area, index| %> <Placemark id="<%= stop_area.id %>" > <name><%= "#{stop_area.name} (#{index+1})" %></name> - <% if stop_area.id==@journey_pattenr.stop_areas.first.id %> + <% if stop_area.id==@journey_pattern.stop_areas.first.id %> <departure>true</departure> - <% elsif stop_area.id==@journey_pattenr.stop_areas.last.id %> + <% elsif stop_area.id==@journey_pattern.stop_areas.last.id %> <arrival>true</arrival> <% end %> <%= stop_area.geometry.kml_representation.html_safe %> diff --git a/app/views/stop_areas/show.html.erb b/app/views/stop_areas/show.html.erb index 28867de45..887c60089 100644 --- a/app/views/stop_areas/show.html.erb +++ b/app/views/stop_areas/show.html.erb @@ -84,7 +84,9 @@ <div class="genealogical"> - <% if @stop_area.parent.present? || @stop_area.children.present? %> + <% if @stop_area.stop_area_type == 'itl' %> + <h3><%= t(".genealogical_routing") %></h3> + <% else %> <h3><%= t(".genealogical") %></h3> <% end %> @@ -95,15 +97,24 @@ <% end %> </div> <div class="link"><%= image_tag "icons/link.png"%></div> + <% elsif @stop_area.routing_lines.present? %> + <div class="lines"> + <% @stop_area.routing_lines.each do |line| %> + <div class="line"> + <%= link_to([@referential, line]) do %> + <span><%= line.name %></span> + <% end %> + </div> + <% end %> + </div> + <div class="link"><%= image_tag "icons/link.png"%></div> <% else %> <div class="no_parent"> </div> <% end %> - <% if @stop_area.parent.present? || @stop_area.children.present? %> <div class="target"> <%= image_tag "map/" + @stop_area.stop_area_type + ".png"%><span><%= @stop_area.name %></span> </div> - <% end %> <% if @stop_area.children.present? %> <div class="link"><%= image_tag "icons/link.png"%></div> @@ -116,6 +127,17 @@ </div> <% end %> </div> + <% elsif @stop_area.routing_stops.present? %> + <div class="link"><%= image_tag "icons/link.png"%></div> + <div class="children"> + <% @stop_area.routing_stops.each do |stop| %> + <div class="child"> + <%= link_to([@referential, stop]) do %> + <%= image_tag "map/" + stop.stop_area_type + ".png" %><span><%= stop.name %></span> + <% end %> + </div> + <% end %> + </div> <% end %> </div> @@ -125,10 +147,14 @@ <ul class="actions"> <li><%= link_to t('stop_areas.actions.edit'), edit_referential_stop_area_path(@referential, @stop_area), :class => "edit" %></li> <li><%= link_to t('stop_areas.actions.destroy'), referential_stop_area_path(@referential, @stop_area), :method => :delete, :confirm => t('stop_areas.actions.destroy_confirm'), :class => "remove" %></li> - <% if @stop_area.stop_area_type != 'itl' %> + <% if @stop_area.stop_area_type == 'itl' %> + <li><%= link_to t('stop_areas.actions.add_lines'), add_lines_referential_stop_area_path(@referential, @stop_area), :class => "add_lines" %></li> + <% else %> <li><%= link_to t('stop_areas.actions.select_parent'), select_parent_referential_stop_area_path(@referential, @stop_area), :class => "select_parent" %></li> <% end %> - <% if @stop_area.stop_area_type != 'boarding_position' && @stop_area.stop_area_type != 'quay' %> + <% if @stop_area.stop_area_type == 'itl' %> + <li><%= link_to t('stop_areas.actions.add_stops'), add_stops_referential_stop_area_path(@referential, @stop_area), :class => "add_stops" %></li> + <% elsif @stop_area.stop_area_type != 'boarding_position' && @stop_area.stop_area_type != 'quay' %> <li><%= link_to t('stop_areas.actions.add_children'), add_children_referential_stop_area_path(@referential, @stop_area), :class => "add_children" %></li> <% end %> <br> diff --git a/config/locales/stop_areas.yml b/config/locales/stop_areas.yml index d6050cc79..ee16bed99 100644 --- a/config/locales/stop_areas.yml +++ b/config/locales/stop_areas.yml @@ -10,6 +10,8 @@ en: destroy_confirm: Are you sure you want destroy this stop? select_parent: Manage Parent add_children: Manage Children + add_lines: "Manage constraint's lines" + add_stops: "Manage constraint's stops" new: title: Add a new stop edit: @@ -19,6 +21,7 @@ en: geographic_data: Geographic data no_geographic_data: None genealogical: Links between stop area + genealogical_routing: "Routing constraint's links" index: title: Stop areas name_or_country_code: Name or Country code @@ -75,6 +78,8 @@ fr: destroy_confirm: Etes vous sûr de détruire cet arrêt ? select_parent: Gérer le parent add_children: Gérer les fils + add_lines: "Gérer les lignes de l'ITL" + add_stops: "Gérer les arrêts de l'ITL" new: title: Ajouter un arrêt edit: @@ -84,6 +89,7 @@ fr: geographic_data: Données géographiques no_geographic_data: Aucune genealogical: Lien entre arrêts + genealogical_routing: "Liens de l'ITL" index: name_or_country_code: Nom ou Code Postal title: Arrêts diff --git a/config/routes.rb b/config/routes.rb index c4686852b..0743e68a8 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -48,12 +48,16 @@ ChouetteIhm::Application.routes.draw do end resources :stop_areas do - resources :stop_area_parents - resources :stop_area_children - member do - get 'add_children' - get 'select_parent' - end + resources :stop_area_parents + resources :stop_area_children + resources :stop_area_lines + resources :stop_area_stops + member do + get 'add_children' + get 'select_parent' + get 'add_lines' + get 'add_stops' + end end resources :connection_links do |
