diff options
| author | Luc Donnet | 2012-06-18 15:21:51 +0200 |
|---|---|---|
| committer | Luc Donnet | 2012-06-18 15:21:51 +0200 |
| commit | 600ecce74a0d0aab36352d072849df67c6f1da46 (patch) | |
| tree | 07d18568eba212d4efd8ebe2a8cfc30403a68039 | |
| parent | 53fa0d0706a215ecf7ad28ee5f52d2ab902c585a (diff) | |
| parent | ed9f7d1fde2bdb1440d14aa80432a6ea7f06863f (diff) | |
| download | chouette-core-600ecce74a0d0aab36352d072849df67c6f1da46.tar.bz2 | |
Merge branch 'journey_pattern' of chouette.dryade.priv:/srv/git/chouette2 into journey_pattern
| -rw-r--r-- | app/assets/stylesheets/common.css.scss | 3 | ||||
| -rw-r--r-- | app/assets/stylesheets/layout.css.scss | 6 | ||||
| -rw-r--r-- | app/assets/stylesheets/lines.css.scss | 7 | ||||
| -rw-r--r-- | app/assets/stylesheets/vehicle_journeys.css.scss | 22 | ||||
| -rw-r--r-- | app/controllers/time_tables_controller.rb | 2 | ||||
| -rw-r--r-- | app/helpers/time_tables_helper.rb | 14 | ||||
| -rw-r--r-- | app/views/routes/_route.html.erb | 19 | ||||
| -rw-r--r-- | app/views/routes/show.html.erb | 3 | ||||
| -rw-r--r-- | app/views/vehicle_journeys/_form.html.erb | 19 | ||||
| -rw-r--r-- | app/views/vehicle_journeys/_vehicle_journey_at_stop_fields.html.erb | 15 | ||||
| -rw-r--r-- | app/views/vehicle_journeys/index.html.erb | 9 | ||||
| -rw-r--r-- | app/views/vehicle_journeys/show.html.erb | 22 | ||||
| -rw-r--r-- | config/locales/routes.yml | 6 | ||||
| -rw-r--r-- | config/locales/vehicle_journeys.yml | 16 | ||||
| -rw-r--r-- | spec/views/vehicle_journeys/_vehicle_journey_at_stop_fields.html.erb_spec.rb | 1 |
15 files changed, 143 insertions, 21 deletions
diff --git a/app/assets/stylesheets/common.css.scss b/app/assets/stylesheets/common.css.scss index 9f9ce3346..b6d91a318 100644 --- a/app/assets/stylesheets/common.css.scss +++ b/app/assets/stylesheets/common.css.scss @@ -43,6 +43,9 @@ padding-left: 12px; } + a.link { + background: url(image-path('icons/link-small.png')) no-repeat 0% 50%; + } a.edit { background: url(image-path('user_interface/ui/edit-small.png')) no-repeat 0% 50%; } diff --git a/app/assets/stylesheets/layout.css.scss b/app/assets/stylesheets/layout.css.scss index 481a9f2a4..13151abb8 100644 --- a/app/assets/stylesheets/layout.css.scss +++ b/app/assets/stylesheets/layout.css.scss @@ -58,6 +58,10 @@ $text_color: #222; background: url(image-path('user_interface/ui/add.png')) no-repeat; } + a.link { + background: url(image-path('icons/link.png')) no-repeat; + } + a.select_parent { background: url(image-path('icons/select_parent.png')) no-repeat; } @@ -65,4 +69,4 @@ $text_color: #222; a.select_areas { background: url(image-path('icons/select_parent.png')) no-repeat; } -}
\ No newline at end of file +} diff --git a/app/assets/stylesheets/lines.css.scss b/app/assets/stylesheets/lines.css.scss index 07ed34e5b..f66f8badd 100644 --- a/app/assets/stylesheets/lines.css.scss +++ b/app/assets/stylesheets/lines.css.scss @@ -61,6 +61,13 @@ padding: 0 5px 0 5px;} h3.routes { clear: both; } + .route { + margin-bottom: 0px; + .info { + margin-bottom: 30px; + } + } + .summary p label { font-weight: bold; } diff --git a/app/assets/stylesheets/vehicle_journeys.css.scss b/app/assets/stylesheets/vehicle_journeys.css.scss index c4018d601..0bfabc38b 100644 --- a/app/assets/stylesheets/vehicle_journeys.css.scss +++ b/app/assets/stylesheets/vehicle_journeys.css.scss @@ -9,7 +9,7 @@ color: white; font-weight: bold;} .journey_pattern_dependent_list { - li.no_stop { + tr.no_stop { display: none; } } @@ -63,6 +63,25 @@ } +#workspace.vehicle_journeys.show, #workspace.vehicle_journeys.edit { + .vehicle_journey_at_stops { + thead { + th { text-align: center; } + th.hour { width: 130px; } + tr { + background-color: #95CB3E; + color: white; + } + } + tbody { + td.hour { text-align: center; } + tr label { width: 100% } + tr.odd { } + tr.even { background-color: #DEFFA8; } + } + } +} + #workspace.vehicle_journeys.show { .summary p label { @@ -91,6 +110,7 @@ @include div_for_object; /* to create multi-column index */ width: 350px; + height: 100px; float: left; padding-right: 10px; diff --git a/app/controllers/time_tables_controller.rb b/app/controllers/time_tables_controller.rb index b860d2948..a3e2c85c4 100644 --- a/app/controllers/time_tables_controller.rb +++ b/app/controllers/time_tables_controller.rb @@ -17,7 +17,7 @@ class TimeTablesController < ChouetteController def filtered_time_tables_maps filtered_time_tables.collect do |time_table| - { :id => time_table.id.to_s, :name => time_table.comment } + { :id => time_table.id, :name => time_table.comment } end end def filtered_time_tables diff --git a/app/helpers/time_tables_helper.rb b/app/helpers/time_tables_helper.rb index db9c1109e..a7607f7a0 100644 --- a/app/helpers/time_tables_helper.rb +++ b/app/helpers/time_tables_helper.rb @@ -5,13 +5,19 @@ module TimeTablesHelper :start => l(time_table.bounding_dates.min), :end => l(time_table.bounding_dates.max)) end + def bounding_short_info(dates) + return t('time_tables.time_table.empty') if dates.empty? + "#{l(dates.min)} #{l(dates.max)}" + end + def time_table_bounding( time_table) + bounding_short_info( time_table.bounding_dates) + end def time_tables_shortest_info( vehicle) - return vehicle.bounding_dates.inspect - #"#{l(vehicle.bounding_dates.min)} #{l(vehicle.bounding_dates.max)}" + bounding_short_info( vehicle.bounding_dates) end def time_tables_info( vehicle) vehicle.time_tables.map do |time_table| - composition_info(time_table) + "#{time_table_bounding( time_table)} - #{composition_info(time_table)}" end.join( "\n") end @@ -19,7 +25,7 @@ module TimeTablesHelper return if time_table.bounding_dates.empty? if time_table.dates.empty? t('time_tables.time_table.periods_count', :count => time_table.periods.count) - elsif + elsif time_table.periods.empty? t('time_tables.time_table.dates_count', :count => time_table.dates.count) else t('time_tables.time_table.periods_dates_count', diff --git a/app/views/routes/_route.html.erb b/app/views/routes/_route.html.erb index 7804ec068..4ec720e5d 100644 --- a/app/views/routes/_route.html.erb +++ b/app/views/routes/_route.html.erb @@ -1,9 +1,20 @@ <%= div_for(route) do %> - <div class="wayback"> - <%= link_to image_tag("icons/#{route.wayback}.png"), referential_line_route_path( @referential, @line, route) %> - </div> - <div class="route"> + <%= link_to image_tag("icons/#{route.wayback}.png"), referential_line_route_path( @referential, @line, route) %> + <div> <%= link_to route.name, referential_line_route_path( @referential, @line, route) %> </div> + <div class="info"> + <% if route.number.blank? %> + <%= route.human_attribute_name('number') %> <%= route.number %> - + <% end %> + <% 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') %> + <div class="actions"> + <%= link_to t("routes.actions.edit"), edit_referential_line_route_path(@referential, @line, route), :class => "edit" %> | + <%= link_to t("vehicle_journeys.actions.index"), referential_line_route_vehicle_journeys_path(@referential, @line, route), :class => "link" %> + </div> + </div> <% end %> diff --git a/app/views/routes/show.html.erb b/app/views/routes/show.html.erb index 72524846b..0666fdcf5 100644 --- a/app/views/routes/show.html.erb +++ b/app/views/routes/show.html.erb @@ -93,6 +93,9 @@ <li> <%= link_to t('journey_patterns.actions.new'), new_referential_line_route_journey_pattern_path(@referential, @line, @route), :class => "add" %> </li> + <li> + <%= link_to t('vehicle_journeys.actions.index'), referential_line_route_vehicle_journeys_path(@referential, @line, @route), :class => "link" %> + </li> </ul> <% end %> diff --git a/app/views/vehicle_journeys/_form.html.erb b/app/views/vehicle_journeys/_form.html.erb index 138e4ba99..582253b0f 100644 --- a/app/views/vehicle_journeys/_form.html.erb +++ b/app/views/vehicle_journeys/_form.html.erb @@ -18,7 +18,14 @@ <% end %> <%= form.inputs :class => "stop_times", :name => @vehicle_journey.human_attribute_name(:vehicle_journey_at_stop_ids) do %> - <div class="journey_pattern_dependent_list"> + <table border="0" class="vehicle_journey_at_stops"> + <thead> + <tr> + <th class="hour title"><%= t('.arrival') %></th> + <th class="stop title" ><%= t('.stop_title') %></th> + <th class="hour title"><%= t('.departure') %></th> + </tr> + </thead> <!-- <= form.semantic_fields_for :vehicle_journey_at_stops do |vjas| > <= vjas.object.stop_point.stop_area.name > @@ -27,13 +34,15 @@ < end > --> + <tbody class="journey_pattern_dependent_list"> <%= render :partial => "vehicle_journeys/vehicle_journey_at_stop_fields", :collection => @vehicle_journey.vehicle_journey_at_stops, :as => :vehicle_journey_at_stop %> - </div> + </tbody> + </table> <% end %> <%= form.inputs :class => "time_tables", :name=> @vehicle_journey.human_attribute_name(:time_table_ids) do %> <div class="time_table_list"> - <%= form.input :time_table_ids, :label => t('.time_tables'), :as => :text, :input_html => { :"data-pre" => ( @vehicle_journey.time_tables.map { |time_table| { :id => time_table.id.to_s, :name => time_table.comment } } ).to_json } %> + <%= form.input :time_table_tokens, :label => t('.time_tables'), :as => :text, :input_html => { :"data-pre" => ( @vehicle_journey.time_tables.map { |time_table| { :id => time_table.id, :name => time_table.comment } } ).to_json } %> </div> <% end %> @@ -52,9 +61,9 @@ <script> $(function() { - $( "#vehicle_journey_time_table_ids" ).tokenInput('<%= comment_filter_referential_time_tables_path(@referential, :format => :json) %>', { + $( "#vehicle_journey_time_table_tokens" ).tokenInput('<%= comment_filter_referential_time_tables_path(@referential, :format => :json) %>', { crossDomain: false, - prePopulate: $('#time_table_ids').data('pre'), + prePopulate: $('#time_table_tokens').data('pre'), minChars: 3, }); }); diff --git a/app/views/vehicle_journeys/_vehicle_journey_at_stop_fields.html.erb b/app/views/vehicle_journeys/_vehicle_journey_at_stop_fields.html.erb index 7d9c06228..f6feab945 100644 --- a/app/views/vehicle_journeys/_vehicle_journey_at_stop_fields.html.erb +++ b/app/views/vehicle_journeys/_vehicle_journey_at_stop_fields.html.erb @@ -1,13 +1,24 @@ <% vjas = vehicle_journey_at_stop %> -<li class="time input optional <%= vjas._destroy ? "no_stop" : "" %>"> +<tr class="time input optional <%= vjas._destroy ? "no_stop" : "" %> <%= (vehicle_journey_at_stop_counter%2==0) ? "odd" : "even" %>"> + <td> + <%= select_hour(vjas.arrival_time ? vjas.arrival_time.hour : 0, :prefix => "vehicle_journey", :field_name => "vehicle_journey_at_stops_attributes[#{vehicle_journey_at_stop_counter}][arrival_time(4i)]") %> + <%= select_minute(vjas.arrival_time ? vjas.arrival_time.min : 0, :prefix => "vehicle_journey", :field_name => "vehicle_journey_at_stops_attributes[#{vehicle_journey_at_stop_counter}][arrival_time(5i)]") %> + </td> + <td> <input name=<%= "vehicle_journey[vehicle_journey_at_stops_attributes][#{vehicle_journey_at_stop_counter}][id]" %> type="hidden" value="<%= vjas.id %>"> <input name=<%= "vehicle_journey[vehicle_journey_at_stops_attributes][#{vehicle_journey_at_stop_counter}][_destroy]" %> type="hidden" value="<%= vjas._destroy ? "1" : "0" %>"> <input name=<%= "vehicle_journey[vehicle_journey_at_stops_attributes][#{vehicle_journey_at_stop_counter}][stop_point_id]" %> type="hidden" value="<%= vjas.stop_point_id %>"> <input name=<%= "vehicle_journey[vehicle_journey_at_stops_attributes][#{vehicle_journey_at_stop_counter}][departure_time(3i)]" %> type="hidden" value="1"> <input name=<%= "vehicle_journey[vehicle_journey_at_stops_attributes][#{vehicle_journey_at_stop_counter}][departure_time(2i)]" %> type="hidden" value="1"> <input name=<%= "vehicle_journey[vehicle_journey_at_stops_attributes][#{vehicle_journey_at_stop_counter}][departure_time(1i)]" %> type="hidden" value="2000"> + <input name=<%= "vehicle_journey[vehicle_journey_at_stops_attributes][#{vehicle_journey_at_stop_counter}][arrival_time(3i)]" %> type="hidden" value="1"> + <input name=<%= "vehicle_journey[vehicle_journey_at_stops_attributes][#{vehicle_journey_at_stop_counter}]arrival_time(2i)]" %> type="hidden" value="1"> + <input name=<%= "vehicle_journey[vehicle_journey_at_stops_attributes][#{vehicle_journey_at_stop_counter}][arrival_time(1i)]" %> type="hidden" value="2000"> <label for=<%= "vehicle_journey_vehicle_journey_at_stops_attributes_#{vehicle_journey_at_stop_counter}_departure_time_5i" %>><%= vjas.stop_point.stop_area.name %></label> + </td> + <td> <%= select_hour(vjas.departure_time ? vjas.departure_time.hour : 0, :prefix => "vehicle_journey", :field_name => "vehicle_journey_at_stops_attributes[#{vehicle_journey_at_stop_counter}][departure_time(4i)]") %> <%= select_minute(vjas.departure_time ? vjas.departure_time.min : 0, :prefix => "vehicle_journey", :field_name => "vehicle_journey_at_stops_attributes[#{vehicle_journey_at_stop_counter}][departure_time(5i)]") %> - </li> + </td> +</tr> diff --git a/app/views/vehicle_journeys/index.html.erb b/app/views/vehicle_journeys/index.html.erb index 532dcc2bd..6e126e64c 100644 --- a/app/views/vehicle_journeys/index.html.erb +++ b/app/views/vehicle_journeys/index.html.erb @@ -25,14 +25,16 @@ <tr> <th class="title">Missions : </th> <% @vehicle_journeys.each do |vj| %> - <th> <%= link_to vj.journey_pattern.published_name.blank? ? vj.journey_pattern.id: vj.journey_pattern.published_name, + <th> <%= link_to vj.journey_pattern.published_name.blank? ? vj.journey_pattern.id: vj.journey_pattern.published_name.first(8), [@referential, @line, @route, vj.journey_pattern]%></th> <% end %> </tr> <tr> <th class="title">Calendriers : </th> <% @vehicle_journeys.each do |vj| %> - <th title="<%= time_tables_info( vj) %>" class="calendars"> <%= time_tables_shortest_info( vj) %></th> + <th title="<%= time_tables_info( vj) %>" class="calendars"> + <%= time_tables_shortest_info( vj) %> + </th> <% end %> </tr> <tr> @@ -56,6 +58,9 @@ </div> <% content_for :sidebar do %> <ul class="actions"> + <li> + <%= link_to t('vehicle_journeys.actions.new'), new_referential_line_route_vehicle_journey_path(@referential, @line, @route), :class => "link" %> + </li> </ul> <% end %> diff --git a/app/views/vehicle_journeys/show.html.erb b/app/views/vehicle_journeys/show.html.erb index 997c92705..06f6f0c9f 100644 --- a/app/views/vehicle_journeys/show.html.erb +++ b/app/views/vehicle_journeys/show.html.erb @@ -52,6 +52,28 @@ </p> </div> </div> +<h3><%= @vehicle_journey.human_attribute_name(:vehicle_journey_at_stop_ids) %></h3> +<div class="vehicle_journey_at_stops"> + <table border="0" > + <thead> + <tr> + <th class="hour title"><%= t('.arrival') %></th> + <th class="stop title" ><%= t('.stop_title') %></th> + <th class="hour title"><%= t('.departure') %></th> + </tr> + <thead> + <tbody> + <% @vehicle_journey.vehicle_journey_at_stops.each_with_index do |vjas, index| %> + <tr class="<%= index%2==0 ? "odd" : "even" %>"> + <td class="hour"><%= vjas.arrival_time ? l( vjas.arrival_time, :format => :hour) : "" %></td> + <td><%= link_to vjas.stop_point.stop_area.name, [@referential, vjas.stop_point.stop_area] %></td> + <td class="hour"><%= vjas.departure_time ? l( vjas.departure_time, :format => :hour) : "" %></td> + </tr> + <% end %> + </tbody> + </table> +</div> + <h3><%= t('.time_tables') %></h3> <div class="vehicle_journey_time_tables"> <%= render :partial => "vehicle_journeys/time_table", :collection => @vehicle_journey.time_tables %> diff --git a/config/locales/routes.yml b/config/locales/routes.yml index 4d0c7842d..7ab2ca623 100644 --- a/config/locales/routes.yml +++ b/config/locales/routes.yml @@ -27,6 +27,9 @@ en: other: routes attributes: route: + wayback: + positive: forward + negative: backward line: Line name: Name published_name: Published name @@ -69,6 +72,9 @@ fr: other: "Séquences d'arrêts" attributes: route: + wayback: + positive: Aller + negative: Retour line: Ligne name: Nom published_name: Nom public diff --git a/config/locales/vehicle_journeys.yml b/config/locales/vehicle_journeys.yml index 712f684d9..8ed746e3d 100644 --- a/config/locales/vehicle_journeys.yml +++ b/config/locales/vehicle_journeys.yml @@ -4,6 +4,7 @@ en: title_stopless: Vehicle journey %{name} title: Vehicle journey %{name} leaving from %{stop} at %{time} actions: + index: "Vehicle time's board" new: Add a new vehicle journey edit: Edit this vehicle journey destroy: Remove this vehicle journey @@ -14,13 +15,20 @@ en: title_stopless: Update vehicle journey %{name} title: Update vehicle journey %{name} leaving from %{stop} at %{time} form: + stop_title: Stop + departure: Departure + arrival: Arrival time_tables: Associated calendars to vehicle journey show: title: Vehicle Journey %{vehicle journey} + stop_title: Stop + departure: Departure + arrival: Arrival time_tables: Calendars list bounding: From %{start} to %{end} index: title: Vehicle journeys on route %{route} + vehicle_journeys: "Departure's times" activerecord: models: vehicle_journey: @@ -54,6 +62,7 @@ fr: title_stopless: Course %{name} title: Course %{name} partant de %{stop} à %{time} actions: + index: "Horaires des courses" new: "Ajouter une course" edit: "Modifier cette course" destroy: "Supprimer cette course" @@ -64,13 +73,20 @@ fr: title_stopless: "Modifier la course %{name}" title: "Modifier la course partant de %{stop} à %{time}" form: + stop_title: Arrêt + departure: Départ + arrival: Arrivée time_tables: Calendriers associés à la course show: title: "Course au départ de %{stop} à %{time} sur la séquence %{route}" + stop_title: Arrêt + departure: Départ + arrival: Arrivée time_tables: Liste des calendriers bounding: De %{start} à %{end} index: title: "Courses de la séquence d'arrêts %{route}" + vehicle_journeys: "Horaires de départ aux arrêts" activerecord: models: vehicle_journey: diff --git a/spec/views/vehicle_journeys/_vehicle_journey_at_stop_fields.html.erb_spec.rb b/spec/views/vehicle_journeys/_vehicle_journey_at_stop_fields.html.erb_spec.rb index 77f98ffbb..d7c307c1d 100644 --- a/spec/views/vehicle_journeys/_vehicle_journey_at_stop_fields.html.erb_spec.rb +++ b/spec/views/vehicle_journeys/_vehicle_journey_at_stop_fields.html.erb_spec.rb @@ -55,7 +55,6 @@ describe "/vehicle_journeys/_vehicle_journey_at_stop_fields" do end it "should not render li.no_stop" do render_collection - puts rendered.inspect rendered.should_not have_selector("li.no_stop") end end |
