aboutsummaryrefslogtreecommitdiffstats
path: root/app/views
diff options
context:
space:
mode:
authorBruno Perles2015-11-04 14:06:03 +0100
committerBruno Perles2015-11-04 14:06:03 +0100
commit3fab0c17c5a23e5cc20228eae3d1a718e45ee174 (patch)
treeee9495a6b9b40f7d16775d9daa91d58d6dc8ce6a /app/views
parent632dc2bf7de54729936998d86c840c626e2ab900 (diff)
parente5861132506bcc245c5d7cc34f00979c3932d2ce (diff)
downloadchouette-core-3fab0c17c5a23e5cc20228eae3d1a718e45ee174.tar.bz2
Merge vehicle_frequencies
Diffstat (limited to 'app/views')
-rw-r--r--app/views/help/timebands.textile0
-rw-r--r--app/views/lines/_line.erb40
-rw-r--r--app/views/routes/_route.html.erb47
-rw-r--r--app/views/shared/_header.erb4
-rw-r--r--app/views/timebands/_form.html.erb12
-rw-r--r--app/views/timebands/_sidebar.html.erb11
-rw-r--r--app/views/timebands/edit.html.erb3
-rw-r--r--app/views/timebands/index.html.erb29
-rw-r--r--app/views/timebands/new.html.erb3
-rw-r--r--app/views/timebands/show.html.erb12
-rw-r--r--app/views/vehicle_journey_frequencies/_form_footer.html.erb14
-rw-r--r--app/views/vehicle_journey_frequencies/_form_vehicle_journey_at_stops.html.erb59
-rw-r--r--app/views/vehicle_journey_frequencies/_journey_frequency_fields.html.erb15
-rw-r--r--app/views/vehicle_journey_frequencies/_show_journey_frequencies.html.erb28
-rw-r--r--app/views/vehicle_journey_frequencies/_show_sidebar.html.erb23
-rw-r--r--app/views/vehicle_journey_frequencies/_show_vehicle_journey_at_stops.html.erb29
-rw-r--r--app/views/vehicle_journey_frequencies/_vehicle_journey_at_stop_fields.html.erb52
-rw-r--r--app/views/vehicle_journey_frequencies/_vehicle_journeys_matrix.html.erb22
-rw-r--r--app/views/vehicle_journey_frequencies/edit.html.erb7
-rw-r--r--app/views/vehicle_journey_frequencies/edit.js.erb10
-rw-r--r--app/views/vehicle_journey_frequencies/new.html.erb6
-rw-r--r--app/views/vehicle_journey_frequencies/new.js.erb13
-rw-r--r--app/views/vehicle_journey_frequencies/select_journey_pattern.js.erb5
-rw-r--r--app/views/vehicle_journey_frequencies/show.html.erb3
-rw-r--r--app/views/vehicle_journeys/_form.html.erb59
-rw-r--r--app/views/vehicle_journeys/_form_footer.html.erb5
-rw-r--r--app/views/vehicle_journeys/_form_vehicle_journey_at_stops.html.erb49
-rw-r--r--app/views/vehicle_journeys/_route_popover.html.erb3
-rw-r--r--app/views/vehicle_journeys/_show_details.html.erb87
-rw-r--r--app/views/vehicle_journeys/_show_sidebar.html.erb15
-rw-r--r--app/views/vehicle_journeys/_show_vehicle_journey_at_stops.html.erb20
-rw-r--r--app/views/vehicle_journeys/_sidebar.html.erb11
-rw-r--r--app/views/vehicle_journeys/_vehicle_journeys.html.erb40
-rw-r--r--app/views/vehicle_journeys/_vehicle_journeys_matrix.html.erb40
-rw-r--r--app/views/vehicle_journeys/edit.html.erb3
-rw-r--r--app/views/vehicle_journeys/index.html.erb43
-rw-r--r--app/views/vehicle_journeys/new.html.erb2
-rw-r--r--app/views/vehicle_journeys/new.js.erb11
-rw-r--r--app/views/vehicle_journeys/show.html.erb121
39 files changed, 684 insertions, 272 deletions
diff --git a/app/views/help/timebands.textile b/app/views/help/timebands.textile
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/app/views/help/timebands.textile
diff --git a/app/views/lines/_line.erb b/app/views/lines/_line.erb
index 69c7978ab..b23992a1c 100644
--- a/app/views/lines/_line.erb
+++ b/app/views/lines/_line.erb
@@ -1,26 +1,26 @@
-<div id="index_item" class="panel panel-default line">
- <div class="panel-heading">
- <div class="panel-title clearfix">
- <span class="pull-right">
- <%= link_to edit_referential_line_path(@referential, line), :class => "btn btn-default btn-sm" do %>
+<div id="index_item" class="panel panel-default line ce-LineBlock">
+ <div class="panel-heading ce-LineBlock-header">
+ <ul class="ce-LineBlock-header-list">
+ <li>
+ <%= check_box_tag "ids[]", line.id, false, class: "multiple_selection", style: "display: none;" %>
+ <% if line.number && line.number.length <= 3 %>
+ <span class="label label-default line_number" style="<%= number_style(line) %>"><%= line.number %></span>
+ <% end %>
+ </li>
+ <li>
+ <%= link_to([@referential, line], class: 'preview', title: "#{Chouette::Line.model_name.human.capitalize} #{line.name}") do %>
+ <h5 class="ce-LineBlock-header-title"><%= truncate(line.name, length: 24) %></h5>
+ <% end %>
+ </li>
+ <li>
+ <%= link_to edit_referential_line_path(@referential, line), class: 'btn btn-default btn-sm' do %>
<span class="fa fa-pencil"></span>
- <% end if edit %>
- <%= link_to referential_line_path(@referential, line), :method => :delete, :data => {:confirm => t('lines.actions.destroy_confirm')}, :class => "btn btn-danger btn-sm" do %>
+ <% end if edit %>
+ <%= link_to referential_line_path(@referential, line), method: :delete, data: { confirm: t('lines.actions.destroy_confirm') }, class: 'btn btn-danger btn-sm' do %>
<span class="fa fa-trash-o"></span>
<% end if delete %>
- </span>
- <h5>
- <%= check_box_tag "ids[]", line.id, false, :class => "multiple_selection", :style => "display: none;" %>
- <% if line.number and line.number.length <= 3 %>
- <span class="label label-default line_number" style="<%= number_style(line) %>"><%= line.number %></span>
- <% end %>
- <%= link_to([@referential, line], :class => "preview", :title => "#{Chouette::Line.model_name.human.capitalize} #{line.name}") do %>
- <span class="name">
- <%= truncate(line.name, :length => 20) %>
- </span>
- <% end %>
- </h5>
- </div>
+ </li>
+ </ul>
</div>
<div class="panel-body">
<p>
diff --git a/app/views/routes/_route.html.erb b/app/views/routes/_route.html.erb
index 0fee47cd1..179f06a25 100644
--- a/app/views/routes/_route.html.erb
+++ b/app/views/routes/_route.html.erb
@@ -22,26 +22,33 @@
</div>
</div>
<div class="panel-body">
- <p>
- <% if route.journey_patterns.size > 0 %>
- <i class="fa fa-clock-o"></i><%= link_to t("vehicle_journeys.actions.index"), referential_line_route_vehicle_journeys_path(@referential, @line, route) %>
- <% else %>
- <%= t('.no_journey_pattern')%>
- <% end%>
- </p>
- <p>
- <% if route.opposite_route %>
- <%= fonticon_wayback(route.opposite_route.wayback) %><%= link_to truncate(route.opposite_route.name, :length => 30), referential_line_route_path( @referential, @line, route.opposite_route) %>
- <% else %>
- <%= t('.no_opposite') %>
+ <p>
+ <% if route.journey_patterns.size > 0 %>
+ <i class="fa fa-clock-o"></i>
+ <%= link_to t("vehicle_journeys.actions.index"), referential_line_route_vehicle_journeys_path(@referential, @line, route) %>
+ <% else %>
+ <%= t('.no_journey_pattern')%>
+ <% end%>
+ </p>
+ <% if @line.vehicle_journey_frequencies? %>
+ <p>
+ <i class="fa fa-clock-o"></i>
+ <%= link_to t("vehicle_journey_frequencies.actions.index"), referential_line_route_vehicle_journey_frequencies_path(@referential, @line, route) %>
+ </p>
<% end %>
- </p>
- <p>
- <% if ! route.direction.blank? %>
- <%= route.human_attribute_name('direction_code') %> : <%= t('directions.label.'+route.direction_code) %>
- <% else %>
- <br>
- <% end %>
- </p>
+ <p>
+ <% if route.opposite_route %>
+ <%= fonticon_wayback(route.opposite_route.wayback) %><%= link_to truncate(route.opposite_route.name, :length => 30), referential_line_route_path( @referential, @line, route.opposite_route) %>
+ <% else %>
+ <%= t('.no_opposite') %>
+ <% end %>
+ </p>
+ <p>
+ <% if ! route.direction.blank? %>
+ <%= route.human_attribute_name('direction_code') %> : <%= t('directions.label.'+route.direction_code) %>
+ <% else %>
+ <br>
+ <% end %>
+ </p>
</div>
</div>
diff --git a/app/views/shared/_header.erb b/app/views/shared/_header.erb
index d1e8dd2ce..1e8a63fba 100644
--- a/app/views/shared/_header.erb
+++ b/app/views/shared/_header.erb
@@ -65,6 +65,10 @@
<span class="badge pull-right"><%= @referential.time_tables.size %></span><%= Referential.human_attribute_name("time_tables") %>
<% end %>
</li>
+ <li><%= link_to referential_timebands_path(@referential) do %>
+ <span class="badge pull-right"><%= @referential.timebands.size %></span><%= Referential.human_attribute_name("timebands") %>
+ <% end %>
+ </li>
</ul>
</li>
<li><%= link_to Referential.human_attribute_name("imports"), referential_imports_path(@referential) %></li>
diff --git a/app/views/timebands/_form.html.erb b/app/views/timebands/_form.html.erb
new file mode 100644
index 000000000..bfa32212e
--- /dev/null
+++ b/app/views/timebands/_form.html.erb
@@ -0,0 +1,12 @@
+<%= semantic_form_for [@referential, @timeband] do |form| %>
+ <%= form.inputs do %>
+ <%= form.input :name %>
+ <%= form.input :start_time %>
+ <%= form.input :end_time %>
+ <% end %>
+
+ <%= form.actions do %>
+ <%= form.action :submit, :as => :button %>
+ <%= form.action :cancel, :as => :link %>
+ <% end %>
+<% end %>
diff --git a/app/views/timebands/_sidebar.html.erb b/app/views/timebands/_sidebar.html.erb
new file mode 100644
index 000000000..8ffa16dca
--- /dev/null
+++ b/app/views/timebands/_sidebar.html.erb
@@ -0,0 +1,11 @@
+<% content_for :sidebar do %>
+ <ul class="actions">
+ <li><%= link_to t('timebands.actions.new'), new_referential_timeband_path(@referential), :class => "add" %></li>
+ <% if @timeband %>
+ <li><%= link_to t('timebands.actions.edit'), edit_referential_timeband_path(@referential, @timeband), :class => "edit" %></li>
+ <li><%= link_to t('timebands.actions.destroy'), referential_timeband_path(@referential, @timeband), :method => :delete, :data => {:confirm => t('timebands.actions.destroy_confirm')}, :class => "remove" %></li>
+ <% end %>
+ </ul>
+<% end %>
+
+
diff --git a/app/views/timebands/edit.html.erb b/app/views/timebands/edit.html.erb
new file mode 100644
index 000000000..bc2c73ace
--- /dev/null
+++ b/app/views/timebands/edit.html.erb
@@ -0,0 +1,3 @@
+<%= title_tag t('timebands.edit.title', timeband: @timeband.name) %>
+
+<%= render "form" %>
diff --git a/app/views/timebands/index.html.erb b/app/views/timebands/index.html.erb
new file mode 100644
index 000000000..54be52675
--- /dev/null
+++ b/app/views/timebands/index.html.erb
@@ -0,0 +1,29 @@
+<%= title_tag t('timebands.index.title') %>
+
+<% if @timebands.any? %>
+ <table class="table table-striped table-condensed">
+ <thead>
+ <tr>
+ <th><%= t('activerecord.attributes.timeband.name') %></th>
+ <th><%= t('activerecord.attributes.timeband.start_time') %></th>
+ <th><%= t('activerecord.attributes.timeband.end_time') %></th>
+ <th></th>
+ </tr>
+ </thead>
+ <tbody>
+ <% @timebands.each do |timeband| %>
+ <tr>
+ <td><%= link_to timeband.name, referential_timeband_path(@referential, timeband) %></td>
+ <td><%= l(timeband.start_time, format: :hour) %></td>
+ <td><%= l(timeband.end_time, format: :hour) %></td>
+ <td>
+ <%= link_to '', edit_referential_timeband_path(@referential, timeband), :class => "edit" %>
+ <%= link_to '', referential_timeband_path(@referential, timeband), :method => :delete, :data => {:confirm => t('timebands.actions.destroy_confirm')}, :class => "remove" %>
+ </td>
+ </tr>
+ <% end %>
+ </tbody>
+ </table>
+<% end %>
+
+<%= render 'sidebar' %>
diff --git a/app/views/timebands/new.html.erb b/app/views/timebands/new.html.erb
new file mode 100644
index 000000000..c016325d0
--- /dev/null
+++ b/app/views/timebands/new.html.erb
@@ -0,0 +1,3 @@
+<%= title_tag t('timebands.new.title') %>
+
+<%= render "form" %>
diff --git a/app/views/timebands/show.html.erb b/app/views/timebands/show.html.erb
new file mode 100644
index 000000000..1a6171712
--- /dev/null
+++ b/app/views/timebands/show.html.erb
@@ -0,0 +1,12 @@
+<%= title_tag t( 'timebands.show.title', timeband: @timeband.name )%>
+
+<div class="summary">
+ <p>
+ <label><%= @timeband.name %>: </label>
+ <%= l(@timeband.start_time, format: :hour) %>
+ -
+ <%= l(@timeband.end_time, format: :hour) %>
+ </p>
+</div>
+
+<%= render 'sidebar' %>
diff --git a/app/views/vehicle_journey_frequencies/_form_footer.html.erb b/app/views/vehicle_journey_frequencies/_form_footer.html.erb
new file mode 100644
index 000000000..d38f8af0e
--- /dev/null
+++ b/app/views/vehicle_journey_frequencies/_form_footer.html.erb
@@ -0,0 +1,14 @@
+<% if vehicle_journey.new_record? %>
+ <%= javascript_include_tag new_referential_line_route_vehicle_journey_frequency_path(
+ @referential,
+ @line,
+ @route,
+ format: :js) %>
+<% else %>
+ <%= javascript_include_tag edit_referential_line_route_vehicle_journey_frequency_path(
+ @referential,
+ @line,
+ @route,
+ vehicle_journey,
+ format: :js) %>
+<% end %>
diff --git a/app/views/vehicle_journey_frequencies/_form_vehicle_journey_at_stops.html.erb b/app/views/vehicle_journey_frequencies/_form_vehicle_journey_at_stops.html.erb
new file mode 100644
index 000000000..7f503e547
--- /dev/null
+++ b/app/views/vehicle_journey_frequencies/_form_vehicle_journey_at_stops.html.erb
@@ -0,0 +1,59 @@
+<li class="input">
+ <%= form.label vehicle_journey.human_attribute_name(:vehicle_journey_at_stop_ids), class: 'label' %>
+ <table class="table-striped ce-TimeBandFormTable">
+ <thead>
+ <tr>
+ <th>
+ <%= t('vehicle_journeys.form.stop_title') %>
+ </th>
+ <th></th>
+ <th>
+ <%= t('vehicle_journeys.form.arrival') %>
+ </th>
+ <th>
+ <%= t('vehicle_journeys.form.departure') %>
+ </th>
+ </tr>
+ </thead>
+ <tbody class="journey_pattern_dependent_list">
+ <%= render partial: '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>
+ <tfoot>
+ <tr>
+ <td></td>
+ <td></td>
+ <td>
+ <%= button_tag 'data-ce-action' => 'to_departures', class: 'ce-hide btn btn-primary' do %>
+ <%= t('vehicle_journeys.form.to_departures').html_safe %>
+ <i class="fa fa-angle-double-right"></i>
+ <% end %>
+ <td>
+ <%= button_tag 'data-ce-action' => 'to_arrivals', class: 'ce-hide btn btn-primary' do %>
+ <i class="fa fa-angle-double-left"></i>
+ <%= t('vehicle_journeys.form.to_arrivals').html_safe %>
+ <% end %>
+ </td>
+ </tr>
+ </tfoot>
+ </table>
+</li>
+
+<li class="input">
+ <%= form.label vehicle_journey.human_attribute_name(:journey_frequency_ids), class: 'label' %>
+ <ul class="ce-FrequencyFormFields">
+ <li><%= t('activerecord.attributes.journey_frequency.timeband') %></li>
+ <li><%= t('activerecord.attributes.journey_frequency.first_departure_time') %></li>
+ <li><%= t('activerecord.attributes.journey_frequency.last_departure_time') %></li>
+ <li><%= t('activerecord.attributes.journey_frequency.scheduled_headway_interval') %></li>
+ <li></li>
+ <li></li>
+ </ul>
+ <%= form.semantic_fields_for :journey_frequencies do |journey_frequency| %>
+ <%= render 'journey_frequency_fields', f: journey_frequency %>
+ <% end %>
+ <div class="actions-add-fields">
+ <%= link_to_add_association t('journey_frequencies.form.add_line'), form, :journey_frequencies, class: 'btn btn-primary' %>
+ </div>
+</li>
diff --git a/app/views/vehicle_journey_frequencies/_journey_frequency_fields.html.erb b/app/views/vehicle_journey_frequencies/_journey_frequency_fields.html.erb
new file mode 100644
index 000000000..9370fc8d3
--- /dev/null
+++ b/app/views/vehicle_journey_frequencies/_journey_frequency_fields.html.erb
@@ -0,0 +1,15 @@
+<div class="nested-fields">
+ <ul class="ce-FrequencyFormFields">
+ <%= f.input :timeband, collection: Chouette::Timeband.all.map{ |timeband| [timeband.fullname, timeband.id] }, label: false %>
+ <%= f.input :first_departure_time, label: false %>
+ <%= f.input :last_departure_time, label: false %>
+ <%= f.input :scheduled_headway_interval, label: false %>
+ <%= f.input :exact_time, label: t('activerecord.attributes.journey_frequency.exact_time') %>
+ <li>
+ <label class="label"></label>
+ <%= link_to_remove_association f do %>
+ <i class="fa fa-trash"></i>
+ <% end %>
+ </li>
+ </ul>
+</div>
diff --git a/app/views/vehicle_journey_frequencies/_show_journey_frequencies.html.erb b/app/views/vehicle_journey_frequencies/_show_journey_frequencies.html.erb
new file mode 100644
index 000000000..328c702f9
--- /dev/null
+++ b/app/views/vehicle_journey_frequencies/_show_journey_frequencies.html.erb
@@ -0,0 +1,28 @@
+<h3><%= t('vehicle_journeys.show.journey_frequencies') %></h3>
+<div class="journey_frequencies content">
+ <table class="table table-hover table-striped">
+ <thead>
+ <tr>
+ <th><%= t('activerecord.attributes.journey_frequency.timeband') %></th>
+ <th><%= t('activerecord.attributes.journey_frequency.first_departure_time') %></th>
+ <th><%= t('activerecord.attributes.journey_frequency.last_departure_time') %></th>
+ <th><%= t('activerecord.attributes.journey_frequency.scheduled_headway_interval') %></th>
+ <th><%= t('activerecord.attributes.journey_frequency.exact_time') %></th>
+ </tr>
+ <thead>
+ <tbody>
+ <% @vehicle_journey_frequency.journey_frequencies.each do |journey_frequency| %>
+ <tr class="<%= cycle :odd, :even %>">
+ <td>
+ <%= link_to journey_frequency.timeband.fullname,
+ referential_timeband_path(@referential, journey_frequency.timeband) if journey_frequency.timeband %>
+ </td>
+ <td><%= l(journey_frequency.first_departure_time, format: :hour) %></td>
+ <td><%= l(journey_frequency.last_departure_time, format: :hour) %></td>
+ <td><%= l(journey_frequency.scheduled_headway_interval, format: :hour) %></td>
+ <td><%= '<i class="fa fa-check"></i>'.html_safe if journey_frequency.exact_time %></td>
+ </tr>
+ <% end %>
+ </tbody>
+ </table>
+</div>
diff --git a/app/views/vehicle_journey_frequencies/_show_sidebar.html.erb b/app/views/vehicle_journey_frequencies/_show_sidebar.html.erb
new file mode 100644
index 000000000..2a7be143c
--- /dev/null
+++ b/app/views/vehicle_journey_frequencies/_show_sidebar.html.erb
@@ -0,0 +1,23 @@
+<% 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: "add" %>
+ </li>
+ <li>
+ <%= link_to t('vehicle_journeys.actions.new_frequency'),
+ new_referential_line_route_vehicle_journey_frequency_path(@referential, @line, @route), class: "add" %>
+ </li>
+ <li>
+ <%= link_to t('vehicle_journeys.actions.edit_frequency'),
+ edit_referential_line_route_vehicle_journey_frequency_path(@referential, @line, @route, @vehicle_journey_frequency),
+ class: "edit" %>
+ </li>
+ <li>
+ <%= link_to t('vehicle_journeys.actions.destroy'),
+ referential_line_route_vehicle_journey_path(@referential, @line, @route, @vehicle_journey_frequency),
+ method: :delete, data: { confirm: t('vehicle_journeys.actions.destroy_confirm') }, class: "remove" %>
+ </li>
+ </ul>
+ <%= creation_tag(@vehicle_journey_frequency) %>
+<% end %>
diff --git a/app/views/vehicle_journey_frequencies/_show_vehicle_journey_at_stops.html.erb b/app/views/vehicle_journey_frequencies/_show_vehicle_journey_at_stops.html.erb
new file mode 100644
index 000000000..0a91a8af3
--- /dev/null
+++ b/app/views/vehicle_journey_frequencies/_show_vehicle_journey_at_stops.html.erb
@@ -0,0 +1,29 @@
+<div class="vehicle_journey_at_stops content">
+ <table class="table-striped ce-TimeBandFormTable">
+ <thead>
+ <tr>
+ <th class="stop title" ><%= t('vehicle_journeys.show.stop_title') %></th>
+ <th></th>
+ <th class="hour title"><%= t('vehicle_journeys.show.arrival') %></th>
+ <th class="hour title"><%= t('vehicle_journeys.show.departure') %></th>
+ </tr>
+ <thead>
+ <tbody>
+ <% @vehicle_journey_frequency.vehicle_journey_at_stops.each do |vjas| %>
+ <tr class="<%= cycle :odd, :even %>">
+ <td><%= link_to vjas.stop_point.stop_area.name, [@referential, vjas.stop_point.stop_area] %></td>
+ <td class="ce-TimeBandFormTable-circleLine">
+ <span class="ce-TimeBandFormTable-circle"></span>
+ <span class="ce-TimeBandFormTable-line"></span>
+ </td>
+ <td class="hour <%= 'missing' if vjas.arrival_time.nil? %>">
+ <%= l(vjas.arrival_time, format: :hour) if vjas.arrival_time %>
+ </td>
+ <td class="hour <%= 'missing' if vjas.departure_time.nil? %>">
+ <%= l(vjas.departure_time, format: :hour) if vjas.departure_time %>
+ </td>
+ </tr>
+ <% end %>
+ </tbody>
+ </table>
+</div>
diff --git a/app/views/vehicle_journey_frequencies/_vehicle_journey_at_stop_fields.html.erb b/app/views/vehicle_journey_frequencies/_vehicle_journey_at_stop_fields.html.erb
new file mode 100644
index 000000000..5a4ed7382
--- /dev/null
+++ b/app/views/vehicle_journey_frequencies/_vehicle_journey_at_stop_fields.html.erb
@@ -0,0 +1,52 @@
+<%
+ vjas = vehicle_journey_at_stop
+ tab_counter_arrival = 2 * vehicle_journey_at_stop_counter + 100
+ tab_counter_departure = (vehicle_journey_at_stops_size * 2) + 2 * vehicle_journey_at_stop_counter + 100
+%>
+<tr class="time input optional <%= 'no_stop' if vjas._destroy %> <%= cycle :odd, :even %>" >
+ <td>
+ <%= {
+ id: vjas.id,
+ _destroy: (vjas._destroy ? 1 : 0),
+ stop_point_id: vjas.stop_point_id,
+ :'departure_time(3i)' => 1,
+ :'departure_time(2i)' => 1,
+ :'departure_time(1i)' => 1,
+ :'arrival_time(3i)' => 1,
+ :'arrival_time(2i)' => 1,
+ :'arrival_time(1i)' => 2000
+ }.map{ |k, v|
+ "<input name=\"vehicle_journey_frequency[vehicle_journey_at_stops_attributes][#{vehicle_journey_at_stop_counter}][#{k}]\"
+ type=\"hidden\" value=\"#{v}\">" }.join("\n").html_safe %>
+
+ <%= vjas.stop_point.stop_area.name %>
+ </td>
+ <td class="ce-TimeBandFormTable-circleLine">
+ <span class="ce-TimeBandFormTable-circle"></span>
+ <span class="ce-TimeBandFormTable-line"></span>
+ </td>
+ <td class="arrival_time <%= 'missing' unless vjas.arrival_time %> <%= 'invalid_position' if vjas.errors[:arrival_time].present? %>">
+ <%= select_hour(vjas.arrival_time ? vjas.arrival_time.hour : 0,
+ {
+ prefix: 'vehicle_journey_frequency',
+ field_name: "vehicle_journey_at_stops_attributes[#{vehicle_journey_at_stop_counter}][arrival_time(4i)]"
+ }, class: 'hour', tabindex: tab_counter_arrival + 1) %>
+ <%= select_minute(vjas.arrival_time ? vjas.arrival_time.min : 0,
+ {
+ prefix: 'vehicle_journey_frequency',
+ field_name: "vehicle_journey_at_stops_attributes[#{vehicle_journey_at_stop_counter}][arrival_time(5i)]"
+ }, class: 'minute', tabindex: tab_counter_arrival + 2) %>
+ </td>
+ <td class="departure_time <%= 'missing' unless vjas.departure_time %> <%= 'invalid_position' if vjas.errors[:departure_time].present? %>">
+ <%= select_hour(vjas.departure_time ? vjas.departure_time.hour : 0,
+ {
+ prefix: 'vehicle_journey_frequency',
+ field_name: "vehicle_journey_at_stops_attributes[#{vehicle_journey_at_stop_counter}][departure_time(4i)]"
+ }, class: 'hour', tabindex: tab_counter_departure + 1) %>
+ <%= select_minute(vjas.departure_time ? vjas.departure_time.min : 0,
+ {
+ prefix: 'vehicle_journey_frequency',
+ field_name: "vehicle_journey_at_stops_attributes[#{vehicle_journey_at_stop_counter}][departure_time(5i)]"
+ }, class: 'minute', tabindex: tab_counter_departure + 2) %>
+ </td>
+</tr>
diff --git a/app/views/vehicle_journey_frequencies/_vehicle_journeys_matrix.html.erb b/app/views/vehicle_journey_frequencies/_vehicle_journeys_matrix.html.erb
new file mode 100644
index 000000000..c023f9cfb
--- /dev/null
+++ b/app/views/vehicle_journey_frequencies/_vehicle_journeys_matrix.html.erb
@@ -0,0 +1,22 @@
+<ul class="ce-VehicleJourneyFrequenciesMatrix">
+<% @vehicle_journeys.each do |vj| %>
+ <li>
+ <ul>
+ <% vj.journey_frequencies.each do |jf| %>
+ <% left, width = journey_frequency_percent(jf) %>
+ <li style="left:<%= left %>%;width:<%= width %>%"
+ data-style="primary" data-container="body" rel="popover" data-toggle="popover"
+ data-title='<%= link_to(vehicle_title(vj, jf), [@referential, @line, @route, vj] ) %>
+ <%= link_to('<span class="fa fa-pencil"></span>'.html_safe,
+ send("edit_referential_line_route_vehicle_journey#{'_frequency' if vj.frequency?}_path", @referential, @line, @route, vj),
+ :class => "btn btn-default btn-sm" ) %>'
+ data-placement= "top"
+ data-content='<%= render 'vehicle_journeys/show_popover', { vehicle_journey: vj } %>'>
+ <span class="ce-VehicleJourneyFrequenciesMatrix-firstDepartureTime"><%= l(jf.first_departure_time, format: :hour) %></span>
+ <span class="ce-VehicleJourneyFrequenciesMatrix-lastDepartureTime"><%= l(jf.last_departure_time, format: :hour) %></span>
+ </li>
+ <% end %>
+ </ul>
+ </li>
+<% end %>
+</ul>
diff --git a/app/views/vehicle_journey_frequencies/edit.html.erb b/app/views/vehicle_journey_frequencies/edit.html.erb
new file mode 100644
index 000000000..1bc1e6d88
--- /dev/null
+++ b/app/views/vehicle_journey_frequencies/edit.html.erb
@@ -0,0 +1,7 @@
+<%= title_tag edit_vehicle_title(@vehicle_journey_frequency) %>
+
+<%= render 'vehicle_journeys/form', vehicle_journey: @vehicle_journey_frequency,
+ form_url: referential_line_route_vehicle_journey_frequency_path(@referential,
+ @line,
+ @route,
+ id: @vehicle_journey_frequency) %>
diff --git a/app/views/vehicle_journey_frequencies/edit.js.erb b/app/views/vehicle_journey_frequencies/edit.js.erb
new file mode 100644
index 000000000..f5aaf8ad7
--- /dev/null
+++ b/app/views/vehicle_journey_frequencies/edit.js.erb
@@ -0,0 +1,10 @@
+$(document).ready(function() {
+ $("#vehicle_journey_frequency_journey_pattern_id").change(
+ function(){
+ var url = "<%= select_journey_pattern_referential_line_route_vehicle_journey_path( @referential, @line, @route, @vehicle_journey_frequency)%>?journey_pattern_id="+
+ $("#vehicle_journey_frequency_journey_pattern_input select option:selected").attr("value");
+ url += "&journey_category=frequency";
+ $.get(url);
+ }
+ );
+});
diff --git a/app/views/vehicle_journey_frequencies/new.html.erb b/app/views/vehicle_journey_frequencies/new.html.erb
new file mode 100644
index 000000000..677605276
--- /dev/null
+++ b/app/views/vehicle_journey_frequencies/new.html.erb
@@ -0,0 +1,6 @@
+<%= title_tag t('vehicle_journeys.new.title_frequency') %>
+
+<%= render 'vehicle_journeys/form', vehicle_journey: @vehicle_journey_frequency,
+ form_url: referential_line_route_vehicle_journey_frequencies_path(@referential,
+ @line,
+ @route) %>
diff --git a/app/views/vehicle_journey_frequencies/new.js.erb b/app/views/vehicle_journey_frequencies/new.js.erb
new file mode 100644
index 000000000..b5fc75aef
--- /dev/null
+++ b/app/views/vehicle_journey_frequencies/new.js.erb
@@ -0,0 +1,13 @@
+$(document).ready(function() {
+ $("#vehicle_journey_frequency_journey_pattern_id").change(
+ function(){
+ var vehicle_journey_journey_pattern_id = $("#vehicle_journey_frequency_journey_pattern_input select option:selected").attr("value");
+ if (vehicle_journey_journey_pattern_id > 0) {
+ var url = "<%= referential_line_route_journey_patterns_path(@referential.id,@line.id,@route.id) %>";
+ url = url + "/" + vehicle_journey_journey_pattern_id +
+ "/new_vehicle_journey?journey_category=frequency";
+ $.get(url);
+ }
+ }
+ );
+});
diff --git a/app/views/vehicle_journey_frequencies/select_journey_pattern.js.erb b/app/views/vehicle_journey_frequencies/select_journey_pattern.js.erb
new file mode 100644
index 000000000..8fe20ed37
--- /dev/null
+++ b/app/views/vehicle_journey_frequencies/select_journey_pattern.js.erb
@@ -0,0 +1,5 @@
+$('.journey_pattern_dependent_list').html('<%= escape_javascript(
+ render(partial: 'vehicle_journey_frequencies/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 })).html_safe %>');
diff --git a/app/views/vehicle_journey_frequencies/show.html.erb b/app/views/vehicle_journey_frequencies/show.html.erb
new file mode 100644
index 000000000..7939ae319
--- /dev/null
+++ b/app/views/vehicle_journey_frequencies/show.html.erb
@@ -0,0 +1,3 @@
+<%= render 'vehicle_journeys/show_details', vehicle_journey: @vehicle_journey_frequency %>
+<%= render 'show_journey_frequencies' %>
+<%= render 'show_sidebar' %>
diff --git a/app/views/vehicle_journeys/_form.html.erb b/app/views/vehicle_journeys/_form.html.erb
index e4b1ce432..10d9bfeee 100644
--- a/app/views/vehicle_journeys/_form.html.erb
+++ b/app/views/vehicle_journeys/_form.html.erb
@@ -1,4 +1,4 @@
-<%= semantic_form_for [@referential, @line, @route, @vehicle_journey] do |form| %>
+<%= semantic_form_for vehicle_journey, url: form_url do |form| %>
<%= form.inputs do %>
<%= form.input :journey_pattern, :as => :select, :collection => @route.journey_patterns, :member_label => Proc.new { |jp| journey_name(jp) } %>
<%= form.input :number %>
@@ -6,64 +6,23 @@
<%= form.input :published_journey_identifier %>
<%= form.input :comment %>
<%= form.input :transport_mode_name, :as => :select, :collection => Chouette::Line.transport_modes, :include_blank => true, :member_label => Proc.new { |mode| t("transport_modes.label.#{mode}") } %>
- <%= form.input :mobility_restricted_suitability, :as => :select, :collection => [[@vehicle_journey.human_attribute_name("accessible"), true], [@vehicle_journey.human_attribute_name("not_accessible"), false]], :include_blank => true %>
- <%= form.input :flexible_service, :as => :select, :collection => [[@vehicle_journey.human_attribute_name("on_demand_fs"), true], [@vehicle_journey.human_attribute_name("regular_fs"), false]], :include_blank => true %>
+ <%= form.input :mobility_restricted_suitability, :as => :select, :collection => [[vehicle_journey.human_attribute_name("accessible"), true], [vehicle_journey.human_attribute_name("not_accessible"), false]], :include_blank => true %>
+ <%= form.input :flexible_service, :as => :select, :collection => [[vehicle_journey.human_attribute_name("on_demand_fs"), true], [vehicle_journey.human_attribute_name("regular_fs"), false]], :include_blank => true %>
<%= form.input :status_value %>
<%= form.input :facility %>
<%= form.input :vehicle_type_identifier%>
- <%= form.input :objectid, :required => !@vehicle_journey.new_record?, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.vehicle_journey.objectid")} %>
- <%= form.input :time_table_tokens, :label => t('.time_tables'), :as => :search_time_table, :json => referential_autocomplete_time_tables_path(@referential, :format => :json), :hint_text => t('search_hint'), :no_result_text => t('no_result_text'),:searching_text => t('searching_term'), :input_html => { :"data-pre" => Rabl::Renderer.new( 'autocomplete_time_tables/index', @vehicle_journey.time_tables, :view_path => 'app/views', :format => :json, :scope => :self ).render } %>
+ <%= form.input :objectid, :required => !vehicle_journey.new_record?, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.vehicle_journey.objectid")} %>
+ <%= form.input :time_table_tokens, :label => t('.time_tables'), :as => :search_time_table, :json => referential_autocomplete_time_tables_path(@referential, :format => :json), :hint_text => t('search_hint'), :no_result_text => t('no_result_text'),:searching_text => t('searching_term'), :input_html => { :"data-pre" => Rabl::Renderer.new( 'autocomplete_time_tables/index', vehicle_journey.time_tables, :view_path => 'app/views', :format => :json, :scope => :self ).render } %>
<%= form.input :footnote_ids, :as => :check_boxes, :collection => @line.footnotes.map { |f| [ "#{f.code}: #{f.label}", f.id.to_s]} %>
- <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>
- <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) %>
- <%= select_minute(@vehicle_journey.vehicle_journey_at_stops.first.departure_time.min) %>
- <a class="slide btn btn-default"><%= t(".slide") %></a>
- </div>
- </div>
- <% 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>
+ <%= render 'form_vehicle_journey_at_stops', vehicle_journey: vehicle_journey, form: form %>
<% end %>
<%= form.actions do %>
- <%= form.action :submit, :as => :button %>
- <%= form.action :cancel, :as => :link %>
+ <%= form.action :submit, as: :button, label: t(".submit_#{vehicle_journey.journey_category}") %>
+ <%= form.action :cancel, as: :link %>
<% end %>
<% end %>
-<% if @vehicle_journey.new_record? %>
- <%= javascript_include_tag new_referential_line_route_vehicle_journey_path(@referential, @line, @route, :format => :js) %>
-<% else %>
- <%= javascript_include_tag edit_referential_line_route_vehicle_journey_path(@referential, @line, @route, @vehicle_journey, :format => :js) %>
-<% end %>
-
+<%= render 'form_footer', vehicle_journey: vehicle_journey %>
diff --git a/app/views/vehicle_journeys/_form_footer.html.erb b/app/views/vehicle_journeys/_form_footer.html.erb
new file mode 100644
index 000000000..c4c51b2b3
--- /dev/null
+++ b/app/views/vehicle_journeys/_form_footer.html.erb
@@ -0,0 +1,5 @@
+<% if vehicle_journey.new_record? %>
+ <%= javascript_include_tag new_referential_line_route_vehicle_journey_path(@referential, @line, @route, :format => :js) %>
+<% else %>
+ <%= javascript_include_tag edit_referential_line_route_vehicle_journey_path(@referential, @line, @route, vehicle_journey, :format => :js) %>
+<% end %>
diff --git a/app/views/vehicle_journeys/_form_vehicle_journey_at_stops.html.erb b/app/views/vehicle_journeys/_form_vehicle_journey_at_stops.html.erb
new file mode 100644
index 000000000..7e9bc1b38
--- /dev/null
+++ b/app/views/vehicle_journeys/_form_vehicle_journey_at_stops.html.erb
@@ -0,0 +1,49 @@
+<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('vehicle_journeys.form.slide_title') %></span>
+ <div>
+ <span><%= t('vehicle_journeys.form.set') %></span>
+ <%= select_tag '', options_for_select( [ [t('vehicle_journeys.form.slide_departure'), "departure"], [t('vehicle_journeys.form.slide_arrival'), "arrival"] ] ), :class => "departure_or_arrival" %>
+ <span><%= t('vehicle_journeys.form.to') %></span>
+ <%= select_hour(vehicle_journey.vehicle_journey_at_stops.first.departure_time.hour) %>
+ <%= select_minute(vehicle_journey.vehicle_journey_at_stops.first.departure_time.min) %>
+ <a class="slide btn btn-default"><%= t('vehicle_journeys.form.slide') %></a>
+ </div>
+ </div>
+ </div>
+<% end %>
+
+<table class="table table-hover table-striped">
+ <thead>
+ <tr>
+ <th class="hour title"><%= t('vehicle_journeys.form.arrival') %></th>
+ <th class="stop title"><%= t('vehicle_journeys.form.stop_title') %></th>
+ <th class="hour title"><%= t('vehicle_journeys.form.departure') %></th>
+ </tr>
+ </thead>
+ <tfoot>
+ <tr>
+ <td class="title">
+ <%= button_tag 'data-ce-action' => 'to_departures', class: 'ce-hide btn btn-primary' do %>
+ <%= t('vehicle_journeys.form.to_departures').html_safe %>
+ <i class="fa fa-angle-double-right"></i>
+ <% end %>
+ <td class="title"></td>
+ <td class="title">
+ <%= button_tag 'data-ce-action' => 'to_arrivals', class: 'ce-hide btn btn-primary' do %>
+ <i class="fa fa-angle-double-left"></i>
+ <%= t('vehicle_journeys.form.to_arrivals').html_safe %>
+ <% end %>
+ </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>
diff --git a/app/views/vehicle_journeys/_route_popover.html.erb b/app/views/vehicle_journeys/_route_popover.html.erb
index 1acba5665..27023b625 100644
--- a/app/views/vehicle_journeys/_route_popover.html.erb
+++ b/app/views/vehicle_journeys/_route_popover.html.erb
@@ -1,6 +1,5 @@
<ul>
<% (selected_route.line.routes.limit(10).reject{ |route| route == selected_route}).each do |route| %>
- <li><%= link_to route.name.truncate(30), [@referential, route.line, route, 'vehicle_journeys'] %></li>
+ <li><%= link_to route.name.truncate(30), [@referential, route.line, route, controller_name] %></li>
<% end %>
</ul>
-</p>
diff --git a/app/views/vehicle_journeys/_show_details.html.erb b/app/views/vehicle_journeys/_show_details.html.erb
new file mode 100644
index 000000000..fccf3d210
--- /dev/null
+++ b/app/views/vehicle_journeys/_show_details.html.erb
@@ -0,0 +1,87 @@
+<%= title_tag vehicle_title(vehicle_journey) %>
+
+<div id="modal_translation" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
+ <div class="modal-dialog">
+ <div class="modal-content">
+ <div class="modal-header">
+ <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
+ <h4 class="modal-title" id="myModalLabel"><%= t('vehicle_journeys.show.translation_form') %></h4>
+ <div id="translate_form"></div>
+ </div>
+ </div>
+ </div>
+</div>
+
+<div class="vehicle_journey">
+ <div class="summary">
+ <p>
+ <label><%= vehicle_journey.human_attribute_name(:journey_pattern) %>: </label>
+ <%= link_to journey_name(vehicle_journey.journey_pattern), [@referential, @line, @route, vehicle_journey.journey_pattern] %>
+ </p>
+ <p>
+ <label><%= vehicle_journey.human_attribute_name("number") %>: </label>
+ <%= vehicle_journey.number %>
+ </p>
+ <p>
+ <label><%= vehicle_journey.human_attribute_name("published_journey_name") %>: </label>
+ <%= vehicle_journey.published_journey_name %>
+ </p>
+ <p>
+ <label><%= vehicle_journey.human_attribute_name("published_journey_identifier") %>: </label>
+ <%= vehicle_journey.published_journey_identifier %>
+ </p>
+
+ <p>
+ <label><%= vehicle_journey.human_attribute_name("mobility_restricted_suitability") %>: </label>
+ <% if vehicle_journey.mobility_restricted_suitability.nil? %>
+ <%= vehicle_journey.human_attribute_name("unspecified_mrs") %>
+ <% elsif vehicle_journey.mobility_restricted_suitability? %>
+ <%= vehicle_journey.human_attribute_name("accessible") %>
+ <% else %>
+ <%= vehicle_journey.human_attribute_name("not_accessible") %>
+ <% end %>
+ </p>
+ <p>
+ <label><%= vehicle_journey.human_attribute_name("flexible_service") %>: </label>
+ <% if vehicle_journey.flexible_service.nil? %>
+ <%= vehicle_journey.human_attribute_name("unspecified_fs") %>
+ <% elsif vehicle_journey.flexible_service? %>
+ <%= vehicle_journey.human_attribute_name("on_demand_fs") %>
+ <% else %>
+ <%= vehicle_journey.human_attribute_name("regular_fs") %>
+ <% end %>
+ </p>
+
+ <p>
+ <label><%= vehicle_journey.human_attribute_name("comment") %>: </label>
+ <%= vehicle_journey.comment %>
+ </p>
+ <p>
+ <label><%= vehicle_journey.human_attribute_name("status_value") %>: </label>
+ <%= vehicle_journey.status_value %>
+ </p>
+ <p>
+ <label><%= vehicle_journey.human_attribute_name("facility") %>: </label>
+ <%= vehicle_journey.facility %>
+ </p>
+ <p>
+ <label><%= vehicle_journey.human_attribute_name("vehicle_type_identifier") %>: </label>
+ <%= vehicle_journey.vehicle_type_identifier %>
+ </p>
+ <p>
+ <label><%= vehicle_journey.human_attribute_name("footnote_ids") %>: </label>
+ <ul>
+ <% vehicle_journey.footnotes.each do |footnote| %>
+ <li><%= footnote.code %> : <%= footnote.label %></li>
+ <% end %>
+ </ul>
+ </p>
+ </div>
+</div>
+<h3><%= vehicle_journey.human_attribute_name(:vehicle_journey_at_stop_ids) %></h3>
+<%= render 'show_vehicle_journey_at_stops' %>
+
+<h3><%= t('vehicle_journeys.show.time_tables') %></h3>
+<div class="time_tables paginated_content">
+ <%= paginated_content vehicle_journey.time_tables, "time_tables/time_table", :delete => false %>
+</div>
diff --git a/app/views/vehicle_journeys/_show_sidebar.html.erb b/app/views/vehicle_journeys/_show_sidebar.html.erb
new file mode 100644
index 000000000..5ab7d449a
--- /dev/null
+++ b/app/views/vehicle_journeys/_show_sidebar.html.erb
@@ -0,0 +1,15 @@
+<% 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 => "add" %></li>
+ <li><%= link_to t('vehicle_journeys.actions.new_frequency'), new_referential_line_route_vehicle_journey_frequency_path(@referential, @line, @route), :class => "add" %></li>
+ <li><%= link_to t('vehicle_journeys.actions.edit'), edit_referential_line_route_vehicle_journey_path(@referential, @line, @route, @vehicle_journey), :class => "edit" %></li>
+ <li><%= link_to t('vehicle_journeys.actions.destroy'), referential_line_route_vehicle_journey_path(@referential, @line, @route, @vehicle_journey), :method => :delete, :data => {:confirm => t('vehicle_journeys.actions.destroy_confirm')}, :class => "remove" %></li>
+ <% unless @vehicle_journey.vehicle_journey_at_stops.empty? %>
+ <li>
+ <i class="fa fa-cubes fa-fw" style="color:#D98F3B;"></i>
+ <%= link_to t('vehicle_journeys.show.translation_form'), new_referential_line_route_vehicle_journey_vehicle_translation_path(@referential, @line, @route, @vehicle_journey), {:remote => true, 'data-toggle' => "modal", 'data-target' => '#modal_translation', :class => "with_fa" } %>
+ </li>
+ <% end %>
+ </ul>
+ <%= creation_tag(@vehicle_journey) %>
+<% end %>
diff --git a/app/views/vehicle_journeys/_show_vehicle_journey_at_stops.html.erb b/app/views/vehicle_journeys/_show_vehicle_journey_at_stops.html.erb
new file mode 100644
index 000000000..cb4a95263
--- /dev/null
+++ b/app/views/vehicle_journeys/_show_vehicle_journey_at_stops.html.erb
@@ -0,0 +1,20 @@
+<div class="vehicle_journey_at_stops content">
+ <table class="table table-hover table-striped">
+ <thead>
+ <tr>
+ <th class="hour title"><%= t('vehicle_journeys.show.arrival') %></th>
+ <th class="stop title" ><%= t('vehicle_journeys.show.stop_title') %></th>
+ <th class="hour title"><%= t('vehicle_journeys.show.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.nil? ? "missing" : "" %>"><%= 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.nil? ? "missing" : "" %>"><%= vjas.departure_time ? l( vjas.departure_time, :format => :hour) : "" %></td>
+ </tr>
+ <% end %>
+ </tbody>
+ </table>
+</div>
diff --git a/app/views/vehicle_journeys/_sidebar.html.erb b/app/views/vehicle_journeys/_sidebar.html.erb
index 8d6f310d3..11260cd7b 100644
--- a/app/views/vehicle_journeys/_sidebar.html.erb
+++ b/app/views/vehicle_journeys/_sidebar.html.erb
@@ -1,6 +1,7 @@
- <ul class="actions">
- <li><%= link_to t('vehicle_journeys.actions.new'), new_referential_line_route_vehicle_journey_path(@referential, @line, @route), :class => "add" %></li>
- <li><%= link_to t('vehicle_journey_imports.new.title'), new_referential_line_route_vehicle_journey_import_path( @referential, @line, @route ), :class => "import" %></li>
- <li><%= link_to t('vehicle_journey_exports.new.title'), referential_line_route_vehicle_journey_exports_path(@referential, @line, @route, :format => :zip), :class => "export" %></li>
- </ul>
+<ul class="actions">
+ <li><%= link_to t('vehicle_journeys.actions.new'), new_referential_line_route_vehicle_journey_path(@referential, @line, @route), :class => "add" %></li>
+ <li><%= link_to t('vehicle_journeys.actions.new_frequency'), new_referential_line_route_vehicle_journey_frequency_path(@referential, @line, @route), :class => "add" %></li>
+ <li><%= link_to t('vehicle_journey_imports.new.title'), new_referential_line_route_vehicle_journey_import_path( @referential, @line, @route ), :class => "import" %></li>
+ <li><%= link_to t('vehicle_journey_exports.new.title'), referential_line_route_vehicle_journey_exports_path(@referential, @line, @route, :format => :zip), :class => "export" %></li>
+</ul>
diff --git a/app/views/vehicle_journeys/_vehicle_journeys.html.erb b/app/views/vehicle_journeys/_vehicle_journeys.html.erb
index ecdb12c6e..3bff10b59 100644
--- a/app/views/vehicle_journeys/_vehicle_journeys.html.erb
+++ b/app/views/vehicle_journeys/_vehicle_journeys.html.erb
@@ -1,39 +1,21 @@
<div class="page_info">
- <span class="search"> <%= t("will_paginate.page_entries_info.search") %></span> <%= page_entries_info @vehicle_journeys %>
+ <span class="search"><%= t("will_paginate.page_entries_info.search") %></span>
+ <%= page_entries_info @vehicle_journeys %>
+ <span class="pull-right">
+ <i class="fa fa-clock-o"></i>
+ <% if controller_name == 'vehicle_journey_frequencies' %>
+ <%= link_to t("vehicle_journeys.actions.show"), referential_line_route_vehicle_journeys_path(@referential, @line, @route) %>
+ <% else %>
+ <%= link_to t("vehicle_journey_frequencies.actions.show"), referential_line_route_vehicle_journey_frequencies_path(@referential, @line, @route) %>
+ <% end %>
+ </span>
</div>
<div class="pagination">
<%= will_paginate @vehicle_journeys, :container => false, renderer: RemoteBootstrapPaginationLinkRenderer %>
</div>
<div class="vehicle_journeys paginated_content">
- <table class="table table-hover table-striped">
- <thead>
- <tr>
- <th class="title">
- <button data-style="primary" data-container="body" rel="popover" data-toggle="popover" title='<%= t(".line_routes") %>' data-placement="top" data-content='<%= render( partial: "route_popover", :locals => { :selected_route => @route }) %>' class="route_popover btn btn-default btn-sm"><i class='fa fa-search'></i><%= Chouette::Route.model_name.human.capitalize %></button>
- </th>
- <% @vehicle_journeys.each do |vj| %>
- <th class="vehicle_journey">
- <button data-style="primary" data-container="body" rel="popover" data-toggle="popover" data-title='<%= link_to(vehicle_title(vj), [@referential, @line, @route, vj] ) %> <%= link_to('<span class="fa fa-pencil"></span>'.html_safe, ["edit", @referential, @line, @route, vj], :class => "btn btn-default btn-sm" ) %>' data-placement= "top" data-content='<%= render( partial: "show_popover", :locals => { :vehicle_journey => vj }) %>' class="vehicle_journey_popover btn btn-default btn-sm"><i class='fa fa-search'></i></button>
- </th>
- <% end %>
- </tr>
- </thead>
- <tbody>
- <% @route.stop_points.each_with_index do |sp, index| %>
- <tr class="<%= cycle('odd', 'even') %>">
- <td class="stop_area"><%= sp.stop_area.name %></td>
- <% @vehicle_journeys.each do |vj| %>
- <td class="hours <%= missing_time_check(@matrix["#{vj.id}-#{sp.id}"]) %>">
- <%= (@matrix["#{vj.id}-#{sp.id}"] && @matrix["#{vj.id}-#{sp.id}"].departure_time) ? l( @matrix["#{vj.id}-#{sp.id}"].departure_time, :format => :hour) : "--" %>
- </td>
- <% end %>
- </tr>
- <% end %>
- </tbody>
- </table>
+ <%= render 'vehicle_journeys_matrix' %>
</div>
<div class="pagination">
<%= will_paginate @vehicle_journeys, :container => false, renderer: RemoteBootstrapPaginationLinkRenderer %>
</div>
-
-
diff --git a/app/views/vehicle_journeys/_vehicle_journeys_matrix.html.erb b/app/views/vehicle_journeys/_vehicle_journeys_matrix.html.erb
new file mode 100644
index 000000000..3254430cd
--- /dev/null
+++ b/app/views/vehicle_journeys/_vehicle_journeys_matrix.html.erb
@@ -0,0 +1,40 @@
+<table class="table table-hover table-striped">
+ <thead>
+ <tr>
+ <th class="title">
+ <button data-style="primary" data-container="body" rel="popover" data-toggle="popover" title='<%= t(".line_routes") %>'
+ data-placement="top" data-content='<%= render( partial: "route_popover", :locals => { :selected_route => @route }) %>'
+ class="route_popover btn btn-default btn-sm">
+ <i class='fa fa-search'></i>
+ <%= Chouette::Route.model_name.human.capitalize %>
+ </button>
+ </th>
+ <% @vehicle_journeys.each do |vj| %>
+ <th class="vehicle_journey">
+ <button data-style="primary" data-container="body" rel="popover" data-toggle="popover"
+ data-title='<%= link_to(vehicle_title(vj), [@referential, @line, @route, vj] ) %>
+ <%= link_to('<span class="fa fa-pencil"></span>'.html_safe,
+ send("edit_referential_line_route_vehicle_journey#{'_frequency' if vj.frequency?}_path", @referential, @line, @route, vj),
+ :class => "btn btn-default btn-sm" ) %>'
+ data-placement= "top"
+ data-content='<%= render( partial: "show_popover", :locals => { :vehicle_journey => vj }) %>'
+ class="vehicle_journey_popover btn btn-default btn-sm">
+ <i class='fa fa-search'></i>
+ </button>
+ </th>
+ <% end %>
+ </tr>
+ </thead>
+ <tbody>
+ <% @route.stop_points.each_with_index do |sp, index| %>
+ <tr class="<%= cycle('odd', 'even') %>">
+ <td class="stop_area"><%= sp.stop_area.name %></td>
+ <% @vehicle_journeys.each do |vj| %>
+ <td class="hours <%= missing_time_check(@matrix["#{vj.id}-#{sp.id}"]) %><%= ' ce-VehicleJourneyBlock-frequency' if vj.frequency? %>">
+ <%= (@matrix["#{vj.id}-#{sp.id}"] && @matrix["#{vj.id}-#{sp.id}"].departure_time) ? l( @matrix["#{vj.id}-#{sp.id}"].departure_time, :format => :hour) : "--" %>
+ </td>
+ <% end %>
+ </tr>
+ <% end %>
+ </tbody>
+</table>
diff --git a/app/views/vehicle_journeys/edit.html.erb b/app/views/vehicle_journeys/edit.html.erb
index 51653a34a..0d3a2db96 100644
--- a/app/views/vehicle_journeys/edit.html.erb
+++ b/app/views/vehicle_journeys/edit.html.erb
@@ -1,4 +1,5 @@
<%= title_tag edit_vehicle_title(@vehicle_journey) %>
-<%= render "form" %>
+<%= render 'form', vehicle_journey: @vehicle_journey, form_url: referential_line_route_vehicle_journey_path(@referential, @line, @route, @vehicle_journey) %>
+
diff --git a/app/views/vehicle_journeys/index.html.erb b/app/views/vehicle_journeys/index.html.erb
index 13126b2e1..3fd123c79 100644
--- a/app/views/vehicle_journeys/index.html.erb
+++ b/app/views/vehicle_journeys/index.html.erb
@@ -14,30 +14,31 @@
<div id="advanced_search" class="panel-collapse collapse">
<div class="panel-body">
<div>
- <%= f.label :time_tables_id_not_eq, "Sans calendrier" %>
- <%= f.check_box :time_tables_id_not_eq %>
+ <%= f.label :time_tables_id_not_eq, "Sans calendrier" %>
+ <%= f.check_box :time_tables_id_not_eq %>
- <span class="time_tables_id_eq">
- <%= f.label :time_tables_id_eq, "Sélectionner calendriers" %>
- <%= f.text_field :time_tables_id_eq, :input_html => { :"data-pre" => [].to_json} %>
- </span>
+ <span class="time_tables_id_eq">
+ <%= f.label :time_tables_id_eq, "Sélectionner calendriers" %>
+ <%= f.text_field :time_tables_id_eq, :input_html => { :"data-pre" => [].to_json} %>
+ </span>
</div>
+ <% if controller_name != 'vehicle_journey_frequencies' %>
+ <div>
+ <%= f.label :vehicle_journey_at_stops_departure_time_not_eq, "Sans horaire" %>
+ <%= f.check_box :vehicle_journey_at_stops_departure_time_not_eq %>
- <div>
- <%= f.label :vehicle_journey_at_stops_departure_time_not_eq, "Sans horaire" %>
- <%= f.check_box :vehicle_journey_at_stops_departure_time_not_eq %>
-
- <span class="vehicle_journey_at_stops_departure_time_gt">
- <input name=<%= "q[vehicle_journey_at_stops_departure_time_gt(3i)]" %> type="hidden" value="1">
- <input name=<%= "q[vehicle_journey_at_stops_departure_time_gt(2i)]" %> type="hidden" value="1">
- <input name=<%= "q[vehicle_journey_at_stops_departure_time_gt(1i)]" %> type="hidden" value="2000">
- <%= f.label :vehicle_journey_at_stops_departure_time_gt, t('.time_range') %>
- <%= select_hour(@q.send( "vehicle_journey_at_stops_departure_time_gt") ? @q.send( "vehicle_journey_at_stops_departure_time_gt").hour : 0,
- :prefix => "q", :field_name => "vehicle_journey_at_stops_departure_time_gt(4i)") %>
- <%= select_minute(@q.send( "vehicle_journey_at_stops_departure_time_gt") ? @q.send( "vehicle_journey_at_stops_departure_time_gt").min : 0,
- :prefix => "q", :field_name => "vehicle_journey_at_stops_departure_time_gt(5i)") %>
- </span>
- </div>
+ <span class="vehicle_journey_at_stops_departure_time_gt">
+ <input name=<%= "q[vehicle_journey_at_stops_departure_time_gt(3i)]" %> type="hidden" value="1">
+ <input name=<%= "q[vehicle_journey_at_stops_departure_time_gt(2i)]" %> type="hidden" value="1">
+ <input name=<%= "q[vehicle_journey_at_stops_departure_time_gt(1i)]" %> type="hidden" value="2000">
+ <%= f.label :vehicle_journey_at_stops_departure_time_gt, t('.time_range') %>
+ <%= select_hour(@q.send( "vehicle_journey_at_stops_departure_time_gt") ? @q.send( "vehicle_journey_at_stops_departure_time_gt").hour : 0,
+ :prefix => "q", :field_name => "vehicle_journey_at_stops_departure_time_gt(4i)") %>
+ <%= select_minute(@q.send( "vehicle_journey_at_stops_departure_time_gt") ? @q.send( "vehicle_journey_at_stops_departure_time_gt").min : 0,
+ :prefix => "q", :field_name => "vehicle_journey_at_stops_departure_time_gt(5i)") %>
+ </span>
+ </div>
+ <% end %>
</div>
</div>
</div>
diff --git a/app/views/vehicle_journeys/new.html.erb b/app/views/vehicle_journeys/new.html.erb
index a32e9cc31..d2e9d7c4c 100644
--- a/app/views/vehicle_journeys/new.html.erb
+++ b/app/views/vehicle_journeys/new.html.erb
@@ -1,4 +1,4 @@
<%= title_tag t('vehicle_journeys.new.title') %>
-<%= render "form" %>
+<%= render 'form', { vehicle_journey: @vehicle_journey, form_url: referential_line_route_vehicle_journeys_path(@referential, @line, @route, @vehicle_journey) } %>
diff --git a/app/views/vehicle_journeys/new.js.erb b/app/views/vehicle_journeys/new.js.erb
index 65e5dfccb..160e7a34b 100644
--- a/app/views/vehicle_journeys/new.js.erb
+++ b/app/views/vehicle_journeys/new.js.erb
@@ -1,10 +1,13 @@
$(document).ready(function() {
$("#vehicle_journey_journey_pattern_id").change(
function(){
- var url = "<%= referential_line_route_journey_patterns_path(@referential.id,@line.id,@route.id) %>";
- url = url + "/" + $("#vehicle_journey_journey_pattern_input select option:selected").attr("value") +
- "/new_vehicle_journey";
- $.get(url);
+ var vehicle_journey_journey_pattern_id = $("#vehicle_journey_journey_pattern_input select option:selected").attr("value");
+ if (vehicle_journey_journey_pattern_id > 0) {
+ var url = "<%= referential_line_route_journey_patterns_path(@referential.id,@line.id,@route.id) %>";
+ url = url + "/" + vehicle_journey_journey_pattern_id +
+ "/new_vehicle_journey";
+ $.get(url);
+ }
}
)
});
diff --git a/app/views/vehicle_journeys/show.html.erb b/app/views/vehicle_journeys/show.html.erb
index 695b5c8b5..4bf814bbe 100644
--- a/app/views/vehicle_journeys/show.html.erb
+++ b/app/views/vehicle_journeys/show.html.erb
@@ -1,119 +1,2 @@
-<%= title_tag vehicle_title(@vehicle_journey) %>
-
-<div id="modal_translation" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
- <div class="modal-dialog">
- <div class="modal-content">
- <div class="modal-header">
- <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
- <h4 class="modal-title" id="myModalLabel"><%= t('.translation_form') %></h4>
- <div id="translate_form"></div>
- </div>
- </div>
- </div>
-</div>
-
-<div class="vehicle_journey">
- <div class="summary">
- <p>
- <label><%= @vehicle_journey.human_attribute_name(:journey_pattern) %>: </label>
- <%= link_to journey_name(@vehicle_journey.journey_pattern), [@referential, @line, @route, @vehicle_journey.journey_pattern] %>
- </p>
- <p>
- <label><%= @vehicle_journey.human_attribute_name("number") %>: </label>
- <%= @vehicle_journey.number %>
- </p>
- <p>
- <label><%= @vehicle_journey.human_attribute_name("published_journey_name") %>: </label>
- <%= @vehicle_journey.published_journey_name %>
- </p>
- <p>
- <label><%= @vehicle_journey.human_attribute_name("published_journey_identifier") %>: </label>
- <%= @vehicle_journey.published_journey_identifier %>
- </p>
-
- <p>
- <label><%= @vehicle_journey.human_attribute_name("mobility_restricted_suitability") %>: </label>
- <% if @vehicle_journey.mobility_restricted_suitability.nil? %>
- <%= @vehicle_journey.human_attribute_name("unspecified_mrs") %>
- <% elsif @vehicle_journey.mobility_restricted_suitability? %>
- <%= @vehicle_journey.human_attribute_name("accessible") %>
- <% else %>
- <%= @vehicle_journey.human_attribute_name("not_accessible") %>
- <% end %>
- </p>
- <p>
- <label><%= @vehicle_journey.human_attribute_name("flexible_service") %>: </label>
- <% if @vehicle_journey.flexible_service.nil? %>
- <%= @vehicle_journey.human_attribute_name("unspecified_fs") %>
- <% elsif @vehicle_journey.flexible_service? %>
- <%= @vehicle_journey.human_attribute_name("on_demand_fs") %>
- <% else %>
- <%= @vehicle_journey.human_attribute_name("regular_fs") %>
- <% end %>
- </p>
-
- <p>
- <label><%= @vehicle_journey.human_attribute_name("comment") %>: </label>
- <%= @vehicle_journey.comment %>
- </p>
- <p>
- <label><%= @vehicle_journey.human_attribute_name("status_value") %>: </label>
- <%= @vehicle_journey.status_value %>
- </p>
- <p>
- <label><%= @vehicle_journey.human_attribute_name("facility") %>: </label>
- <%= @vehicle_journey.facility %>
- </p>
- <p>
- <label><%= @vehicle_journey.human_attribute_name("vehicle_type_identifier") %>: </label>
- <%= @vehicle_journey.vehicle_type_identifier %>
- </p>
- <p>
- <label><%= @vehicle_journey.human_attribute_name("footnote_ids") %>: </label>
- <ul>
- <% @vehicle_journey.footnotes.each do |footnote| %>
- <li><%= footnote.code %> : <%= footnote.label %></li>
- <% end %>
- </ul>
- </p>
- </div>
-</div>
-<h3><%= @vehicle_journey.human_attribute_name(:vehicle_journey_at_stop_ids) %></h3>
-<div class="vehicle_journey_at_stops content">
- <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>
- <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.nil? ? "missing" : "" %>"><%= 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.nil? ? "missing" : "" %>"><%= vjas.departure_time ? l( vjas.departure_time, :format => :hour) : "" %></td>
- </tr>
- <% end %>
- </tbody>
- </table>
-</div>
-
-<h3><%= t('.time_tables') %></h3>
-<div class="time_tables paginated_content">
- <%= paginated_content @vehicle_journey.time_tables, "time_tables/time_table", :delete => false %>
-</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 => "add" %></li>
- <li><%= link_to t('vehicle_journeys.actions.edit'), edit_referential_line_route_vehicle_journey_path(@referential, @line, @route, @vehicle_journey), :class => "edit" %></li>
- <li><%= link_to t('vehicle_journeys.actions.destroy'), referential_line_route_vehicle_journey_path(@referential, @line, @route, @vehicle_journey), :method => :delete, :data => {:confirm => t('vehicle_journeys.actions.destroy_confirm')}, :class => "remove" %></li>
- <% unless @vehicle_journey.vehicle_journey_at_stops.empty? %>
- <li><font color="#D98F3B"><i class="fa fa-cubes fa-fw"></i></font><%= link_to t('.translation_form'), new_referential_line_route_vehicle_journey_vehicle_translation_path(@referential, @line, @route, @vehicle_journey), {:remote => true, 'data-toggle' => "modal", 'data-target' => '#modal_translation', :class => "with_fa" } %></li>
- <% end %>
- </ul>
- <%= creation_tag(@vehicle_journey) %>
-<% end %>
+<%= render 'show_details', vehicle_journey: @vehicle_journey %>
+<%= render 'show_sidebar' %>