aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/assets/stylesheets/journey_patterns.css.scss91
-rw-r--r--app/controllers/journey_pattern_stop_points_controller.rb18
-rw-r--r--app/controllers/journey_patterns_controller.rb19
-rw-r--r--app/controllers/vehicle_journeys_controller.rb27
-rw-r--r--app/helpers/journey_patterns_helper.rb12
-rw-r--r--app/helpers/routes_helper.rb4
-rw-r--r--app/views/companies/_form.erb2
-rw-r--r--app/views/companies/show.html.erb2
-rw-r--r--app/views/journey_patterns/_form.html.erb24
-rw-r--r--app/views/journey_patterns/_journey_pattern.html.erb14
-rw-r--r--app/views/journey_patterns/edit.html.erb4
-rw-r--r--app/views/journey_patterns/new.html.erb4
-rw-r--r--app/views/journey_patterns/show.html.erb62
-rw-r--r--app/views/journey_patterns/show.kml.erb21
-rw-r--r--app/views/lines/_form.erb2
-rw-r--r--app/views/lines/show.html.erb4
-rw-r--r--app/views/networks/_form.erb2
-rw-r--r--app/views/networks/show.html.erb4
-rw-r--r--app/views/routes/show.html.erb8
-rw-r--r--app/views/stop_areas/_form.html.erb2
-rw-r--r--app/views/stop_areas/index.html.erb6
-rw-r--r--app/views/stop_areas/show.html.erb16
-rw-r--r--app/views/time_tables/show.html.erb2
-rw-r--r--app/views/vehicle_journeys/_form.html.erb29
-rw-r--r--app/views/vehicle_journeys/_vehicle_journey_at_stop_fields.html.erb11
-rw-r--r--app/views/vehicle_journeys/edit.html.erb21
-rw-r--r--app/views/vehicle_journeys/index.html.erb44
-rw-r--r--app/views/vehicle_journeys/new.html.erb17
-rw-r--r--app/views/vehicle_journeys/show.html.erb60
-rw-r--r--config/initializers/active_record.rb2
-rw-r--r--config/initializers/formtastic.rb22
-rw-r--r--config/initializers/postgresql_adapter_patch.rb1
-rw-r--r--config/locales/companies.yml8
-rw-r--r--config/locales/journey_patterns.yml77
-rw-r--r--config/locales/lines.yml8
-rw-r--r--config/locales/networks.yml8
-rw-r--r--config/locales/routes.yml2
-rw-r--r--config/locales/stop_areas.yml20
-rw-r--r--config/locales/vehicle_journeys.yml80
-rw-r--r--config/routes.rb2
-rw-r--r--db/migrate/20120213131553_create_chouette_line.rb28
-rw-r--r--db/migrate/20120214101458_create_chouette_company.rb22
-rw-r--r--db/migrate/20120214101645_create_chouette_ptnetwork.rb23
-rw-r--r--db/migrate/20120416095045_create_chouette_stop_area.rb35
-rw-r--r--db/migrate/20120416095046_create_time_table.rb34
-rw-r--r--db/migrate/20120425080337_create_chouette_route.rb17
-rw-r--r--db/migrate/20120425125542_create_chouette_stop_point.rb15
-rw-r--r--db/migrate/20120426141032_create_chouette_connection_link.rb34
-rw-r--r--db/migrate/20120525092203_create_chouette_journey_pattern.rb26
-rw-r--r--db/migrate/20120525092204_create_chouette_journey_pattern_stop_point.rb14
-rw-r--r--db/migrate/20120525092205_create_chouette_time_slot.rb22
-rw-r--r--db/migrate/20120525092206_create_chouette_vehicle_journey.rb34
-rw-r--r--db/migrate/20120525092207_create_chouette_vehicle_journey_at_stop.rb25
-rw-r--r--db/migrate/20120525092208_create_chouette_time_table_vehicle_journey.rb16
-rw-r--r--db/migrate/20120525092209_create_chouette_access_point.rb34
-rw-r--r--db/migrate/20120525092210_create_chouette_access_link.rb33
-rw-r--r--db/migrate/20120525092211_create_chouette_facility.rb34
-rw-r--r--db/migrate/20120525092212_create_chouette_facility_feature.rb12
-rw-r--r--db/migrate/20120525092213_create_chouette_group_of_line.rb18
-rw-r--r--db/migrate/20120525092214_create_chouette_group_of_line_line.rb12
-rw-r--r--db/migrate/20120525092215_create_chouette_routing_constrains_line.rb12
-rw-r--r--db/migrate/20120525092216_create_chouette_stoparea_stoparea.rb12
-rw-r--r--db/migrate/20120531091529_create_chouette_pt_link.rb21
-rw-r--r--spec/requests/journey_pattern_spec.rb56
-rw-r--r--spec/views/vehicle_journeys/_form.html.erb_spec.rb61
65 files changed, 1263 insertions, 149 deletions
diff --git a/app/assets/stylesheets/journey_patterns.css.scss b/app/assets/stylesheets/journey_patterns.css.scss
new file mode 100644
index 000000000..afba352bd
--- /dev/null
+++ b/app/assets/stylesheets/journey_patterns.css.scss
@@ -0,0 +1,91 @@
+// Place all the styles related to the routes controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
+@import "common";
+
+#workspace.routes.show
+{
+ .jouerney_pattern:after {
+ @include after_div_for_object;
+ }
+
+ .journey_patterns {
+ margin-top: 20px;
+ }
+
+ .journey_patterns:after {
+ @include content_to_clear;
+ }
+
+ .journey_pattern {
+ @include div_for_object;
+
+ /* to create multi-column index */
+ width: 350px;
+ padding-right: 10px;
+
+ .name {
+ line-height: 16px;
+ float: left;
+ }
+
+ }
+}
+
+#workspace.journey_patterns.edit, #workspace.journey_patterns.new
+{
+ #route_color{ width: 100px;
+ color: white;
+ font-weight: bold;}
+}
+
+#workspace.journey_patterns.show
+{
+ .journey_pattern_color{ color: white;
+ font-weight: bold;
+ padding: 0 5px 0 5px;}
+
+ .summary p label {
+ font-weight: bold;
+ }
+
+ .stop_point:after {
+ @include after_div_for_object;
+ }
+
+ .stop_points {
+ margin-top: 20px;
+ }
+
+ .stop_points:after {
+ @include content_to_clear;
+ }
+
+ .journey_pattern_stop_points {
+ clear: both;
+ margin: 0px;
+ padding: 0px;
+ }
+
+ .stop_point {
+ @include div_for_object;
+ /* to create multi-column index */
+ width: 350px;
+ float: left;
+ padding-right: 10px;
+
+ .position {
+ width: 25px;
+ height: 20px;
+ float: left;
+ background-color: #61970B;
+ font-weight: bold;
+ color: white;
+ margin-right: 10px;
+ padding-left: 4px;
+ }
+ }
+
+}
+
+
diff --git a/app/controllers/journey_pattern_stop_points_controller.rb b/app/controllers/journey_pattern_stop_points_controller.rb
new file mode 100644
index 000000000..c4fc9b08f
--- /dev/null
+++ b/app/controllers/journey_pattern_stop_points_controller.rb
@@ -0,0 +1,18 @@
+class JourneyPatternStopPointsController < ChouetteController
+ defaults :resource_class => Chouette::JourneyPattern
+
+ respond_to :html
+
+ belongs_to :referential do
+ belongs_to :line, :parent_class => Chouette::Line do
+ belongs_to :route, :parent_class => Chouette::Route do
+ belongs_to :journey_pattern, :parent_class => Chouette::JourneyPattern
+ end
+ end
+ end
+
+ def stops_selection
+ redirect_to referential_line_route_journey_pattern_path( @referential, @line, @route, @journey_pattern)
+ end
+end
+
diff --git a/app/controllers/journey_patterns_controller.rb b/app/controllers/journey_patterns_controller.rb
new file mode 100644
index 000000000..1ec15f7e8
--- /dev/null
+++ b/app/controllers/journey_patterns_controller.rb
@@ -0,0 +1,19 @@
+class JourneyPatternsController < ChouetteController
+ defaults :resource_class => Chouette::JourneyPattern
+
+ respond_to :html
+
+ belongs_to :referential do
+ belongs_to :line, :parent_class => Chouette::Line do
+ belongs_to :route, :parent_class => Chouette::Route
+ end
+ end
+
+ alias_method :route, :parent
+
+ def show
+ #@map = RouteMap.new referential, route
+ @stop_points = resource.stop_points.paginate(:page => params[:page], :per_page => 10)
+ show!
+ end
+end
diff --git a/app/controllers/vehicle_journeys_controller.rb b/app/controllers/vehicle_journeys_controller.rb
new file mode 100644
index 000000000..3a99d531b
--- /dev/null
+++ b/app/controllers/vehicle_journeys_controller.rb
@@ -0,0 +1,27 @@
+class VehicleJourneysController < ChouetteController
+ defaults :resource_class => Chouette::VehicleJourney
+
+ belongs_to :referential do
+ belongs_to :line, :parent_class => Chouette::Line do
+ belongs_to :route, :parent_class => Chouette::Route
+ end
+ end
+
+ protected
+
+ def collection
+ @q = parent.vehicle_journeys.search(params[:q])
+ @vehicle_journeys ||= @q.result(:distinct => true).paginate(:page => params[:page], :per_page => 10)
+ @matrix ||= matrix
+ end
+
+ def matrix
+ {}.tap do |hash|
+ @vehicle_journeys.each do |vj|
+ vj.vehicle_journey_at_stops.each do |vjas|
+ hash[ "#{vj.id}-#{vjas.stop_point_id}"] = vjas
+ end
+ end
+ end
+ end
+end
diff --git a/app/helpers/journey_patterns_helper.rb b/app/helpers/journey_patterns_helper.rb
new file mode 100644
index 000000000..d7b66db06
--- /dev/null
+++ b/app/helpers/journey_patterns_helper.rb
@@ -0,0 +1,12 @@
+module JourneyPatternsHelper
+ def journey_name( journey_pattern)
+ if journey_pattern.name.blank?
+ t('journey_patterns.journey_pattern.from_to',
+ :departure => journey_pattern.stop_points.first.stop_area.name,
+ :arrival => journey_pattern.stop_points.last.stop_area.name)
+ else
+ truncate(journey_pattern.name, :length => 30)
+ end
+ end
+end
+
diff --git a/app/helpers/routes_helper.rb b/app/helpers/routes_helper.rb
index 72915fd2f..ab91800ae 100644
--- a/app/helpers/routes_helper.rb
+++ b/app/helpers/routes_helper.rb
@@ -1,7 +1,7 @@
module RoutesHelper
def line_formatted_name( line)
- return line.publishedname if line.number.blank?
- "#{line.publishedname} [#{line.number}]"
+ return line.published_name if line.number.blank?
+ "#{line.published_name} [#{line.number}]"
end
end
diff --git a/app/views/companies/_form.erb b/app/views/companies/_form.erb
index 63cb2661b..bea95b0b4 100644
--- a/app/views/companies/_form.erb
+++ b/app/views/companies/_form.erb
@@ -8,7 +8,7 @@
<%= form.input :phone, :as => :phone %>
<%= form.input :fax, :as => :phone %>
<%= form.input :email, :as => :email %>
- <%= form.input :registrationnumber %>
+ <%= form.input :registration_number %>
<% if @company.new_record? %>
<%= form.input :objectid %>
<% else %>
diff --git a/app/views/companies/show.html.erb b/app/views/companies/show.html.erb
index b5c64b691..bf4a0bdc3 100644
--- a/app/views/companies/show.html.erb
+++ b/app/views/companies/show.html.erb
@@ -36,7 +36,7 @@
<%= @company.email %>
</p>
<p>
- <label><%= Chouette::Company.human_attribute_name("registrationnumber") %>: </label>
+ <label><%= Chouette::Company.human_attribute_name("registration_number") %>: </label>
<%= @company.registration_number %>
</p>
<p>
diff --git a/app/views/journey_patterns/_form.html.erb b/app/views/journey_patterns/_form.html.erb
new file mode 100644
index 000000000..ef2bcc9d2
--- /dev/null
+++ b/app/views/journey_patterns/_form.html.erb
@@ -0,0 +1,24 @@
+<%= semantic_form_for [@referential, @line, @route, @journey_pattern] do |form| %>
+ <%= form.inputs do %>
+ <%= form.input :name %>
+ <%= form.input :published_name %>
+ <%= form.input :registration_number %>
+ <%= form.input :comment %>
+ <%= form.input :stop_point_ids, :as => :check_boxes, :collection => @route.stop_points.map { |s| [s.stop_area.name, s.id.to_s]} %>
+ <% if @route.new_record? %>
+ <%= form.input :objectid %>
+ <% else %>
+ <li>
+ <label><%= @journey_pattern.human_attribute_name("objectid") %>: </label>
+ <%= @journey_pattern.objectid %>
+ </li>
+ <% end %>
+ <% end %>
+
+ <%= form.buttons do %>
+ <%= form.commit_button true %>
+ <li><%= t('or') %></li>
+ <li><%= link_to t('cancel'), :back %></li>
+ <% end %>
+<% end %>
+
diff --git a/app/views/journey_patterns/_journey_pattern.html.erb b/app/views/journey_patterns/_journey_pattern.html.erb
new file mode 100644
index 000000000..1d4130f07
--- /dev/null
+++ b/app/views/journey_patterns/_journey_pattern.html.erb
@@ -0,0 +1,14 @@
+<%= div_for(journey_pattern) do %>
+ <%= link_to journey_name(journey_pattern), [@referential, @line, @route, journey_pattern] %>
+ <div class="info">
+ <% unless journey_pattern.name.blank? %>
+ <%= t('.from_to', :departure => journey_pattern.stop_points.first.stop_area.name, :arrival => journey_pattern.stop_points.last.stop_area.name) %> -
+ <% end %>
+ <%= t('.stop_count', :count => journey_pattern.stop_points.count, :route_count => @route.stop_points.count) %> -
+ <%= t('.vehicle_journeys_count', :count => journey_pattern.vehicle_journeys.count) %>
+ <div class="actions">
+ <%= link_to t("actions.destroy"), referential_line_route_journey_pattern_path(@referential, @line, @route, journey_pattern), :method => :delete, :confirm => t('journey_patterns.actions.destroy_confirm'), :class => "remove" %>
+ </div>
+ </div>
+<% end %>
+
diff --git a/app/views/journey_patterns/edit.html.erb b/app/views/journey_patterns/edit.html.erb
new file mode 100644
index 000000000..33fac2a6c
--- /dev/null
+++ b/app/views/journey_patterns/edit.html.erb
@@ -0,0 +1,4 @@
+<%= title_tag t('journey_patterns.edit.title', :journey_pattern => @journey_pattern.name ) %>
+
+<%= render "form" %>
+
diff --git a/app/views/journey_patterns/new.html.erb b/app/views/journey_patterns/new.html.erb
new file mode 100644
index 000000000..fb6ecbd64
--- /dev/null
+++ b/app/views/journey_patterns/new.html.erb
@@ -0,0 +1,4 @@
+<%= title_tag t('journey_patterns.new.title') %>
+
+<%= render "form" %>
+
diff --git a/app/views/journey_patterns/show.html.erb b/app/views/journey_patterns/show.html.erb
new file mode 100644
index 000000000..eed065f2f
--- /dev/null
+++ b/app/views/journey_patterns/show.html.erb
@@ -0,0 +1,62 @@
+<%= title_tag t('journey_patterns.show.title', :journey_pattern => journey_name( @journey_pattern), :route => @route.name ) %>
+
+<div class="route_show">
+
+ <div class="summary">
+ <p>
+ <label><%= @journey_pattern.human_attribute_name(:route) %>: </label>
+ <%= link_to @route.name, [@referential, @line, @route] %>
+ </p>
+ <p>
+ <label><%= @journey_pattern.human_attribute_name(:name) %>: </label>
+ <%= @journey_pattern.name %>
+ </p>
+ <p>
+ <label><%= @journey_pattern.human_attribute_name(:published_name) %>: </label>
+ <%= @journey_pattern.published_name %>
+ </p>
+ <p>
+ <label><%= @journey_pattern.human_attribute_name(:registration_number) %>: </label>
+ <%= @journey_pattern.registration_number %>
+ </p>
+ <p>
+ <label><%= @journey_pattern.human_attribute_name(:comment) %>: </label>
+ <%= @journey_pattern.comment %>
+ </p>
+ <p>
+ <label><%= @journey_pattern.human_attribute_name("objectid") %>: </label>
+ <%= @journey_pattern.objectid %>
+ </p>
+ <p>
+ <label><%= @journey_pattern.human_attribute_name("creation_time") %>: </label>
+ <%= l @journey_pattern.creation_time %>
+ </p>
+ <p>
+ <label><%= @journey_pattern.human_attribute_name("creator_id") %>: </label>
+ <%= @journey_pattern.creator_id %>
+ </p>
+ </div>
+
+</div>
+
+<h3 class="journey_pattern_stop_points"><%= t('.stop_points') %></h3>
+<div class="pagination">
+ <div class="page_info">
+ <%= page_entries_info @stop_points %>
+ </div>
+ <%= will_paginate @stop_points, :container => false %>
+</div>
+<div class="stop_points paginated_content">
+ <%= render :partial => "stop_points/stop_point", :collection => @stop_points %>
+</div>
+<div class="pagination">
+ <%= will_paginate @stop_points, :container => false %>
+</div>
+
+<% content_for :sidebar do %>
+<ul class="actions">
+ <li><%= link_to t('journey_patterns.actions.edit'), edit_referential_line_route_journey_pattern_path(@referential, @line, @route, @journey_pattern), :class => "edit" %></li>
+ <li><%= link_to t('journey_patterns.actions.destroy'), referential_line_route_path(@referential, @line, @route, @journey_pattern), :method => :delete, :confirm => t('journey_patterns.actions.destroy_confirm'), :class => "remove" %></li>
+</ul>
+<% end %>
+
diff --git a/app/views/journey_patterns/show.kml.erb b/app/views/journey_patterns/show.kml.erb
new file mode 100644
index 000000000..6fd8900b6
--- /dev/null
+++ b/app/views/journey_patterns/show.kml.erb
@@ -0,0 +1,21 @@
+<?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>
+ <% @journey_pattenr.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 %>
+ <departure>true</departure>
+ <% elsif stop_area.id==@journey_pattenr.stop_areas.last.id %>
+ <arrival>true</arrival>
+ <% end %>
+ <%= stop_area.geometry.kml_representation.html_safe %>
+ </Placemark>
+ <% end %>
+ </Document>
+</kml>
+
diff --git a/app/views/lines/_form.erb b/app/views/lines/_form.erb
index 1a7107e7e..ed0e4f9a2 100644
--- a/app/views/lines/_form.erb
+++ b/app/views/lines/_form.erb
@@ -5,7 +5,7 @@
<%= form.input :company, :as => :select, :collection => Chouette::Company.all, :include_blank => false%>
<%= form.input :name %>
<%= form.input :published_name %>
- <%= form.input :registrationnumber %>
+ <%= form.input :registration_number %>
<%= form.input :number %>
<%= form.input :transport_mode, :as => :select, :collection => Chouette::Line.transport_modes, :include_blank => false, :member_label => Proc.new { |mode| t("transport_modes.label.#{mode}") } %>
<%= form.input :comment %>
diff --git a/app/views/lines/show.html.erb b/app/views/lines/show.html.erb
index 4e7217384..8d6157cc7 100644
--- a/app/views/lines/show.html.erb
+++ b/app/views/lines/show.html.erb
@@ -18,10 +18,10 @@
</p>
<p>
<label><%= @line.human_attribute_name("published_name") %>: </label>
- <%= @line.publishedname %>
+ <%= @line.published_name %>
</p>
<p>
- <label><%= @line.human_attribute_name("registrationnumber") %>: </label>
+ <label><%= @line.human_attribute_name("registration_number") %>: </label>
<%= @line.registration_number %>
</p>
<p>
diff --git a/app/views/networks/_form.erb b/app/views/networks/_form.erb
index 29e62b9ec..32c131ca3 100644
--- a/app/views/networks/_form.erb
+++ b/app/views/networks/_form.erb
@@ -1,7 +1,7 @@
<%= semantic_form_for [@referential, @network] do |form| %>
<%= form.inputs do %>
<%= form.input :name %>
- <%= form.input :registrationnumber %>
+ <%= form.input :registration_number %>
<%= form.input :comment %>
<%= form.input :versiondate, :as => :date , :label => @network.human_attribute_name("version_date")%>
<%= form.input :description %>
diff --git a/app/views/networks/show.html.erb b/app/views/networks/show.html.erb
index b03347ccf..b11cde17d 100644
--- a/app/views/networks/show.html.erb
+++ b/app/views/networks/show.html.erb
@@ -8,8 +8,8 @@
<%= @network.name %>
</p>
<p>
- <label><%= Chouette::Network.human_attribute_name("registrationnumber") %>: </label>
- <%= @network.registrationnumber %>
+ <label><%= Chouette::Network.human_attribute_name("registration_number") %>: </label>
+ <%= @network.registration_number %>
</p>
<p>
<label><%= Chouette::Network.human_attribute_name("comment") %>: </label>
diff --git a/app/views/routes/show.html.erb b/app/views/routes/show.html.erb
index f248ba595..2ecbd0ada 100644
--- a/app/views/routes/show.html.erb
+++ b/app/views/routes/show.html.erb
@@ -78,6 +78,11 @@
<%= will_paginate @stop_points, :container => false %>
</div>
+<h3 class="route_journey_patterns"><%= t('.journey_patterns') %></h3>
+<div class="journey_patterns">
+ <%= render :partial => "journey_patterns/journey_pattern", :collection => @route.journey_patterns %>
+</div>
+
<% 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>
@@ -85,6 +90,9 @@
<li>
<%= link_to t('stop_points.actions.sort'), referential_line_route_stop_points_path(@referential, @line, @route), :class => "edit" %>
</li>
+ <li>
+ <%= link_to t('journey_patterns.actions.new'), new_referential_line_route_journey_pattern_path(@referential, @line, @route), :class => "add" %>
+ </li>
</ul>
<% end %>
diff --git a/app/views/stop_areas/_form.html.erb b/app/views/stop_areas/_form.html.erb
index 208345523..81878101a 100644
--- a/app/views/stop_areas/_form.html.erb
+++ b/app/views/stop_areas/_form.html.erb
@@ -6,7 +6,7 @@
<%= form.input :street_name %>
<%= form.input :country_code %>
<%= form.input :fare_code %>
- <%= form.input :registrationnumber %>
+ <%= form.input :registration_number %>
<% if @stop_area.new_record? %>
<%= form.input :stop_area_type, :as => :select, :collection => Chouette::StopArea.stop_area_types, :include_blank => false, :member_label => Proc.new { |stop_area_type| t("area_types.label.#{stop_area_type}") } %>
<%= form.input :objectid %>
diff --git a/app/views/stop_areas/index.html.erb b/app/views/stop_areas/index.html.erb
index cf7dafac0..d40f0d646 100644
--- a/app/views/stop_areas/index.html.erb
+++ b/app/views/stop_areas/index.html.erb
@@ -2,7 +2,7 @@
<%= search_form_for @q, :url => referential_stop_areas_path(@referential), :html => {:method => :get} do |f| %>
<%= f.label :name_or_country_code_cont, "#{t('.name_or_country_code')} :" %>
- <%= f.text_field :name_or_countrycode_cont %>
+ <%= f.text_field :name_or_country_code_cont %>
<%= f.submit t('actions.search') %> <%= t("or") %>
<%= link_to t("cancel"), referential_stop_areas_path(@referential) %>
@@ -32,9 +32,9 @@
<ul class="selection">
<% Chouette::StopArea.stop_area_types.each do |area_type| %>
-<li><%= link_with_search (image_tag("map/" + area_type + ".png")+t("area_types.label.#{area_type.to_s}")), "areatype_eq" => area_type.name %></li>
+<li><%= link_with_search (image_tag("map/" + area_type + ".png")+t("area_types.label.#{area_type.to_s}")), "area_type_eq" => area_type.name %></li>
<% end %>
-<li><%= link_with_search (image_tag("map/all.png")+t(".selection_all")), {"areatype_eq" => nil}, :class => "all" %></li>
+<li><%= link_with_search (image_tag("map/all.png")+t(".selection_all")), {"area_type_eq" => nil}, :class => "all" %></li>
</ul>
<% end %>
diff --git a/app/views/stop_areas/show.html.erb b/app/views/stop_areas/show.html.erb
index afaa5830a..992a4050b 100644
--- a/app/views/stop_areas/show.html.erb
+++ b/app/views/stop_areas/show.html.erb
@@ -28,7 +28,7 @@
<%= @stop_area.fare_code %>
</p>
<p>
- <label><%= @stop_area.human_attribute_name("registrationnumber") %>: </label>
+ <label><%= @stop_area.human_attribute_name("registration_number") %>: </label>
<%= @stop_area.registration_number %>
</p>
<p>
@@ -36,13 +36,13 @@
<%= t("area_types.label.#{@stop_area.stop_area_type}") %>
</p>
<p> <label><%= t('stop_areas.show.geographic_data') %> </label></p>
- <% if @stop_area.projectiontype == nil && @stop_area.longlattype == nil %>
+ <% if @stop_area.projection_type == nil && @stop_area.long_lat_type == nil %>
<span class='geo_data'><%= t('stop_areas.show.no_geographic_data') %></span>
<% else %>
- <% if @stop_area.projectiontype != nil %>
+ <% if @stop_area.projection_type != nil %>
<p>
- <span class='geo_data'><%= @stop_area.human_attribute_name("projectiontype") %>: </span>
- <%= @stop_area.projectiontype %>
+ <span class='geo_data'><%= @stop_area.human_attribute_name("projection_type") %>: </span>
+ <%= @stop_area.projection_type %>
</p>
<p>
<span class='geo_data'><%= @stop_area.human_attribute_name("x") %>: </span>
@@ -53,10 +53,10 @@
<%= @stop_area.y %>
</p>
<% end %>
- <% if @stop_area.longlattype != nil %>
+ <% if @stop_area.long_lat_type != nil %>
<p>
- <span class='geo_data'><%= @stop_area.human_attribute_name("longlattype") %>: </span>
- <%= @stop_area.longlattype %>
+ <span class='geo_data'><%= @stop_area.human_attribute_name("long_lat_type") %>: </span>
+ <%= @stop_area.long_lat_type %>
</p>
<p>
<span class='geo_data'><%= @stop_area.human_attribute_name("longitude") %>: </span>
diff --git a/app/views/time_tables/show.html.erb b/app/views/time_tables/show.html.erb
index 0ddd49338..f3e0bbce3 100644
--- a/app/views/time_tables/show.html.erb
+++ b/app/views/time_tables/show.html.erb
@@ -13,7 +13,7 @@
</p>
<p>
<label><%= @time_table.human_attribute_name("day_types") %>:&nbsp;&nbsp;</label>
- <% if @time_table.intdaytypes == 0 %>
+ <% if @time_table.int_day_types == 0 %>
<label><%= @time_table.human_attribute_name("none") %></label>
<% else %>
<% if @time_table.monday %>
diff --git a/app/views/vehicle_journeys/_form.html.erb b/app/views/vehicle_journeys/_form.html.erb
new file mode 100644
index 000000000..9a7d84ed8
--- /dev/null
+++ b/app/views/vehicle_journeys/_form.html.erb
@@ -0,0 +1,29 @@
+<%= semantic_form_for [@referential, @line, @route, @vehicle_journey] do |form| %>
+ <%= form.inputs do %>
+ <%= form.input :published_journey_name %>
+ <%= form.input :published_journey_identifier %>
+ <%= form.input :comment %>
+ <%= form.input :transport_mode, :as => :select, :collection => Chouette::Line.transport_modes, :include_blank => false, :member_label => Proc.new { |mode| t("transport_modes.label.#{mode}") } %>
+ <%= form.input :status_value %>
+ <%= form.input :facility %>
+ <%= form.input :vehicle_type_identifier%>
+ <% if @vehicle_journey.new_record? %>
+ <%= form.input :objectid %>
+ <% else %>
+ <li>
+ <label><%= @vehicle_journey.human_attribute_name("objectid") %>: </label>
+ <%= @vehicle_journey.objectid %>
+ </li>
+ <% end %>
+
+ <%= render :partial => "vehicle_journeys/vehicle_journey_at_stop_fields" %>
+
+ <% end %>
+
+ <%= form.buttons do %>
+ <%= form.commit_button true %>
+ <li><%= t('or') %></li>
+ <li><%= link_to t('cancel'), :back %></li>
+ <% end %>
+<% end %>
+
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
new file mode 100644
index 000000000..9ef3b509b
--- /dev/null
+++ b/app/views/vehicle_journeys/_vehicle_journey_at_stop_fields.html.erb
@@ -0,0 +1,11 @@
+ <% @vehicle_journey.vehicle_journey_at_stops.each_with_index do |vjas, index| %>
+ <li class="time input optional">
+ <input name=<%= "vehicle_journey[vehicle_journey_at_stops_attributes][#{index}][departure_time(3i)]" %> type="hidden" value="1">
+ <input name=<%= "vehicle_journey[vehicle_journey_at_stops_attributes][#{index}][departure_time(2i)]" %> type="hidden" value="1">
+ <input name=<%= "vehicle_journey[vehicle_journey_at_stops_attributes][#{index}][departure_time(1i)]" %> type="hidden" value="2000">
+ <label for=<%= "date_vehicle_journey_vehicle_journey_at_stops_attributes_#{index}_departure_time_5i" %>><%= vjas.stop_point.stop_area.name %></label>
+ <%= select_hour(vjas.departure_time.hour, :field_name => "vehicle_journey[vehicle_journey_at_stops_attributes][#{index}][departure_time(4i)]") %>
+ <%= select_minute(vjas.departure_time.min, :field_name => "vehicle_journey[vehicle_journey_at_stops_attributes][#{index}][departure_time(5i)]") %>
+ </li>
+ <% end %>
+
diff --git a/app/views/vehicle_journeys/edit.html.erb b/app/views/vehicle_journeys/edit.html.erb
new file mode 100644
index 000000000..c1079a16d
--- /dev/null
+++ b/app/views/vehicle_journeys/edit.html.erb
@@ -0,0 +1,21 @@
+<%= title_tag t('vehicle_journeys.edit.title' ) %>
+
+<div class="vehicle_journey">
+ <div class="summary">
+ <p>
+ <label><%= @route.human_attribute_name(:line) %>: </label>
+ <%= link_to line_formatted_name( @line), [@referential, @line] %>
+ </p>
+ <p>
+ <label><%= Chouette::Route.model_name.human %>: </label>
+ <%= link_to @route.name, [@referential, @line, @route] %>
+ </p>
+ <p>
+ <label><%= Chouette::JourneyPattern.model_name.human %>: </label>
+ <%= link_to journey_name(@vehicle_journey.journey_pattern), [@referential, @line, @route, @vehicle_journey.journey_pattern] %>
+ </p>
+ <div>
+<div>
+
+<%= render "form" %>
+
diff --git a/app/views/vehicle_journeys/index.html.erb b/app/views/vehicle_journeys/index.html.erb
new file mode 100644
index 000000000..cbb43408c
--- /dev/null
+++ b/app/views/vehicle_journeys/index.html.erb
@@ -0,0 +1,44 @@
+<%= title_tag t('vehicle_journeys.index.title', :route => @route.name ) %>
+
+<div class="vehicle_journey_index">
+ <div class="summary">
+ <p>
+ <label><%= @route.human_attribute_name(:line) %>: </label>
+ <%= link_to line_formatted_name( @line), [@referential, @line] %>
+ </p>
+ <p>
+ <label><%= Chouette::Route.model_name.human %>: </label>
+ <%= link_to @route.name, [@referential, @line, @route] %>
+ </p>
+ <div>
+<div>
+<h3 class="vehicle_journeys"><%= t('.vehicle_journeys') %></h3>
+<div class="pagination">
+ <div class="page_info">
+ <%= page_entries_info @vehicle_journeys %>
+ </div>
+ <%= will_paginate @vehicle_journeys, :container => false %>
+</div>
+<div class="vehicle_journeys paginated_content">
+ <table border="1">
+ <tr>
+ <th> "vide"</th>
+ <% @vehicle_journeys.each do |vj| %>
+ <th> <%= link_to "c", [@referential, @line, @route, vj]%></th>
+ <% end %>
+ </tr>
+ <% @route.stop_points.each_with_index do |sp, index| %>
+ <tr>
+ <td><%= sp.stop_area.name %></td>
+ <% @vehicle_journeys.each do |vj| %>
+ <td><%= @matrix["#{vj.id}-#{sp.id}"] ? l( @matrix["#{vj.id}-#{sp.id}"].departure_time, :format => :hour) : "" %></td>
+ <% end %>
+ </tr>
+ <% end %>
+ </table>
+</div>
+<% content_for :sidebar do %>
+<ul class="actions">
+</ul>
+<% end %>
+
diff --git a/app/views/vehicle_journeys/new.html.erb b/app/views/vehicle_journeys/new.html.erb
new file mode 100644
index 000000000..fd7bb34ac
--- /dev/null
+++ b/app/views/vehicle_journeys/new.html.erb
@@ -0,0 +1,17 @@
+<%= title_tag t('vehicle_journeys.new.title') %>
+
+<div class="vehicle_journey">
+ <div class="summary">
+ <p>
+ <label><%= @route.human_attribute_name(:line) %>: </label>
+ <%= link_to line_formatted_name( @line), [@referential, @line] %>
+ </p>
+ <p>
+ <label><%= Chouette::Route.model_name.human %>: </label>
+ <%= link_to @route.name, [@referential, @line, @route] %>
+ </p>
+ <div>
+<div>
+
+<%= render "form" %>
+
diff --git a/app/views/vehicle_journeys/show.html.erb b/app/views/vehicle_journeys/show.html.erb
new file mode 100644
index 000000000..a89d2261b
--- /dev/null
+++ b/app/views/vehicle_journeys/show.html.erb
@@ -0,0 +1,60 @@
+<%= title_tag t('vehicle_journeys.edit.title' ) %>
+
+<div class="vehicle_journey">
+ <div class="summary">
+ <p>
+ <label><%= @route.human_attribute_name(:line) %>: </label>
+ <%= link_to line_formatted_name( @line), [@referential, @line] %>
+ </p>
+ <p>
+ <label><%= Chouette::Route.model_name.human %>: </label>
+ <%= link_to @route.name, [@referential, @line, @route] %>
+ </p>
+ <p>
+ <label><%= Chouette::JourneyPattern.model_name.human %>: </label>
+ <%= link_to journey_name(@vehicle_journey.journey_pattern), [@referential, @line, @route, @vehicle_journey.journey_pattern] %>
+ </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("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("objectid") %>: </label>
+ <%= @vehicle_journey.objectid %>
+ </p>
+ <p>
+ <label><%= @vehicle_journey.human_attribute_name("creation_time") %>: </label>
+ <%= l @vehicle_journey.creation_time %>
+ </p>
+ <p>
+ <label><%= @vehicle_journey.human_attribute_name("creator_id") %>: </label>
+ <%= @vehicle_journey.creator_id %>
+ </p>
+ </div>
+</div>
+<% content_for :sidebar do %>
+<ul class="actions">
+ <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, :confirm => t('vehicle_journeys.actions.destroy_confirm'), :class => "remove" %></li>
+</ul>
+<% end %>
diff --git a/config/initializers/active_record.rb b/config/initializers/active_record.rb
new file mode 100644
index 000000000..cb4bf65b4
--- /dev/null
+++ b/config/initializers/active_record.rb
@@ -0,0 +1,2 @@
+ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::NATIVE_DATABASE_TYPES[:primary_key] = "bigserial primary key"
+
diff --git a/config/initializers/formtastic.rb b/config/initializers/formtastic.rb
index 140d5aee2..7aee33df5 100644
--- a/config/initializers/formtastic.rb
+++ b/config/initializers/formtastic.rb
@@ -1 +1,21 @@
- Formtastic::FormBuilder.i18n_lookups_by_default = true \ No newline at end of file
+ Formtastic::FormBuilder.i18n_lookups_by_default = true
+
+
+module Formtastic
+ module Inputs
+ class CheckBoxesInput
+ def selected_values
+ if object.respond_to?(method)
+ selected_items = [object.send(method)].compact.flatten
+
+ # FIX for ids only
+ return selected_items.map(&:to_s).compact if selected_items.all?{ |i| i.is_a? Integer}
+
+ [*selected_items.map { |o| send_or_call_or_object(value_method, o) }].compact
+ else
+ []
+ end
+ end
+ end
+ end
+end
diff --git a/config/initializers/postgresql_adapter_patch.rb b/config/initializers/postgresql_adapter_patch.rb
index 916933b39..42968bbdf 100644
--- a/config/initializers/postgresql_adapter_patch.rb
+++ b/config/initializers/postgresql_adapter_patch.rb
@@ -9,3 +9,4 @@ module ::ArJdbc
end
end
end
+ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::NATIVE_DATABASE_TYPES[:primary_key] = "bigserial primary key"
diff --git a/config/locales/companies.yml b/config/locales/companies.yml
index 8c91bec4a..940c7b866 100644
--- a/config/locales/companies.yml
+++ b/config/locales/companies.yml
@@ -23,7 +23,7 @@ en:
other: companies
attributes:
company:
- registrationnumber: "Registration number"
+ registration_number: "Registration number"
name: "Name"
short_name: "Short name"
organizational_unit: "Unit"
@@ -39,7 +39,7 @@ en:
formtastic:
hints:
company:
- registrationnumber: only alphanumerical or underscore characters
+ registration_number: only alphanumerical or underscore characters
objectid: "[prefix]:Company:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character"
fr:
@@ -67,7 +67,7 @@ fr:
other: transporteurs
attributes:
company:
- registrationnumber: "Numéro d'enregistrement"
+ registration_number: "Numéro d'enregistrement"
name: "Nom"
short_name: "Nom court"
organizational_unit: "Nom d'unité dans la société"
@@ -83,6 +83,6 @@ fr:
formtastic:
hints:
company:
- registrationnumber: "caractères autorisés : alphanumériques et 'souligné'"
+ registration_number: "caractères autorisés : alphanumériques et 'souligné'"
objectid: "[prefixe]:Company:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'"
diff --git a/config/locales/journey_patterns.yml b/config/locales/journey_patterns.yml
new file mode 100644
index 000000000..86257f784
--- /dev/null
+++ b/config/locales/journey_patterns.yml
@@ -0,0 +1,77 @@
+en:
+ journey_patterns:
+ journey_pattern:
+ from_to: "From '%{departure}' to '%{arrival}'"
+ stop_count: "%{count}/%{route_count} stops"
+ vehicle_journeys_count: "Vehicle journeys: %{count}"
+ actions:
+ new: Add a new journey_pattern
+ edit: Edit this journey pattern
+ destroy: Remove this journey pattern
+ destroy_confirm: Are you sure you want destroy this journey pattern ?
+ new:
+ title: Add a new journey pattern
+ edit:
+ title: Update journey pattern %{journey_pattern}
+ show:
+ title: Journey Pattern %{journey_pattern}
+ stop_points: "Stop point on journey pattern list"
+ index:
+ title: Journey Patterns
+ activerecord:
+ models:
+ journey_pattern:
+ zero: journey pattern
+ one: journey pattern
+ other: journey patterns
+ attributes:
+ journey_pattern:
+ route: Route
+ name: Name
+ published_name: Published name
+ comment: Comments
+ registration_number: Registration number
+ stop_point_ids: "Route's stop selection"
+ objectid: Neptune identifier
+ object_version: Version
+ creation_time: Created on
+ creator_id: Created by
+
+fr:
+ journey_patterns:
+ journey_pattern:
+ from_to: "De '%{departure}' à '%{arrival}'"
+ stop_count: "%{count}/%{route_count} arrêts"
+ vehicle_journeys_count: "Courses: %{count}"
+ actions:
+ new: Ajouter une mission
+ edit: Modifier cette mission
+ destroy: Supprimer cette mission
+ destroy_confirm: "Etes vous sûr de vouloir détruire cette mission ?"
+ new:
+ title: Ajouter une mission
+ edit:
+ title: Modifier la mission %{journey_pattern}
+ show:
+ title: Mission %{journey_pattern}
+ stop_points: "Liste des arrêts de la mission"
+ index:
+ title: Missions
+ activerecord:
+ models:
+ journey_pattern:
+ zero: mission
+ one: mission
+ other: missions
+ attributes:
+ journey_pattern:
+ route: "Séquence d'arrêts"
+ name: Nom
+ published_name: Nom public
+ comment: Commentaire
+ registration_number: "Numéro d'enregistrement"
+ stop_point_ids: Sélection des arrêts desservis
+ objectid: Identifiant Neptune
+ object_version: Version
+ creation_time: Créé le
+ creator_id: Créé par
diff --git a/config/locales/lines.yml b/config/locales/lines.yml
index 186a09f71..502bab4bf 100644
--- a/config/locales/lines.yml
+++ b/config/locales/lines.yml
@@ -35,7 +35,7 @@ en:
line:
network: Network
company: Company
- registrationnumber: Registration number
+ registration_number: Registration number
name: Name
published_name: Published name
number: Number
@@ -48,7 +48,7 @@ en:
formtastic:
hints:
line:
- registrationnumber: only alphanumerical or underscore characters
+ registration_number: only alphanumerical or underscore characters
objectid: "[prefix]:Line:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character"
fr:
@@ -88,7 +88,7 @@ fr:
line:
network: Réseau
company: Transporteur
- registrationnumber: "Numéro d'enregistrement"
+ registration_number: "Numéro d'enregistrement"
name: Nom
published_name: Nom public
number: Indice
@@ -101,5 +101,5 @@ fr:
formtastic:
hints:
line:
- registrationnumber: "caractères autorisés : alphanumériques et 'souligné'"
+ registration_number: "caractères autorisés : alphanumériques et 'souligné'"
objectid: "[prefixe]:Line:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'"
diff --git a/config/locales/networks.yml b/config/locales/networks.yml
index 7f24081a6..3415495ca 100644
--- a/config/locales/networks.yml
+++ b/config/locales/networks.yml
@@ -23,7 +23,7 @@ en:
other: networks
attributes:
network:
- registrationnumber: "Registration number"
+ registration_number: "Registration number"
name: "Name"
comment: "Comments"
version_date: "Date of this network's version"
@@ -38,7 +38,7 @@ en:
formtastic:
hints:
network:
- registrationnumber: only alphanumerical or underscore characters
+ registration_number: only alphanumerical or underscore characters
objectid: "[prefix]:GroupOfLine:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character"
fr:
@@ -65,7 +65,7 @@ fr:
other: réseaux
attributes:
network:
- registrationnumber: "Numéro d'enregistrement"
+ registration_number: "Numéro d'enregistrement"
name: "Nom"
comment: "Commentaire"
version_date: Date de version
@@ -80,6 +80,6 @@ fr:
formtastic:
hints:
network:
- registrationnumber: "caractères autorisés : alphanumériques et 'souligné'"
+ registration_number: "caractères autorisés : alphanumériques et 'souligné'"
objectid: "[prefixe]:GroupOfLine:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'"
diff --git a/config/locales/routes.yml b/config/locales/routes.yml
index fbea68a7d..4d0c7842d 100644
--- a/config/locales/routes.yml
+++ b/config/locales/routes.yml
@@ -12,6 +12,7 @@ en:
show:
title: Route %{route}
stop_points: "Stop point on route list"
+ journey_patterns: "Route journey patterns list"
no_opposite_route: No reversed route associated
undefined: Undefined
index:
@@ -53,6 +54,7 @@ fr:
show:
title: "Séquence d'arrêts %{route} de la ligne %{line}"
stop_points: "Liste des arrêts de la séquence d'arrêts"
+ journey_patterns: "Liste des missions"
no_opposite_route: "Aucune séquence d'arrêts associée en sens opposé"
undefined: Non défini
index:
diff --git a/config/locales/stop_areas.yml b/config/locales/stop_areas.yml
index 45bbbdb9e..1029e7e21 100644
--- a/config/locales/stop_areas.yml
+++ b/config/locales/stop_areas.yml
@@ -38,17 +38,17 @@ en:
attributes:
stop_area:
name: Name
- registrationnumber: Registration number
+ registration_number: Registration number
comment: Comments
stop_area_type: Area type
nearest_topic_name: Nearest point of interest
street_name: Street name
country_code: INSEE code
fare_code: Fare code
- projectiontype: Projection type
+ projection_type: Projection type
x: x-position
y: y-position
- longlattype: Projection type
+ long_lat_type: Projection type
longitude: Longitude
latitude: Latitude
objectid: Neptune identifier
@@ -89,11 +89,11 @@ fr:
title: Arrêts
selection: Filtrer sur
selection_all: Tous
- area_type: Type d'arrêt
+ area_type: "Type d'arrêt"
select_parent:
- title: Sélection du parent de l'arrêt %{stop_area}
+ title: "Sélection du parent de l'arrêt %{stop_area}"
add_children:
- title: Ajouter les enfants de l'arrêt %{stop_area}
+ title: "Ajouter les enfants de l'arrêt %{stop_area}"
activerecord:
models:
stop_area:
@@ -103,7 +103,7 @@ fr:
attributes:
stop_area:
name: Nom
- registrationnumber: "Numéro d'enregistrement"
+ registration_number: "Numéro d'enregistrement"
published_name: Nom public
comment: Commentaire
stop_area_type: "Type d'arrêt"
@@ -111,10 +111,10 @@ fr:
street_name: Nom de la rue
country_code: Code INSEE
fare_code: Zone tarifaire
- projectiontype: Projection
+ projection_type: Projection
x: Position X
y: Position Y
- longlattype: Projection
+ long_lat_type: Projection
longitude: Longitude
latitude: Latitude
objectid: Identifiant Neptune
@@ -126,7 +126,7 @@ fr:
formtastic:
hints:
stop_area:
- registrationnumber: "caractères autorisés : alphanumériques et 'souligné'"
+ registration_number: "caractères autorisés : alphanumériques et 'souligné'"
objectid: "[prefixe]:StopArea:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'"
diff --git a/config/locales/vehicle_journeys.yml b/config/locales/vehicle_journeys.yml
new file mode 100644
index 000000000..18882bad8
--- /dev/null
+++ b/config/locales/vehicle_journeys.yml
@@ -0,0 +1,80 @@
+en:
+ vehicle_journeys:
+ actions:
+ new: Add a new vehicle journey
+ edit: Edit this vehicle journey
+ destroy: Remove this vehicle journey
+ destroy_confirm: Are you sure you want destroy this vehicle journey?
+ new:
+ title: Add a new vehicle journey
+ edit:
+ title: Update vehicle journey %{vehicle journey}
+ show:
+ title: Vehicle Journey %{vehicle journey}
+ index:
+ title: Vehicle journeys on route {%route}
+ activerecord:
+ models:
+ vehicle_journey:
+ zero: vehicle journey
+ one: vehicle journey
+ other: vehicle journeys
+ attributes:
+ vehicle_journey:
+ line: Line
+ route: Route
+ journey_pattern: Journey Pattern
+ time_slot: Time Slot
+ company: Company
+ comment: Comments
+ status_value: Status Value
+ transport_mode: Transport Mode
+ published_journey_name: Published Name
+ published_journey_identifier: Published Identifier
+ facility: Facility
+ vehicletypeidentifier: Vehicle Type Identifier
+ objectid: Neptune identifier
+ object_version: Version
+ creation_time: Created on
+ creator_id: Created by
+
+fr:
+ vehicle_journeys:
+ actions:
+ new: "Ajouter une course"
+ edit: "Modifier cette course"
+ destroy: "Supprimer cette course"
+ destroy_confirm: "Etes vous sûr de détruire cette course ?"
+ new:
+ title: "Ajouter une course"
+ edit:
+ title: "Modifier la course au départ de %{stop} à %{time} sur la séquence %{route}"
+ show:
+ title: "Course au départ de %{stop} à %{time} sur la séquence %{route}"
+ index:
+ title: "Courses de la séquence d'arrêts %{route}"
+ activerecord:
+ models:
+ vehicle_journey:
+ zero: "Course"
+ one: "Course"
+ other: "Courses"
+ attributes:
+ vehicle_journey:
+ line: Ligne
+ route: "Séquence d'arrêt"
+ journey_pattern: Mission
+ time_slot: Fréquence
+ company: Transporteur
+ comment: Commentaires
+ status_value: Etat de trafic
+ transport_mode: Mode de transport
+ published_journey_name: Nom public
+ published_journey_identifier: Identifiant public
+ facility: Equipement
+ vehicle_type_identifier: "Type d'identifiant du véhicule"
+ objectid: Identifiant Neptune
+ object_version: Version
+ creation_time: Créé le
+ creator_id: Créé par
+
diff --git a/config/routes.rb b/config/routes.rb
index 305a219ce..4e8d75a9c 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -30,6 +30,8 @@ ChouetteIhm::Application.routes.draw do
end
end
resources :routes do
+ resources :journey_patterns
+ resources :vehicle_journeys
resources :stop_points do
collection do
post :sort
diff --git a/db/migrate/20120213131553_create_chouette_line.rb b/db/migrate/20120213131553_create_chouette_line.rb
index 09a674183..51231a3fc 100644
--- a/db/migrate/20120213131553_create_chouette_line.rb
+++ b/db/migrate/20120213131553_create_chouette_line.rb
@@ -1,24 +1,24 @@
class CreateChouetteLine < ActiveRecord::Migration
def up
- create_table "line", :force => true do |t|
- t.integer "ptnetworkid", :limit => 8
- t.integer "companyid", :limit => 8
- t.string "objectid"
- t.integer "objectversion"
- t.datetime "creationtime"
- t.string "creatorid"
+ create_table "lines", :force => true do |t|
+ t.integer "network_id", :limit => 8
+ t.integer "company_id", :limit => 8
+ t.string "objectid", :null => false
+ t.integer "object_version"
+ t.datetime "creation_time"
+ t.string "creator_id"
t.string "name"
t.string "number"
- t.string "publishedname"
- t.string "transportmodename"
- t.string "registrationnumber"
+ t.string "published_name"
+ t.string "transport_mode_name"
+ t.string "registration_number"
t.string "comment"
- t.boolean "mobilityrestrictedsuitable"
- t.integer "userneeds", :limit => 8
+ t.boolean "mobility_restricted_suitability"
+ t.integer "int_user_needs"
end
- add_index "line", ["objectid"], :name => "line_objectid_key", :unique => true
- add_index "line", ["registrationnumber"], :name => "line_registrationnumber_key", :unique => true
+ add_index "lines", ["objectid"], :name => "lines_objectid_key", :unique => true
+ add_index "lines", ["registration_number"], :name => "lines_registration_number_key", :unique => true
end
def down
diff --git a/db/migrate/20120214101458_create_chouette_company.rb b/db/migrate/20120214101458_create_chouette_company.rb
index 5a15a26e6..c72a73d9b 100644
--- a/db/migrate/20120214101458_create_chouette_company.rb
+++ b/db/migrate/20120214101458_create_chouette_company.rb
@@ -1,23 +1,23 @@
class CreateChouetteCompany < ActiveRecord::Migration
def up
- create_table "company", :force => true do |t|
- t.string "objectid"
- t.integer "objectversion"
- t.datetime "creationtime"
- t.string "creatorid"
+ create_table "companies", :force => true do |t|
+ t.string "objectid", :null => false
+ t.integer "object_version"
+ t.datetime "creation_time"
+ t.string "creator_id"
t.string "name"
- t.string "shortname"
- t.string "organizationalunit"
- t.string "operatingdepartmentname"
+ t.string "short_name"
+ t.string "organizational_unit"
+ t.string "operating_department_name"
t.string "code"
t.string "phone"
t.string "fax"
t.string "email"
- t.string "registrationnumber"
+ t.string "registration_number"
end
- add_index "company", ["objectid"], :name => "company_objectid_key", :unique => true
- add_index "company", ["registrationnumber"], :name => "company_registrationnumber_key", :unique => true
+ add_index "companies", ["objectid"], :name => "companies_objectid_key", :unique => true
+ add_index "companies", ["registration_number"], :name => "companies_registration_number_key", :unique => true
end
def down
diff --git a/db/migrate/20120214101645_create_chouette_ptnetwork.rb b/db/migrate/20120214101645_create_chouette_ptnetwork.rb
index 13f294345..45037c31a 100644
--- a/db/migrate/20120214101645_create_chouette_ptnetwork.rb
+++ b/db/migrate/20120214101645_create_chouette_ptnetwork.rb
@@ -1,21 +1,22 @@
class CreateChouettePtnetwork < ActiveRecord::Migration
def up
- create_table "ptnetwork", :force => true do |t|
- t.string "objectid"
- t.integer "objectversion"
- t.datetime "creationtime"
- t.string "creatorid"
- t.date "versiondate"
+ create_table "networks", :force => true do |t|
+ t.string "objectid", :null => false
+ t.integer "object_version"
+ t.datetime "creation_time"
+ t.string "creator_id"
+ t.date "version_date"
t.string "description"
t.string "name"
- t.string "registrationnumber"
- t.string "sourcename"
- t.string "sourceidentifier"
+ t.string "registration_number"
+ t.string "source_name"
+ t.string "source_type"
+ t.string "source_identifier"
t.string "comment"
end
- add_index "ptnetwork", ["objectid"], :name => "ptnetwork_objectid_key", :unique => true
- add_index "ptnetwork", ["registrationnumber"], :name => "ptnetwork_registrationnumber_key", :unique => true
+ add_index "networks", ["objectid"], :name => "networks_objectid_key", :unique => true
+ add_index "networks", ["registration_number"], :name => "networks_registration_number_key", :unique => true
end
def down
diff --git a/db/migrate/20120416095045_create_chouette_stop_area.rb b/db/migrate/20120416095045_create_chouette_stop_area.rb
index 46ac7f87b..79b8c8260 100644
--- a/db/migrate/20120416095045_create_chouette_stop_area.rb
+++ b/db/migrate/20120416095045_create_chouette_stop_area.rb
@@ -1,34 +1,33 @@
class CreateChouetteStopArea < ActiveRecord::Migration
def up
- create_table "stoparea", :force => true do |t|
- t.integer "parentid", :limit => 8
- t.string "objectid"
- t.integer "objectversion"
- t.datetime "creationtime"
- t.string "creatorid"
+ create_table "stop_areas", :force => true do |t|
+ t.integer "parent_id", :limit => 8
+ t.string "objectid", :null => false
+ t.integer "object_version"
+ t.datetime "creation_time"
+ t.string "creator_id"
t.string "name"
t.string "comment"
- t.string "areatype"
- t.string "registrationnumber"
- t.string "nearesttopicname"
- t.integer "farecode"
+ t.string "area_type"
+ t.string "registration_number"
+ t.string "nearest_topic_name"
+ t.integer "fare_code"
t.decimal "longitude", :precision => 19, :scale => 16
t.decimal "latitude", :precision => 19, :scale => 16
- t.string "longlattype"
+ t.string "long_lat_type"
t.decimal "x", :precision => 19, :scale => 2
t.decimal "y", :precision => 19, :scale => 2
- t.string "projectiontype"
- t.string "countrycode"
- t.string "streetname"
- t.integer "modes", :default => 0
+ t.string "projection_type"
+ t.string "country_code"
+ t.string "street_name"
end
- add_index "stoparea", ["objectid"], :name => "stoparea_objectid_key", :unique => true
- add_index "stoparea", ["parentid"], :name => "index_stoparea_on_parentid"
+ add_index "stop_areas", ["objectid"], :name => "stop_areas_objectid_key", :unique => true
+ add_index "stop_areas", ["parent_id"], :name => "index_stop_areas_on_parent_id"
end
def down
- drop_table "stoparea"
+ drop_table "stop_areas"
end
end
diff --git a/db/migrate/20120416095046_create_time_table.rb b/db/migrate/20120416095046_create_time_table.rb
index 3752f0836..da579bb87 100644
--- a/db/migrate/20120416095046_create_time_table.rb
+++ b/db/migrate/20120416095046_create_time_table.rb
@@ -1,38 +1,38 @@
class CreateTimeTable < ActiveRecord::Migration
def up
- create_table "timetable", :force => true do |t|
+ create_table "time_tables", :force => true do |t|
t.string "objectid", :null => false
- t.integer "objectversion", :default => 1
- t.datetime "creationtime"
- t.string "creatorid"
+ t.integer "object_version", :default => 1
+ t.datetime "creation_time"
+ t.string "creator_id"
t.string "version"
t.string "comment"
- t.integer "intdaytypes", :default => 0
+ t.integer "int_day_types", :default => 0
end
- add_index "timetable", ["objectid"], :name => "timetable_objectid_key", :unique => true
+ add_index "time_tables", ["objectid"], :name => "time_tables_objectid_key", :unique => true
- create_table "timetable_date", :id => false, :force => true do |t|
- t.integer "timetableid", :limit => 8, :null => false
+ create_table "time_table_dates", :id => false, :force => true do |t|
+ t.integer "time_table_id", :limit => 8, :null => false
t.date "date"
t.integer "position", :null => false
end
- add_index "timetable_date", ["timetableid"], :name => "index_timetable_date_on_timetableid"
+ add_index "time_table_dates", ["time_table_id"], :name => "index_time_table_dates_on_time_table_id"
- create_table "timetable_period", :id => false, :force => true do |t|
- t.integer "timetableid", :limit => 8, :null => false
- t.date "periodstart"
- t.date "periodend"
+ create_table "time_table_periods", :id => false, :force => true do |t|
+ t.integer "time_table_id", :limit => 8, :null => false
+ t.date "period_start"
+ t.date "period_end"
t.integer "position", :null => false
end
- add_index "timetable_period", ["timetableid"], :name => "index_timetable_period_on_timetableid"
+ add_index "time_table_periods", ["time_table_id"], :name => "index_time_table_periods_on_time_table_id"
end
def down
- drop_table "timetable_period"
- drop_table "timetable_date"
- drop_table "timetable"
+ drop_table "time_table_periods"
+ drop_table "time_table_dates"
+ drop_table "time_tables"
end
end
diff --git a/db/migrate/20120425080337_create_chouette_route.rb b/db/migrate/20120425080337_create_chouette_route.rb
index 98d0f3c11..21ff43bcc 100644
--- a/db/migrate/20120425080337_create_chouette_route.rb
+++ b/db/migrate/20120425080337_create_chouette_route.rb
@@ -1,19 +1,20 @@
class CreateChouetteRoute < ActiveRecord::Migration
def up
- create_table "route", :force => true do |t|
- t.integer "lineid", :limit => 8
- t.string "objectid"
- t.integer "objectversion"
- t.datetime "creationtime"
- t.string "creatorid"
+ create_table "routes", :force => true do |t|
+ t.integer "line_id", :limit => 8
+ t.string "objectid", :null => false
+ t.integer "object_version"
+ t.datetime "creation_time"
+ t.string "creator_id"
t.string "name"
t.string "comment"
- t.integer "oppositerouteid", :limit => 8
- t.string "publishedname"
+ t.integer "opposite_route_id", :limit => 8
+ t.string "published_name"
t.string "number"
t.string "direction"
t.string "wayback"
end
+ add_index "routes", ["objectid"], :name => "routes_objectid_key", :unique => true
end
def down
diff --git a/db/migrate/20120425125542_create_chouette_stop_point.rb b/db/migrate/20120425125542_create_chouette_stop_point.rb
index 07e7861a8..ee81d9bfc 100644
--- a/db/migrate/20120425125542_create_chouette_stop_point.rb
+++ b/db/migrate/20120425125542_create_chouette_stop_point.rb
@@ -1,14 +1,15 @@
class CreateChouetteStopPoint < ActiveRecord::Migration
def up
- create_table "stoppoint", :force => true do |t|
- t.integer "routeid", :limit => 8
- t.integer "stopareaid", :limit => 8
- t.string "objectid"
- t.integer "objectversion"
- t.datetime "creationtime"
- t.string "creatorid"
+ create_table "stop_points", :force => true do |t|
+ t.integer "route_id", :limit => 8
+ t.integer "stop_area_id", :limit => 8
+ t.string "objectid", :null => false
+ t.integer "object_version"
+ t.datetime "creation_time"
+ t.string "creator_id"
t.integer "position"
end
+ add_index "stop_points", ["objectid"], :name => "stop_points_objectid_key", :unique => true
end
def down
diff --git a/db/migrate/20120426141032_create_chouette_connection_link.rb b/db/migrate/20120426141032_create_chouette_connection_link.rb
index 185c49af2..530c9001a 100644
--- a/db/migrate/20120426141032_create_chouette_connection_link.rb
+++ b/db/migrate/20120426141032_create_chouette_connection_link.rb
@@ -1,26 +1,26 @@
class CreateChouetteConnectionLink < ActiveRecord::Migration
def up
- create_table "connectionlink", :force => true do |t|
- t.integer "departureid", :limit => 8
- t.integer "arrivalid", :limit => 8
+ create_table "connection_links", :force => true do |t|
+ t.integer "departure_id", :limit => 8
+ t.integer "arrival_id", :limit => 8
t.string "objectid", :null => false
- t.integer "objectversion"
- t.datetime "creationtime"
- t.string "creatorid"
+ t.integer "object_version"
+ t.datetime "creation_time"
+ t.string "creator_id"
t.string "name"
t.string "comment"
- t.decimal "linkdistance", :precision => 19, :scale => 2
- t.string "linktype"
- t.time "defaultduration"
- t.time "frequenttravellerduration"
- t.time "occasionaltravellerduration"
- t.time "mobilityrestrictedtravellerduration"
- t.boolean "mobilityrestrictedsuitability"
- t.boolean "stairsavailability"
- t.boolean "liftavailability"
- t.integer "intuserneeds"
+ t.decimal "link_distance", :precision => 19, :scale => 2
+ t.string "link_type"
+ t.time "default_duration"
+ t.time "frequent_traveller_duration"
+ t.time "occasional_traveller_duration"
+ t.time "mobility_restricted_traveller_duration"
+ t.boolean "mobility_restricted_suitability"
+ t.boolean "stairs_availability"
+ t.boolean "lift_availability"
+ t.integer "int_user_needs"
end
- add_index "connectionlink", ["objectid"], :name => "connectionlink_objectid_key", :unique => true
+ add_index "connection_links", ["objectid"], :name => "connection_links_objectid_key", :unique => true
end
def down
diff --git a/db/migrate/20120525092203_create_chouette_journey_pattern.rb b/db/migrate/20120525092203_create_chouette_journey_pattern.rb
new file mode 100644
index 000000000..4e45c0a94
--- /dev/null
+++ b/db/migrate/20120525092203_create_chouette_journey_pattern.rb
@@ -0,0 +1,26 @@
+class CreateChouetteJourneyPattern < ActiveRecord::Migration
+ def up
+ create_table :journey_patterns, :force => true do |t|
+ t.integer "route_id", :limit => 8
+
+ t.string "objectid", :null => false
+ t.integer "object_version"
+ t.datetime "creation_time"
+ t.string "creator_id"
+
+ t.string "name"
+ t.string "comment"
+ t.string "registration_number"
+ t.string "published_name"
+
+ t.integer "departure_stop_point_id", :limit => 8
+ t.integer "arrival_stop_point_id", :limit => 8
+ end
+ add_index "journey_patterns", ["objectid"], :name => "journey_patterns_objectid_key", :unique => true
+ end
+
+ def down
+ remove_index "journey_patterns", :name => "journey_patterns_objectid_key"
+ drop_table :journey_patterns
+ end
+end
diff --git a/db/migrate/20120525092204_create_chouette_journey_pattern_stop_point.rb b/db/migrate/20120525092204_create_chouette_journey_pattern_stop_point.rb
new file mode 100644
index 000000000..4d6799151
--- /dev/null
+++ b/db/migrate/20120525092204_create_chouette_journey_pattern_stop_point.rb
@@ -0,0 +1,14 @@
+class CreateChouetteJourneyPatternStopPoint < ActiveRecord::Migration
+ def up
+ create_table :journey_patterns_stop_points, :id => false, :force => true do |t|
+ t.integer "journey_pattern_id", :limit => 8
+ t.integer "stop_point_id", :limit => 8
+ end
+ add_index "journey_patterns_stop_points", ["journey_pattern_id"], :name => "index_journey_pattern_id_on_journey_patterns_stop_points"
+ end
+
+ def down
+ remove_index "journey_patterns_stop_points", :name => "index_journey_pattern_id_on_journey_patterns_stop_points"
+ drop_table :journey_pattern_stop_points
+ end
+end
diff --git a/db/migrate/20120525092205_create_chouette_time_slot.rb b/db/migrate/20120525092205_create_chouette_time_slot.rb
new file mode 100644
index 000000000..1508645b1
--- /dev/null
+++ b/db/migrate/20120525092205_create_chouette_time_slot.rb
@@ -0,0 +1,22 @@
+class CreateChouetteTimeSlot < ActiveRecord::Migration
+ def up
+ create_table :time_slots, :force => true do |t|
+ t.string "objectid", :null => false
+ t.integer "object_version"
+ t.datetime "creation_time"
+ t.string "creator_id"
+
+ t.string "name"
+ t.datetime "beginning_slot_time"
+ t.datetime "end_slot_time"
+ t.datetime "first_departure_time_in_slot"
+ t.datetime "last_departure_time_in_slot"
+ end
+ add_index "time_slots", ["objectid"], :name => "time_slots_objectid_key", :unique => true
+ end
+
+ def down
+ remove_index "time_slots", :name => "time_slot_objectid_key"
+ drop_table :time_slots
+ end
+end
diff --git a/db/migrate/20120525092206_create_chouette_vehicle_journey.rb b/db/migrate/20120525092206_create_chouette_vehicle_journey.rb
new file mode 100644
index 000000000..8e5c46b0c
--- /dev/null
+++ b/db/migrate/20120525092206_create_chouette_vehicle_journey.rb
@@ -0,0 +1,34 @@
+class CreateChouetteVehicleJourney < ActiveRecord::Migration
+ def up
+ create_table :vehicle_journeys, :force => true do |t|
+ t.integer "route_id", :limit => 8
+ t.integer "journey_pattern_id", :limit => 8
+ t.integer "time_slot_id", :limit => 8
+ t.integer "company_id", :limit => 8
+
+ t.string "objectid", :null => false
+ t.integer "object_version"
+ t.datetime "creation_time"
+ t.string "creator_id"
+
+ t.string "comment"
+ t.string "status_value"
+ t.string "transport_mode"
+ t.string "published_journey_name"
+ t.string "published_journey_identifier"
+ t.string "facility"
+ t.string "vehicle_type_identifier"
+
+ # TODO: delete this column that are here just for chouette-command compliance
+ t.integer "number"
+ end
+ add_index "vehicle_journeys", ["objectid"], :name => "vehicle_journeys_objectid_key", :unique => true
+ add_index "vehicle_journeys", ["route_id"], :name => "index_vehicle_journeys_on_route_id"
+ end
+
+ def down
+ remove_index "vehicle_journeys", :name => "vehicle_journeys_objectid_key"
+ remove_index "vehicle_journeys", :name => "index_vehicle_journeys_on_route_id"
+ drop_table :vehicle_journeys
+ end
+end
diff --git a/db/migrate/20120525092207_create_chouette_vehicle_journey_at_stop.rb b/db/migrate/20120525092207_create_chouette_vehicle_journey_at_stop.rb
new file mode 100644
index 000000000..330241972
--- /dev/null
+++ b/db/migrate/20120525092207_create_chouette_vehicle_journey_at_stop.rb
@@ -0,0 +1,25 @@
+class CreateChouetteVehicleJourneyAtStop < ActiveRecord::Migration
+ def up
+ create_table :vehicle_journey_at_stops, :force => true do |t|
+ t.integer "vehicle_journey_id", :limit => 8
+ t.integer "stop_point_id", :limit => 8
+
+ t.string "connecting_service_id"
+ t.string "boarding_alighting_possibility"
+
+ t.datetime "arrival_time"
+ t.datetime "departure_time"
+ t.datetime "waiting_time"
+ t.datetime "elapse_duration"
+ t.datetime "headway_frequency"
+ end
+ add_index "vehicle_journey_at_stops", ["vehicle_journey_id"], :name => "index_vehicle_journey_at_stops_on_vehicle_journey_id"
+ add_index "vehicle_journey_at_stops", ["stop_point_id"], :name => "index_vehicle_journey_at_stops_on_stop_pointid"
+ end
+
+ def down
+ remove_index "vehicle_journey_at_stops", :name => "index_vehicle_journey_at_stops_on_vehicle_journey_id"
+ remove_index "vehicle_journey_at_stops", :name => "index_vehicle_journey_at_stops_on_stop_point_id"
+ drop_table :vehicle_journey_at_stops
+ end
+end
diff --git a/db/migrate/20120525092208_create_chouette_time_table_vehicle_journey.rb b/db/migrate/20120525092208_create_chouette_time_table_vehicle_journey.rb
new file mode 100644
index 000000000..2c7ebb1f5
--- /dev/null
+++ b/db/migrate/20120525092208_create_chouette_time_table_vehicle_journey.rb
@@ -0,0 +1,16 @@
+class CreateChouetteTimeTableVehicleJourney < ActiveRecord::Migration
+ def up
+ create_table :time_tables_vehicle_journeys, :id => false, :force => true do |t|
+ t.integer "time_table_id", :limit => 8
+ t.integer "vehicle_journey_id", :limit => 8
+ end
+ add_index "time_tables_vehicle_journeys", ["time_table_id"], :name => "index_time_tables_vehicle_journeys_on_time_table_id"
+ add_index "time_tables_vehicle_journeys", ["vehicle_journey_id"], :name => "index_time_tables_vehicle_journeys_on_vehicle_journey_id"
+ end
+
+ def down
+ remove_index "time_tables_vehicle_journeys", :name => "index_time_tables_vehicle_journeys_on_time_table_id"
+ remove_index "time_tables_vehicle_journeys", :name => "index_time_tables_vehicle_journeys_on_vehicle_journey_id"
+ drop_table :time_tables_vehicle_journeys
+ end
+end
diff --git a/db/migrate/20120525092209_create_chouette_access_point.rb b/db/migrate/20120525092209_create_chouette_access_point.rb
new file mode 100644
index 000000000..a3733cfde
--- /dev/null
+++ b/db/migrate/20120525092209_create_chouette_access_point.rb
@@ -0,0 +1,34 @@
+class CreateChouetteAccessPoint < ActiveRecord::Migration
+ def up
+ create_table :access_points, :force => true do |t|
+ t.string "objectid"
+ t.integer "object_version"
+ t.datetime "creation_time"
+ t.string "creator_id"
+
+ t.string "name"
+ t.string "comment"
+ t.decimal "longitude", :precision => 19, :scale => 16
+ t.decimal "latitude", :precision => 19, :scale => 16
+ t.string "long_lat_type"
+ t.decimal "x", :precision => 19, :scale => 2
+ t.decimal "y", :precision => 19, :scale => 2
+ t.string "projection_type"
+ t.string "country_code"
+ t.string "street_name"
+ t.string "contained_in"
+
+ t.datetime "openning_time"
+ t.datetime "closing_time"
+ t.string "type"
+ t.boolean "lift_availability"
+ t.datetime "mobility_restricted_suitability"
+ t.datetime "stairs_availability"
+ end
+ add_index "access_points", ["objectid"], :name => "access_points_objectid_key", :unique => true
+ end
+
+ def down
+ drop_table :access_points
+ end
+end
diff --git a/db/migrate/20120525092210_create_chouette_access_link.rb b/db/migrate/20120525092210_create_chouette_access_link.rb
new file mode 100644
index 000000000..8ddccd7bc
--- /dev/null
+++ b/db/migrate/20120525092210_create_chouette_access_link.rb
@@ -0,0 +1,33 @@
+class CreateChouetteAccessLink < ActiveRecord::Migration
+ def up
+ create_table :access_links, :force => true do |t|
+ t.integer "access_point_id", :limit => 8
+ t.integer "stop_area_id", :limit => 8
+
+ t.string "objectid", :null => false
+ t.integer "object_version"
+ t.datetime "creation_time"
+ t.string "creator_id"
+
+ t.string "name"
+ t.string "comment"
+ t.decimal "link_distance", :precision => 19, :scale => 2
+ t.boolean "lift_availability"
+ t.boolean "mobility_restricted_suitability"
+ t.boolean "stairs_availability"
+ t.time "default_duration"
+ t.time "frequent_traveller_duration"
+ t.time "occasional_traveller_duration"
+ t.time "mobility_restricted_traveller_duration"
+
+ t.string "link_type"
+ t.integer "int_user_needs"
+ t.string "link_orientation"
+ end
+ add_index "access_links", ["objectid"], :name => "access_links_objectid_key", :unique => true
+ end
+
+ def down
+ drop_table :access_links
+ end
+end
diff --git a/db/migrate/20120525092211_create_chouette_facility.rb b/db/migrate/20120525092211_create_chouette_facility.rb
new file mode 100644
index 000000000..9f4cb2848
--- /dev/null
+++ b/db/migrate/20120525092211_create_chouette_facility.rb
@@ -0,0 +1,34 @@
+class CreateChouetteFacility < ActiveRecord::Migration
+ def up
+ create_table :facilities, :force => true do |t|
+ t.integer "stop_area_id", :limit => 8
+ t.integer "line_id", :limit => 8
+ t.integer "connection_link_id",:limit => 8
+ t.integer "stop_point_id", :limit => 8
+
+ t.string "objectid", :null => false
+ t.integer "object_version"
+ t.datetime "creation_time"
+ t.string "creator_id"
+
+ t.string "name"
+ t.string "comment"
+ t.string "description"
+ t.boolean "free_access"
+ t.decimal "longitude", :precision => 19, :scale => 16
+ t.decimal "latitude", :precision => 19, :scale => 16
+ t.string "long_lat_type"
+ t.decimal "x", :precision => 19, :scale => 2
+ t.decimal "y", :precision => 19, :scale => 2
+ t.string "projection_type"
+ t.string "country_code"
+ t.string "street_name"
+ t.string "contained_in"
+ end
+ add_index "facilities", ["objectid"], :name => "facilities_objectid_key", :unique => true
+ end
+
+ def down
+ drop_table :facilities
+ end
+end
diff --git a/db/migrate/20120525092212_create_chouette_facility_feature.rb b/db/migrate/20120525092212_create_chouette_facility_feature.rb
new file mode 100644
index 000000000..0ed65c172
--- /dev/null
+++ b/db/migrate/20120525092212_create_chouette_facility_feature.rb
@@ -0,0 +1,12 @@
+class CreateChouetteFacilityFeature < ActiveRecord::Migration
+ def up
+ create_table :facilities_features, :id => false, :force => true do |t|
+ t.integer "facility_id", :limit => 8
+ t.integer "choice_code"
+ end
+ end
+
+ def down
+ drop_table :facilities_features
+ end
+end
diff --git a/db/migrate/20120525092213_create_chouette_group_of_line.rb b/db/migrate/20120525092213_create_chouette_group_of_line.rb
new file mode 100644
index 000000000..c64a571ba
--- /dev/null
+++ b/db/migrate/20120525092213_create_chouette_group_of_line.rb
@@ -0,0 +1,18 @@
+class CreateChouetteGroupOfLine < ActiveRecord::Migration
+ def up
+ create_table :group_of_lines, :force => true do |t|
+ t.string "objectid", :null => false
+ t.integer "object_version"
+ t.datetime "creation_time"
+ t.string "creator_id"
+
+ t.string "name"
+ t.string "comment"
+ end
+ add_index "group_of_lines", ["objectid"], :name => "group_of_lines_objectid_key", :unique => true
+ end
+
+ def down
+ drop_table :group_of_lines
+ end
+end
diff --git a/db/migrate/20120525092214_create_chouette_group_of_line_line.rb b/db/migrate/20120525092214_create_chouette_group_of_line_line.rb
new file mode 100644
index 000000000..3763386df
--- /dev/null
+++ b/db/migrate/20120525092214_create_chouette_group_of_line_line.rb
@@ -0,0 +1,12 @@
+class CreateChouetteGroupOfLineLine < ActiveRecord::Migration
+ def up
+ create_table :group_of_lines_lines, :id => false, :force => true do |t|
+ t.integer "group_of_line_id", :limit => 8
+ t.integer "line_id", :limit => 8
+ end
+ end
+
+ def down
+ drop_table :group_of_lines_lines
+ end
+end
diff --git a/db/migrate/20120525092215_create_chouette_routing_constrains_line.rb b/db/migrate/20120525092215_create_chouette_routing_constrains_line.rb
new file mode 100644
index 000000000..fa2dd2f20
--- /dev/null
+++ b/db/migrate/20120525092215_create_chouette_routing_constrains_line.rb
@@ -0,0 +1,12 @@
+class CreateChouetteRoutingConstrainsLine < ActiveRecord::Migration
+ def up
+ create_table :routing_constraints_lines, :id => false, :force => true do |t|
+ t.integer "stop_area_id", :limit => 8
+ t.integer "line_id", :limit => 8
+ end
+ end
+
+ def down
+ drop_table :routing_constraints_lines
+ end
+end
diff --git a/db/migrate/20120525092216_create_chouette_stoparea_stoparea.rb b/db/migrate/20120525092216_create_chouette_stoparea_stoparea.rb
new file mode 100644
index 000000000..42e0ee5dd
--- /dev/null
+++ b/db/migrate/20120525092216_create_chouette_stoparea_stoparea.rb
@@ -0,0 +1,12 @@
+class CreateChouetteStopareaStoparea < ActiveRecord::Migration
+ def up
+ create_table :stop_areas_stop_areas, :id => false, :force => true do |t|
+ t.integer "child_id", :limit => 8
+ t.integer "parent_id", :limit => 8
+ end
+ end
+
+ def down
+ drop_table :stop_areas_stop_areas
+ end
+end
diff --git a/db/migrate/20120531091529_create_chouette_pt_link.rb b/db/migrate/20120531091529_create_chouette_pt_link.rb
new file mode 100644
index 000000000..57b4b2e63
--- /dev/null
+++ b/db/migrate/20120531091529_create_chouette_pt_link.rb
@@ -0,0 +1,21 @@
+class CreateChouettePtLink < ActiveRecord::Migration
+def up
+ create_table "pt_links", :force => true do |t|
+ t.integer "start_of_link_id", :limit => 8
+ t.integer "end_of_link_id", :limit => 8
+ t.integer "route_id", :limit => 8
+ t.string "objectid", :null => false
+ t.integer "object_version"
+ t.datetime "creation_time"
+ t.string "creator_id"
+ t.string "name"
+ t.string "comment"
+ t.decimal "link_distance", :precision => 19, :scale => 2
+ end
+ add_index "pt_links", ["objectid"], :name => "pt_links_objectid_key", :unique => true
+ end
+
+ def down
+ drop_table :pt_links
+ end
+end
diff --git a/spec/requests/journey_pattern_spec.rb b/spec/requests/journey_pattern_spec.rb
new file mode 100644
index 000000000..7c62dd56b
--- /dev/null
+++ b/spec/requests/journey_pattern_spec.rb
@@ -0,0 +1,56 @@
+# -*- coding: utf-8 -*-
+require 'spec_helper'
+
+describe "JourneyPatterns" do
+ login_user
+
+ let!(:referential) { create(:referential).switch }
+ let!(:line) { referential; Factory(:line) }
+ let!(:route) { referential; Factory(:route, :line => line) }
+ let!(:journey_pattern) { referential; Factory(:journey_pattern, :route => route) }
+
+ describe "from routes page to a journey_pattern page" do
+ it "display route's journey_patterns" do
+ visit referential_line_route_path(referential,line,route)
+ page.should have_content(journey_pattern.name)
+ end
+ end
+ describe "from route's page to journey_pattern's page" do
+ it "display journey_pattern properties" do
+ visit referential_line_route_path(referential,line,route)
+ click_link "#{journey_pattern.name}"
+ page.should have_content(journey_pattern.published_name)
+ page.should have_content(journey_pattern.comment)
+ page.should have_content(journey_pattern.registration_number)
+ end
+ end
+ describe "from route's page, create a new journey_pattern" do
+ it "return to route's page that display new journey_pattern" do
+ visit referential_line_route_path(referential,line,route)
+ click_link "Ajouter une mission"
+ fill_in "Nom", :with => "A to B"
+ fill_in "Comment", :with => "AB"
+ click_button("Créer mission")
+ page.should have_content("A to B")
+ end
+ end
+ describe "from route's page, select a journey_pattern and edit it" do
+ it "return to route's page with changed name" do
+ visit referential_line_route_path(referential,line,route)
+ click_link "#{journey_pattern.name}"
+ click_link "Modifier cette mission"
+ fill_in "Nom", :with => "#{journey_pattern.name}-changed"
+ click_button("Modifier mission")
+ page.should have_content("#{journey_pattern.name}-changed")
+ end
+ end
+ describe "from route's page, select a journey_pattern and delete it" do
+ it "return to route's page without journey_pattern name" do
+ visit referential_line_route_path(referential,line,route)
+ click_link "#{journey_pattern.name}"
+ click_link "Supprimer cette mission"
+ page.should_not have_content(journey_pattern.name)
+ end
+ end
+end
+
diff --git a/spec/views/vehicle_journeys/_form.html.erb_spec.rb b/spec/views/vehicle_journeys/_form.html.erb_spec.rb
new file mode 100644
index 000000000..121566448
--- /dev/null
+++ b/spec/views/vehicle_journeys/_form.html.erb_spec.rb
@@ -0,0 +1,61 @@
+require 'spec_helper'
+
+describe "/vehicle_journeys/_form" do
+
+ let!(:referential) { assign :referential, create(:referential) }
+ let!(:line) { assign :line, create(:line) }
+ let!(:route) { assign :route, create(:route, :line => line) }
+ let!(:vehicle_journey) { assign :vehicle_journey, create(:vehicle_journey, :route => route) }
+
+ it "should render an input for transport_mode" do
+ render
+ rendered.should have_selector( "select", :name => "vehicle_journey[transport_mode]") do |node|
+ Chouette::Line.transport_modes.each do |mode|
+ node.should have_selector("option", :value => mode.text_code)
+ end
+ end
+ end
+
+ it "should render an input for comment" do
+ render
+ rendered.should have_selector("form") do
+ with_selector "input[type=text][comment=]", vehicle_journey.comment
+ end
+ end
+ context "stop's time view part" do
+ it "should render stop's names" do
+ render
+ rendered.should have_selector("form") do |form_node|
+ vehicle_journey.stop_points.each do |sp|
+ form_node.with_selector "label", :text => sp.stop_area.name
+ end
+ end
+ end
+ it "should render vehicle_journey_at_stop's departure time" do
+ render
+ rendered.should have_selector("form") do |form_node|
+ vehicle_journey.stop_points.each_with_index do |sp, index|
+ form_node.with_selector "select", :name => "vehicle_journey[vehicle_journey_at_stops_attributes][#{index}][departure_time(4i)]"
+ form_node.with_selector "select", :name => "vehicle_journey[vehicle_journey_at_stops_attributes][#{index}][departure_time(5i)]"
+ end
+ end
+ end
+ end
+ context "when existing vehicle_journey" do
+ it "should display objectid not as an input" do
+ render
+ rendered.should have_selector("form li", :text => vehicle_journey.objectid)
+ end
+ end
+ context "when new vehicle_journey" do
+ let!(:vehicle_journey) { assign :vehicle_journey, build(:vehicle_journey, :route => route) }
+ it "should render an input for objectid" do
+ render
+ rendered.should have_selector("form") do
+ with_selector "input[type=text][objectid=]", vehicle_journey.objectid
+ end
+ end
+ end
+
+end
+