aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/views/vehicle_journeys/_form.html.erb51
-rw-r--r--app/views/vehicle_journeys/select_journey_pattern.js.erb3
2 files changed, 28 insertions, 26 deletions
diff --git a/app/views/vehicle_journeys/_form.html.erb b/app/views/vehicle_journeys/_form.html.erb
index 478a6b9d3..1c3945164 100644
--- a/app/views/vehicle_journeys/_form.html.erb
+++ b/app/views/vehicle_journeys/_form.html.erb
@@ -16,10 +16,11 @@
<li class="input">
<%= form.label @vehicle_journey.human_attribute_name(:vehicle_journey_at_stop_ids), :class => "label" %>
</li>
+
<% unless @vehicle_journey.vehicle_journey_at_stops.empty? ||
@vehicle_journey.vehicle_journey_at_stops.any? { |vjas| vjas.departure_time.nil? } %> <div class="vehicle_journey_at_stops">
<div class="well">
- <span class="title"><%= t(".slide_title") %></span>
+ <span class="title"><%= t(".slide_title") %></span>
<div>
<span><%= t(".set") %></span> <%= select_tag "", options_for_select( [ [t('.slide_departure'), "departure"], [t('.slide_arrival'), "arrival"] ] ), :class => "departure_or_arrival" %> <span><%= t(".to") %></span>
<%= select_hour(@vehicle_journey.vehicle_journey_at_stops.first.departure_time.hour) %>
@@ -27,32 +28,32 @@
<a class="slide btn btn-default"><%= t(".slide") %></a>
</div>
</div>
+ <% end %>
- <% end %>
-
- <table class="table table-hover table-striped">
- <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>
- <tfoot>
- <tr>
- <td class="title"> <a class="to_departures"><%= t('.to_departures') %></a></td>
- <td class="title" ></td>
- <td class="title"><a class="to_arrivals"><%= t('.to_arrivals') %></a></td>
- </tr>
- </tfoot>
- <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, :locals => { :vehicle_journey_at_stops_size => @vehicle_journey.vehicle_journey_at_stops.size } %>
- </tbody>
- </table>
- </div>
+ <table class="table table-hover table-striped">
+ <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>
+ <tfoot>
+ <tr>
+ <td class="title"> <a class="to_departures"><%= t('.to_departures') %></a></td>
+ <td class="title" ></td>
+ <td class="title"><a class="to_arrivals"><%= t('.to_arrivals') %></a></td>
+ </tr>
+ </tfoot>
+ <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, :locals => { :vehicle_journey_at_stops_size => @vehicle_journey.vehicle_journey_at_stops.size } %>
+
+ </tbody>
+ </table>
+
<% end %>
-
+
<%= form.actions do %>
<%= form.action :submit, :as => :button %>
<%= form.action :cancel, :as => :link %>
diff --git a/app/views/vehicle_journeys/select_journey_pattern.js.erb b/app/views/vehicle_journeys/select_journey_pattern.js.erb
index 3487da1ae..6a32c7b9d 100644
--- a/app/views/vehicle_journeys/select_journey_pattern.js.erb
+++ b/app/views/vehicle_journeys/select_journey_pattern.js.erb
@@ -1,6 +1,7 @@
$('.journey_pattern_dependent_list').html('<%= escape_javascript(
render(:partial => 'vehicle_journeys/vehicle_journey_at_stop_fields',
:collection => @vehicle_journey.vehicle_journey_at_stops,
- :as => :vehicle_journey_at_stop)).html_safe %>');
+ :as => :vehicle_journey_at_stop,
+ :locals => { :vehicle_journey_at_stops_size => @vehicle_journey.vehicle_journey_at_stops.size })).html_safe %>');