aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichel Etienne2012-06-27 23:07:40 +0200
committerMichel Etienne2012-06-27 23:07:40 +0200
commit56de2324949f9035ccb30f0ddbf86a2b6b3aebc3 (patch)
tree26f456bd95108d4eb56ab42b8f76b3191c87ae3a
parentc62096215aa1b98f79e81ea8a1271814d14d6ca0 (diff)
parente23bf6c2789b174d7ce847270f45d15b8633000c (diff)
downloadchouette-core-56de2324949f9035ccb30f0ddbf86a2b6b3aebc3.tar.bz2
Merge branch 'master' of chouette.dryade.priv:/srv/git/chouette2
-rw-r--r--Gemfile11
-rw-r--r--Gemfile.lock15
-rw-r--r--app/assets/javascripts/application.js3
-rw-r--r--app/assets/javascripts/jquery.ui.datepicker-i18n.js47
-rw-r--r--app/assets/stylesheets/application.css1
-rw-r--r--app/assets/stylesheets/formtastic.css145
-rw-r--r--app/assets/stylesheets/formtastic_changes.css14
-rw-r--r--app/assets/stylesheets/stop_points.css.scss8
-rw-r--r--app/assets/stylesheets/vehicle_journeys.css.scss22
-rw-r--r--app/controllers/journey_patterns_controller.rb8
-rw-r--r--app/controllers/vehicle_journeys_controller.rb17
-rw-r--r--app/helpers/vehicle_journeys_helper.rb32
-rw-r--r--app/views/companies/_form.erb9
-rw-r--r--app/views/connection_links/_form.erb9
-rw-r--r--app/views/connection_links/select_areas.html.erb9
-rw-r--r--app/views/journey_patterns/_form.html.erb9
-rw-r--r--app/views/layouts/application.html.erb2
-rw-r--r--app/views/lines/_form.erb9
-rw-r--r--app/views/networks/_form.erb9
-rw-r--r--app/views/referentials/_form.erb12
-rw-r--r--app/views/routes/_form.html.erb9
-rw-r--r--app/views/stop_areas/_form.html.erb8
-rw-r--r--app/views/stop_areas/add_children.html.erb9
-rw-r--r--app/views/stop_areas/select_parent.html.erb9
-rw-r--r--app/views/stop_points/index.html.erb7
-rw-r--r--app/views/stop_points/new.html.erb9
-rw-r--r--app/views/time_table_dates/_form.html.erb10
-rw-r--r--app/views/time_table_periods/_form.html.erb9
-rw-r--r--app/views/time_tables/_form.erb9
-rw-r--r--app/views/vehicle_journeys/_form.html.erb28
-rw-r--r--app/views/vehicle_journeys/_time_filter.html.erb11
-rw-r--r--app/views/vehicle_journeys/_vehicle_journey_at_stop_fields.html.erb6
-rw-r--r--app/views/vehicle_journeys/index.html.erb57
-rw-r--r--app/views/vehicle_journeys/new.js.erb11
-rw-r--r--app/views/vehicle_journeys/show.html.erb4
-rw-r--r--config/locales/formtastic.yml10
-rw-r--r--config/locales/fr.yml4
-rw-r--r--config/locales/vehicle_journeys.yml14
-rw-r--r--config/routes.rb6
-rw-r--r--doc/mockups/import-data-index.bmml149
-rw-r--r--doc/mockups/import-data-index.pngbin0 -> 76403 bytes
-rw-r--r--doc/mockups/imports-vehiculejourneyatstops-index.bmml222
-rw-r--r--doc/mockups/imports-vehiculejourneyatstops-index.pngbin0 -> 58808 bytes
-rw-r--r--spec/controllers/routes_controller_spec.rb3
-rw-r--r--spec/controllers/stop_points_controller_spec.rb3
-rw-r--r--spec/factories.rb5
-rw-r--r--spec/requests/companies_spec.rb3
-rw-r--r--spec/requests/connection_links_spec.rb3
-rw-r--r--spec/requests/journey_pattern_spec.rb1
-rw-r--r--spec/requests/lines_spec.rb1
-rw-r--r--spec/requests/networks_spec.rb3
-rw-r--r--spec/requests/routes_spec.rb1
-rw-r--r--spec/requests/stop_areas_spec.rb3
-rw-r--r--spec/requests/stop_points_spec.rb7
-rw-r--r--spec/requests/time_tables_spec.rb3
-rw-r--r--spec/spec_helper.rb27
-rw-r--r--spec/support/referential.rb39
-rw-r--r--spec/views/companies/edit.html.erb_spec.rb2
-rw-r--r--spec/views/companies/index.html.erb_spec.rb2
-rw-r--r--spec/views/companies/new.html.erb_spec.rb2
-rw-r--r--spec/views/companies/show.html.erb_spec.rb2
-rw-r--r--spec/views/connection_links/edit.html.erb_spec.rb2
-rw-r--r--spec/views/connection_links/index.html.erb_spec.rb2
-rw-r--r--spec/views/connection_links/new.html.erb_spec.rb2
-rw-r--r--spec/views/connection_links/show.html.erb_spec.rb2
-rw-r--r--spec/views/imports/new.html.erb_spec.rb2
-rw-r--r--spec/views/lines/edit.html.erb_spec.rb2
-rw-r--r--spec/views/lines/index.html.erb_spec.rb2
-rw-r--r--spec/views/lines/new.html.erb_spec.rb2
-rw-r--r--spec/views/lines/show.html.erb_spec.rb2
-rw-r--r--spec/views/networks/edit.html.erb_spec.rb2
-rw-r--r--spec/views/networks/index.html.erb_spec.rb2
-rw-r--r--spec/views/networks/new.html.erb_spec.rb2
-rw-r--r--spec/views/networks/show.html.erb_spec.rb2
-rw-r--r--spec/views/referentials/new.html.erb_spec.rb2
-rw-r--r--spec/views/referentials/show.html.erb_spec.rb2
-rw-r--r--spec/views/routes/show.html.erb_spec.rb2
-rw-r--r--spec/views/stop_areas/edit.html.erb_spec.rb2
-rw-r--r--spec/views/stop_areas/index.html.erb_spec.rb2
-rw-r--r--spec/views/stop_areas/new.html.erb_spec.rb2
-rw-r--r--spec/views/stop_areas/show.html.erb_spec.rb2
-rw-r--r--spec/views/time_tables/edit.html.erb_spec.rb2
-rw-r--r--spec/views/time_tables/index.html.erb_spec.rb2
-rw-r--r--spec/views/time_tables/new.html.erb_spec.rb2
-rw-r--r--spec/views/time_tables/show.html.erb_spec.rb2
-rw-r--r--spec/views/vehicle_journeys/_form.html.erb_spec.rb8
-rw-r--r--spec/views/vehicle_journeys/_vehicle_journey_at_stop_fields.html.erb_spec.rb6
-rw-r--r--spec/views/vehicle_journeys/edit.html.erb_spec.rb2
-rw-r--r--spec/views/vehicle_journeys/new.html.erb_spec.rb2
89 files changed, 761 insertions, 407 deletions
diff --git a/Gemfile b/Gemfile
index a49bb494a..a1414957c 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,7 +1,6 @@
source 'http://rubygems.org'
gem 'rails', '3.1.3'
-gem 'jquery-rails'
gem 'devise'
gem "ffi-proj4", :git => 'git://github.com/dryade/ffi-proj4.git'
@@ -10,6 +9,7 @@ platforms :jruby do
gem 'activerecord-jdbcpostgresql-adapter', :git => 'git://github.com/dryade/activerecord-jdbc-adapter.git'
gem 'activerecord-jdbcsqlite3-adapter'
gem 'jruby-openssl'
+ gem "jruby-rack-worker"
gem 'warbler'
gem "jruby-rack-worker"
end
@@ -26,21 +26,22 @@ gem "georuby-ext", :git => 'git://github.com/dryade/georuby-ext.git'
gem 'user_interface', :git => 'git://sim.dryade.priv/user_interface'
gem 'json'
gem 'cocoon'
-gem 'formtastic', '2.0.2'
+gem 'formtastic'
gem 'inherited_resources'
gem 'will_paginate', '~> 3.0'
-# gem 'will-paginate-i18n','~> 0.1.5'
gem 'ransack'
gem 'squeel'
gem 'RedCloth'
+gem 'jquery-rails'
+gem 'modernizr'
gem "acts_as_tree", :git => "git://github.com/dryade/acts_as_tree.git"
-gem 'apartment', :git => 'git://github.com/dryade/apartment.git'
gem 'ninoxe', :git => 'git://chouette.dryade.priv/ninoxe' #, :path => '~/Projects/Ninoxe'
gem 'acts_as_list', '0.1.6'
-gem 'composite_primary_keys', '4.1.2'
+gem 'composite_primary_keys', '4.1.2'
gem 'delayed_job_active_record'
+gem 'apartment',:git => 'git://github.com/dryade/apartment.git'
# Gems used only for assets and not required
# in production environments by default.
diff --git a/Gemfile.lock b/Gemfile.lock
index ea51bb146..97f1ed577 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -1,6 +1,6 @@
GIT
remote: git://chouette.dryade.priv/ninoxe
- revision: d9c03d4ae42f1bc229949504f0002954b3f6caee
+ revision: f9c6b5bde626d60b5a902ecc73e0469832864d52
specs:
ninoxe (0.0.8)
GeoRuby
@@ -69,7 +69,7 @@ GIT
GIT
remote: git://sim.dryade.priv/user_interface
- revision: c75665070cace889923bea6a0fb1f7ff724d1368
+ revision: 5302812852d2bd28ae29e49bc0d64a3bfb61fbc9
specs:
user_interface (0.0.1)
rails (~> 3.1.0)
@@ -169,8 +169,8 @@ GEM
ffi (1.0.11-java)
ffi-geos (0.0.4)
ffi (~> 1.0.0)
- formtastic (2.0.2)
- rails (~> 3.0)
+ formtastic (2.2.1)
+ actionpack (>= 3.0)
geokit (1.6.5)
multi_json
georuby (1.9.7)
@@ -217,7 +217,9 @@ GEM
mime-types (~> 1.16)
treetop (~> 1.4.8)
map_layers (0.0.5)
- mime-types (1.18)
+ mime-types (1.19)
+ modernizr (2.5.3)
+ sprockets (~> 2.0)
multi_json (1.3.6)
net-scp (1.0.4)
net-ssh (>= 1.99.1)
@@ -368,7 +370,7 @@ DEPENDENCIES
devise
factory_girl_rails (= 1.7)
ffi-proj4!
- formtastic (= 2.0.2)
+ formtastic
georuby-ext!
guard
guard-rspec
@@ -379,6 +381,7 @@ DEPENDENCIES
json
launchy
map_layers (~> 0.0.4)
+ modernizr
ninoxe!
pg (~> 0.11.0)
rails (= 3.1.3)
diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js
index ebe1bb0e4..86507b03e 100644
--- a/app/assets/javascripts/application.js
+++ b/app/assets/javascripts/application.js
@@ -7,5 +7,6 @@
//= require jquery
//= require jquery_ujs
//= require jquery-ui
+//= require modernizr
+//= require cocoon
//= require_tree .
-//= require cocoon \ No newline at end of file
diff --git a/app/assets/javascripts/jquery.ui.datepicker-i18n.js b/app/assets/javascripts/jquery.ui.datepicker-i18n.js
new file mode 100644
index 000000000..637c7b999
--- /dev/null
+++ b/app/assets/javascripts/jquery.ui.datepicker-i18n.js
@@ -0,0 +1,47 @@
+/* French initialisation for the jQuery UI date picker plugin. */
+/* Written by Keith Wood (kbwood{at}iinet.com.au) and Stéphane Nahmani (sholby@sholby.net). */
+jQuery(function($){
+
+ $.datepicker.regional['fr'] = {
+ closeText: 'Fermer',
+ prevText: '<Préc',
+ nextText: 'Suiv>',
+ currentText: 'Courant',
+ monthNames: ['Janvier','Février','Mars','Avril','Mai','Juin',
+ 'Juillet','Août','Septembre','Octobre','Novembre','Décembre'],
+ monthNamesShort: ['Jan','Fév','Mar','Avr','Mai','Jun',
+ 'Jul','Aoû','Sep','Oct','Nov','Déc'],
+ dayNames: ['Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi'],
+ dayNamesShort: ['Dim','Lun','Mar','Mer','Jeu','Ven','Sam'],
+ dayNamesMin: ['Di','Lu','Ma','Me','Je','Ve','Sa'],
+ weekHeader: 'Sm',
+ dateFormat: 'dd/mm/yy',
+ firstDay: 1,
+ isRTL: false,
+ showMonthAfterYear: false,
+ yearSuffix: ''};
+
+ $.datepicker.regional['en'] = {
+ closeText: 'Done',
+ prevText: 'Prev',
+ nextText: 'Next',
+ currentText: 'Today',
+ monthNames: ['January','February','March','April','May','June',
+ 'July','August','September','October','November','December'],
+ monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
+ 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
+ dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
+ dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
+ dayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'],
+ weekHeader: 'Wk',
+ dateFormat: 'dd/mm/yy',
+ firstDay: 1,
+ isRTL: false,
+ showMonthAfterYear: false,
+ yearSuffix: ''};
+
+ $.datepicker.setDefaults($.datepicker.regional[ "" ]);
+ $("input[type='date']").datepicker( $.datepicker.regional[ "fr" ] );
+ $("input[type='date']").datepicker( "option", $.datepicker.regional[ $('html').attr('lang') ] );
+
+});
diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css
index b17893104..7a73fd3fe 100644
--- a/app/assets/stylesheets/application.css
+++ b/app/assets/stylesheets/application.css
@@ -3,6 +3,7 @@
* and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
* the top of the compiled file, but it's generally better to create a new file per style scope.
*= require_self
+ *= require formtastic
*= require jquery-ui
*= require_tree .
*/ \ No newline at end of file
diff --git a/app/assets/stylesheets/formtastic.css b/app/assets/stylesheets/formtastic.css
deleted file mode 100644
index 91540c74b..000000000
--- a/app/assets/stylesheets/formtastic.css
+++ /dev/null
@@ -1,145 +0,0 @@
-/* -------------------------------------------------------------------------------------------------
-
-It's *strongly* suggested that you don't modify this file. Instead, load a new stylesheet after
-this one in your layouts (eg formtastic_changes.css) and override the styles to suit your needs.
-This will allow you to update formtastic.css with new releases without clobbering your own changes.
-
-This stylesheet forms part of the Formtastic Rails Plugin
-(c) 2008 Justin French
-
---------------------------------------------------------------------------------------------------*/
-
-
-/* NORMALIZE AND RESET - obviously inspired by Yahoo's reset.css, but scoped to just form.formtastic
---------------------------------------------------------------------------------------------------*/
-form.formtastic, form.formtastic ul, form.formtastic ol, form.formtastic li, form.formtastic fieldset, form.formtastic legend, form.formtastic input, form.formtastic textarea, form.formtastic select, form.formtastic p { margin:0; padding:0; }
-form.formtastic fieldset { border:0; }
-form.formtastic em, form.formtastic strong { font-style:normal; font-weight:normal; }
-form.formtastic ol, form.formtastic ul { list-style:none; }
-form.formtastic abbr, form.formtastic acronym { border:0; font-variant:normal; }
-form.formtastic input, form.formtastic textarea, form.formtastic select { font-family:inherit; font-size:inherit; font-weight:inherit; }
-form.formtastic input, form.formtastic textarea, form.formtastic select { font-size:100%; }
-form.formtastic legend { white-space:normal; color:#000; }
-
-
-/* SEMANTIC ERRORS
---------------------------------------------------------------------------------------------------*/
-form.formtastic ul.errors { color:#cc0000; margin:0.5em 0 1.5em 25%; list-style:square; }
-form.formtastic ul.errors li { padding:0; border:none; display:list-item; }
-
-
-/* FIELDSETS & LISTS
---------------------------------------------------------------------------------------------------*/
-form.formtastic fieldset { overflow:auto; } /* clearing contained floats */
-form.formtastic fieldset.inputs { }
-form.formtastic fieldset.buttons { padding-left:25%; }
-form.formtastic fieldset ol { }
-form.formtastic fieldset.buttons li { float:left; padding-right:0.5em; }
-
-/* INPUT LIs
---------------------------------------------------------------------------------------------------*/
-form.formtastic fieldset > ol > li { padding:0.5em 0; margin-top:-0.5em; margin-bottom:1em; } /* padding and negative margin juggling is for Firefox */
-form.formtastic fieldset > ol > li { overflow:auto; } /* clearing contained floats */
-
-form.formtastic fieldset > ol > li.required { }
-form.formtastic fieldset > ol > li.optional { }
-form.formtastic fieldset > ol > li.error { }
-
-
-/* LABELS
---------------------------------------------------------------------------------------------------*/
-form.formtastic fieldset > ol > li label { display:block; width:25%; float:left; padding-top:.2em; }
-form.formtastic fieldset > ol > li > li label { line-height:100%; padding-top:0; }
-form.formtastic fieldset > ol > li > li label input { line-height:100%; vertical-align:middle; margin-top:-0.1em;}
-
-
-/* NESTED FIELDSETS AND LEGENDS (radio, check boxes and date/time inputs use nested fieldsets)
---------------------------------------------------------------------------------------------------*/
-form.formtastic fieldset > ol > li fieldset { position:relative; }
-form.formtastic fieldset > ol > li fieldset legend { position:absolute; width:95%; padding-top:0.1em; left: 0px; }
-form.formtastic fieldset > ol > li fieldset legend span { position:absolute; }
-form.formtastic fieldset > ol > li fieldset legend.label label { position:absolute; }
-form.formtastic fieldset > ol > li fieldset ol { float:left; width:74%; margin:0; padding:0 0 0 25%; }
-form.formtastic fieldset > ol > li fieldset ol li { padding:0; border:0; }
-
-
-/* INLINE HINTS
---------------------------------------------------------------------------------------------------*/
-form.formtastic fieldset > ol > li p.inline-hints { color:#666; margin:0.5em 0 0 25%; }
-
-
-/* INLINE ERRORS
---------------------------------------------------------------------------------------------------*/
-form.formtastic fieldset > ol > li p.inline-errors { color:#cc0000; margin:0.5em 0 0 25%; }
-form.formtastic fieldset > ol > li ul.errors { color:#cc0000; margin:0.5em 0 0 25%; list-style:square; }
-form.formtastic fieldset > ol > li ul.errors li { padding:0; border:none; display:list-item; }
-
-
-/* STRING, NUMERIC, PASSWORD, EMAIL, URL, PHONE & SEARCH OVERRIDES
---------------------------------------------------------------------------------------------------*/
-form.formtastic fieldset > ol > li.string input,
-form.formtastic fieldset > ol > li.password input,
-form.formtastic fieldset > ol > li.numeric input,
-form.formtastic fieldset > ol > li.email input,
-form.formtastic fieldset > ol > li.url input,
-form.formtastic fieldset > ol > li.phone input,
-form.formtastic fieldset > ol > li.search input { width:72%; }
-
-form.formtastic fieldset > ol > li.string input[size],
-form.formtastic fieldset > ol > li.password input[size],
-form.formtastic fieldset > ol > li.numeric input[size],
-form.formtastic fieldset > ol > li.email input[size],
-form.formtastic fieldset > ol > li.url input[size],
-form.formtastic fieldset > ol > li.phone input[size],
-form.formtastic fieldset > ol > li.search input[size] { width:auto; max-width:72%; }
-
-
-/* TEXTAREA OVERRIDES
---------------------------------------------------------------------------------------------------*/
-form.formtastic fieldset > ol > li.text textarea { width:72%; }
-form.formtastic fieldset > ol > li.text textarea[cols] { width:auto; max-width:72%; }
-
-
-/* HIDDEN OVERRIDES
---------------------------------------------------------------------------------------------------*/
-form.formtastic fieldset ol li.hidden { display:none; }
-
-/* BOOLEAN OVERRIDES
---------------------------------------------------------------------------------------------------*/
-form.formtastic fieldset > ol > li.boolean label { padding-left:25%; width:auto; }
-form.formtastic fieldset > ol > li.boolean label input { margin:0 0.5em 0 0.2em; }
-
-
-/* RADIO OVERRIDES
---------------------------------------------------------------------------------------------------*/
-form.formtastic fieldset > ol > li.radio { }
-form.formtastic fieldset > ol > li.radio fieldset { overflow:visible; }
-form.formtastic fieldset > ol > li.radio fieldset ol { margin-bottom:-0.5em; }
-form.formtastic fieldset > ol > li.radio fieldset ol li { margin:0.1em 0 0.5em 0; overflow:visible; }
-form.formtastic fieldset > ol > li.radio fieldset ol li label { float:none; width:100%; }
-form.formtastic fieldset > ol > li.radio fieldset ol li label input { margin-right:0.2em; }
-
-
-/* CHECK BOXES (COLLECTION) OVERRIDES
---------------------------------------------------------------------------------------------------*/
-form.formtastic fieldset > ol > li.check_boxes { }
-form.formtastic fieldset > ol > li.check_boxes fieldset { overflow:visible; }
-form.formtastic fieldset > ol > li.check_boxes fieldset ol { margin-bottom:-0.5em; }
-form.formtastic fieldset > ol > li.check_boxes fieldset ol li { margin:0.1em 0 0.5em 0; overflow:visible; }
-form.formtastic fieldset > ol > li.check_boxes fieldset ol li label { float:none; width:100%; }
-form.formtastic fieldset > ol > li.check_boxes fieldset ol li label input { margin-right:0.2em; }
-
-
-/* DATE & TIME OVERRIDES
---------------------------------------------------------------------------------------------------*/
-form.formtastic fieldset > ol > li.date fieldset ol li,
-form.formtastic fieldset > ol > li.time fieldset ol li,
-form.formtastic fieldset > ol > li.datetime fieldset ol li { float:left; width:auto; margin:0 .3em 0 0; }
-
-form.formtastic fieldset > ol > li.date fieldset ol li label,
-form.formtastic fieldset > ol > li.time fieldset ol li label,
-form.formtastic fieldset > ol > li.datetime fieldset ol li label { display:none; }
-
-form.formtastic fieldset > ol > li.date fieldset ol li label input,
-form.formtastic fieldset > ol > li.time fieldset ol li label input,
-form.formtastic fieldset > ol > li.datetime fieldset ol li label input { display:inline; margin:0; padding:0; }
diff --git a/app/assets/stylesheets/formtastic_changes.css b/app/assets/stylesheets/formtastic_changes.css
deleted file mode 100644
index 8a044fab6..000000000
--- a/app/assets/stylesheets/formtastic_changes.css
+++ /dev/null
@@ -1,14 +0,0 @@
-/* -------------------------------------------------------------------------------------------------
-
-Load this stylesheet after formtastic.css in your layouts to override the CSS to suit your needs.
-This will allow you to update formtastic.css with new releases without clobbering your own changes.
-
-For example, to make the inline hint paragraphs a little darker in color than the standard #666:
-
-form.formtastic fieldset > ol > li p.inline-hints { color:#333; }
-
-HINT:
-The following style may be *conditionally* included for improved support on older versions of IE(<8)
-form.formtastic fieldset ol li fieldset legend { margin-left: -6px;}
-
---------------------------------------------------------------------------------------------------*/
diff --git a/app/assets/stylesheets/stop_points.css.scss b/app/assets/stylesheets/stop_points.css.scss
index 73fc22aef..939ac1070 100644
--- a/app/assets/stylesheets/stop_points.css.scss
+++ b/app/assets/stylesheets/stop_points.css.scss
@@ -15,14 +15,8 @@
.stop_points:after {
@include content_to_clear;
}
-
- .formtastic .buttons {
- a {
- margin-top: 0px;
- }
- }
- .stop_point {
+ #sortable_stop_points .stop_point {
@include div_for_object;
/* to create multi-column index */
width: 350px;
diff --git a/app/assets/stylesheets/vehicle_journeys.css.scss b/app/assets/stylesheets/vehicle_journeys.css.scss
index 0bfabc38b..1a6917306 100644
--- a/app/assets/stylesheets/vehicle_journeys.css.scss
+++ b/app/assets/stylesheets/vehicle_journeys.css.scss
@@ -3,19 +3,16 @@
// You can use Sass (SCSS) here: http://sass-lang.com/
@import "common";
-#workspace.vehicle_journeys.edit, #workspace.vehicle_journeys.new
+#workspace.vehicle_journeys.edit, #workspace.vehicle_journeys.update, #workspace.vehicle_journeys.create, #workspace.vehicle_journeys.new
{
#route_color{ width: 100px;
color: white;
font-weight: bold;}
.journey_pattern_dependent_list {
- tr.no_stop {
- display: none;
- }
- }
- .time_table_list {
- padding-left: 25%;
+ tr.no_stop { display: none; }
}
+ .time_table_list { padding-left: 25%; }
+ .vehicle_journey_at_stops { margin-left: 25%; }
}
#workspace.vehicle_journeys.index
@@ -49,11 +46,15 @@
text-align: center;
}
- td.hours{
+ td.hours {
font-size: 12px;
color: #516a29;
}
+ td.missing {
+ background-color: orange;
+ }
+
td.stop_area{
text-align: left;
font-size: 12px;
@@ -63,7 +64,7 @@
}
-#workspace.vehicle_journeys.show, #workspace.vehicle_journeys.edit {
+#workspace.vehicle_journeys.show, #workspace.vehicle_journeys.edit, #workspace.vehicle_journeys.update, #workspace.vehicle_journeys.create, #workspace.vehicle_journeys.new {
.vehicle_journey_at_stops {
thead {
th { text-align: center; }
@@ -75,6 +76,9 @@
}
tbody {
td.hour { text-align: center; }
+ td.departure_time, td.arrival_time { padding-left: 15px; }
+ td.missing { background-color: orange; }
+ td.invalid_position { background-color: red; }
tr label { width: 100% }
tr.odd { }
tr.even { background-color: #DEFFA8; }
diff --git a/app/controllers/journey_patterns_controller.rb b/app/controllers/journey_patterns_controller.rb
index 1ec15f7e8..d8611d6f9 100644
--- a/app/controllers/journey_patterns_controller.rb
+++ b/app/controllers/journey_patterns_controller.rb
@@ -2,6 +2,7 @@ class JourneyPatternsController < ChouetteController
defaults :resource_class => Chouette::JourneyPattern
respond_to :html
+ respond_to :js, :only => [:new_vehicle_journey]
belongs_to :referential do
belongs_to :line, :parent_class => Chouette::Line do
@@ -16,4 +17,11 @@ class JourneyPatternsController < ChouetteController
@stop_points = resource.stop_points.paginate(:page => params[:page], :per_page => 10)
show!
end
+
+ def new_vehicle_journey
+ puts resource.inspect
+ @vehicle_journey = Chouette::VehicleJourney.new(:route_id => route.id)
+ @vehicle_journey.update_journey_pattern(resource)
+ render "vehicle_journeys/select_journey_pattern"
+ end
end
diff --git a/app/controllers/vehicle_journeys_controller.rb b/app/controllers/vehicle_journeys_controller.rb
index 596a7f90c..9248f88de 100644
--- a/app/controllers/vehicle_journeys_controller.rb
+++ b/app/controllers/vehicle_journeys_controller.rb
@@ -1,7 +1,7 @@
class VehicleJourneysController < ChouetteController
defaults :resource_class => Chouette::VehicleJourney
- respond_to :js, :only => [:select_journey_pattern, :edit]
+ respond_to :js, :only => [:select_journey_pattern, :edit, :new]
belongs_to :referential do
belongs_to :line, :parent_class => Chouette::Line do
@@ -18,6 +18,21 @@ class VehicleJourneysController < ChouetteController
end
end
+ def create
+ create!(:alert => t('activerecord.errors.models.vehicle_journey.invalid_times'))
+ end
+
+ def update
+ update!(:alert => t('activerecord.errors.models.vehicle_journey.invalid_times'))
+ end
+
+ def new
+ @vehicle_journey = Chouette::VehicleJourney.new( :route => @route)
+ @vehicle_journey.update_journey_pattern( parent.journey_patterns.first) if parent.journey_patterns.first
+
+ new!
+ end
+
protected
alias_method :vehicle_journey, :resource
diff --git a/app/helpers/vehicle_journeys_helper.rb b/app/helpers/vehicle_journeys_helper.rb
index 34b367424..e45978023 100644
--- a/app/helpers/vehicle_journeys_helper.rb
+++ b/app/helpers/vehicle_journeys_helper.rb
@@ -1,11 +1,39 @@
module VehicleJourneysHelper
+ def journey_name( journey_pattern)
+ if !journey_pattern.published_name.blank?
+ journey_pattern.published_name.first(8)
+ elsif !journey_pattern.name.blank?
+ journey_pattern.name.first(8)
+ else
+ journey_pattern.id
+ end
+ end
+ def vehicle_name( vehicle)
+ if !vehicle.published_journey_name.blank?
+ vehicle.published_journey_name.first(8)
+ elsif !vehicle.published_journey_identifier.blank?
+ vehicle.published_journey_identifier.first(8)
+ elsif !vehicle.number.blank?
+ vehicle.number
+ else
+ vehicle.id
+ end
+ end
+ def missing_time_check( is_present)
+ return "missing" if (is_present && is_present.departure_time.nil?)
+ end
+ def vehicle_departure(vehicle)
+ first_vjas = vehicle.vehicle_journey_at_stops.first
+ return "" unless first_vjas.departure_time
+ l(first_vjas.departure_time, :format => :hour).gsub( / /, ' ')
+ end
def vehicle_title( vehicle)
return t('vehicle_journeys.vehicle_journey.title_stopless') if vehicle.vehicle_journey_at_stops.empty?
first_vjas = vehicle.vehicle_journey_at_stops.first
t('vehicle_journeys.vehicle_journey.title',
:name => vehicle.published_journey_name,
:stop => first_vjas.stop_point.stop_area.name,
- :time => l(first_vjas.departure_time, :format => :hour)).gsub( / /, ' ')
+ :time => vehicle_departure(vehicle))
end
def edit_vehicle_title( vehicle)
return t('vehicle_journeys.edit.title_stopless') if vehicle.vehicle_journey_at_stops.empty?
@@ -13,7 +41,7 @@ module VehicleJourneysHelper
t('vehicle_journeys.edit.title',
:name => vehicle.published_journey_name,
:stop => first_vjas.stop_point.stop_area.name,
- :time => l(first_vjas.departure_time, :format => :hour)).gsub( / /, ' ')
+ :time => vehicle_departure(vehicle))
end
end
diff --git a/app/views/companies/_form.erb b/app/views/companies/_form.erb
index bea95b0b4..d7274cbd9 100644
--- a/app/views/companies/_form.erb
+++ b/app/views/companies/_form.erb
@@ -19,9 +19,8 @@
<% end %>
<% end %>
- <%= form.buttons do %>
- <%= form.commit_button true %>
- <li><%= t('or') %></li>
- <li><%= link_to t('cancel'), :back %></li>
- <% end %>
+ <%= form.actions do %>
+ <%= form.action :submit, :as => :button %>
+ <%= form.action :cancel, :as => :link %>
+ <% end %>
<% end %>
diff --git a/app/views/connection_links/_form.erb b/app/views/connection_links/_form.erb
index 31c3e3bde..50abadce7 100644
--- a/app/views/connection_links/_form.erb
+++ b/app/views/connection_links/_form.erb
@@ -23,9 +23,8 @@
<% end %>
<% end %>
- <%= form.buttons do %>
- <%= form.commit_button true %>
- <li><%= t('or') %></li>
- <li><%= link_to t('cancel'), :back %></li>
- <% end %>
+ <%= form.actions do %>
+ <%= form.action :submit, :as => :button %>
+ <%= form.action :cancel, :as => :link %>
+ <% end %>
<% end %>
diff --git a/app/views/connection_links/select_areas.html.erb b/app/views/connection_links/select_areas.html.erb
index 2df3831b4..6c6f4dedf 100644
--- a/app/views/connection_links/select_areas.html.erb
+++ b/app/views/connection_links/select_areas.html.erb
@@ -7,11 +7,10 @@
<%= form.input :arrival_id, :as => :text, :input_html => { :"data-pre" => ( @arrival.present? ? [ { :id => @arrival.id.to_s, :name => "#{@arrival.name} [#{@arrival.country_code}]" } ]: [] ).to_json } %>
<% end %>
- <%= form.buttons do %>
- <%= form.commit_button %>
- <%= t('or') %>
- <%= link_to t('cancel'), [@referential, @connection_link] %>
- <% end %>
+ <%= form.actions do %>
+ <%= form.action :submit, :as => :button %>
+ <%= form.action :cancel, :as => :link %>
+ <% end %>
</div>
<% end %>
diff --git a/app/views/journey_patterns/_form.html.erb b/app/views/journey_patterns/_form.html.erb
index b6c37ab1b..850998830 100644
--- a/app/views/journey_patterns/_form.html.erb
+++ b/app/views/journey_patterns/_form.html.erb
@@ -15,10 +15,9 @@
<% end %>
<% end %>
- <%= form.buttons do %>
- <%= form.commit_button true %>
- <li><%= t('or') %></li>
- <li><%= link_to t('cancel'), :back %></li>
- <% end %>
+ <%= form.actions do %>
+ <%= form.action :submit, :as => :button %>
+ <%= form.action :cancel, :as => :link %>
+ <% end %>
<% end %>
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
index bf3c20694..a40159079 100644
--- a/app/views/layouts/application.html.erb
+++ b/app/views/layouts/application.html.erb
@@ -1,5 +1,5 @@
<!DOCTYPE html>
-<html>
+<html lang="<%= I18n.locale %>">
<head>
<title>Chouette V2 - <%= title %></title>
<%= stylesheet_link_tag :application %>
diff --git a/app/views/lines/_form.erb b/app/views/lines/_form.erb
index ed0e4f9a2..400c68b7c 100644
--- a/app/views/lines/_form.erb
+++ b/app/views/lines/_form.erb
@@ -19,9 +19,8 @@
<% end %>
<% end %>
- <%= form.buttons do %>
- <%= form.commit_button true %>
- <li><%= t('or') %></li>
- <li><%= link_to t('cancel'), :back %></li>
- <% end %>
+ <%= form.actions do %>
+ <%= form.action :submit, :as => :button %>
+ <%= form.action :cancel, :as => :link %>
+ <% end %>
<% end %>
diff --git a/app/views/networks/_form.erb b/app/views/networks/_form.erb
index 32c131ca3..cf1764136 100644
--- a/app/views/networks/_form.erb
+++ b/app/views/networks/_form.erb
@@ -17,9 +17,8 @@
<% end %>
<% end %>
- <%= form.buttons do %>
- <%= form.commit_button %>
- <li><%= t('or') %></li>
- <li><%= link_to t('cancel'), :back %></li>
- <% end %>
+ <%= form.actions do %>
+ <%= form.action :submit, :as => :button %>
+ <%= form.action :cancel, :as => :link %>
+ <% end %>
<% end %>
diff --git a/app/views/referentials/_form.erb b/app/views/referentials/_form.erb
index c82649909..d794d828c 100644
--- a/app/views/referentials/_form.erb
+++ b/app/views/referentials/_form.erb
@@ -16,12 +16,10 @@
<% if @referential.new_record? %>
<%= form.input :resources, :as => :file %>
<% end %>
- <% end %>
+ <% end %>
-
- <%= form.buttons do %>
- <%= form.commit_button true %>
- <li><%= t('or') %></li>
- <li><%= link_to t('back'), :back %></li>
- <% end %>
+ <%= form.actions do %>
+ <%= form.action :submit, :as => :button %>
+ <%= form.action :cancel, :as => :link %>
+ <% end %>
<% end %>
diff --git a/app/views/routes/_form.html.erb b/app/views/routes/_form.html.erb
index 96a681b13..5b383a9d9 100644
--- a/app/views/routes/_form.html.erb
+++ b/app/views/routes/_form.html.erb
@@ -17,10 +17,9 @@
<% end %>
<% end %>
- <%= form.buttons do %>
- <%= form.commit_button true %>
- <li><%= t('or') %></li>
- <li><%= link_to t('cancel'), :back %></li>
- <% end %>
+ <%= form.actions do %>
+ <%= form.action :submit, :as => :button %>
+ <%= form.action :cancel, :as => :link %>
+ <% end %>
<% end %>
diff --git a/app/views/stop_areas/_form.html.erb b/app/views/stop_areas/_form.html.erb
index 81878101a..c4d4c5797 100644
--- a/app/views/stop_areas/_form.html.erb
+++ b/app/views/stop_areas/_form.html.erb
@@ -27,8 +27,8 @@
<%= form.input :latitude %>
<% end %>
- <%= form.buttons do %>
- <%= form.commit_button %>
- ou <%= link_to t('cancel'), [@referential, @stop_area] %>
- <% end %>
+ <%= form.actions do %>
+ <%= form.action :submit, :as => :button %>
+ <%= form.action :cancel, :as => :link %>
+ <% end %>
<% end %>
diff --git a/app/views/stop_areas/add_children.html.erb b/app/views/stop_areas/add_children.html.erb
index ff3323dab..6f637086c 100644
--- a/app/views/stop_areas/add_children.html.erb
+++ b/app/views/stop_areas/add_children.html.erb
@@ -6,11 +6,10 @@
<%= form.input :children_ids, :as => :text, :input_html => { :"data-pre" => ( @children.map { |child| { :id => child.id.to_s, :name => "#{child.name} #{child.country_code}" } } ).to_json } %>
<% end %>
- <%= form.buttons do %>
- <%= form.commit_button %>
- <%= t('or') %>
- <%= link_to t('cancel'), [@referential, @stop_area] %>
- <% end %>
+ <%= form.actions do %>
+ <%= form.action :submit, :as => :button %>
+ <%= form.action :cancel, :as => :link %>
+ <% end %>
</div>
<% end %>
diff --git a/app/views/stop_areas/select_parent.html.erb b/app/views/stop_areas/select_parent.html.erb
index 26baf984a..fedd83446 100644
--- a/app/views/stop_areas/select_parent.html.erb
+++ b/app/views/stop_areas/select_parent.html.erb
@@ -6,11 +6,10 @@
<%= form.input :parent_id, :as => :text, :input_html => { :"data-pre" => ( @parent.present? ? [ { :id => @parent.id.to_s, :name => "#{@parent.name} #{@parent.country_code}" } ]: [] ).to_json } %>
<% end %>
- <%= form.buttons do %>
- <%= form.commit_button %>
- <%= t('or') %>
- <%= link_to t('cancel'), [@referential, @stop_area] %>
- <% end %>
+ <%= form.actions do %>
+ <%= form.action :submit, :as => :button %>
+ <%= form.action :cancel, :as => :link %>
+ <% end %>
</div>
<% end %>
diff --git a/app/views/stop_points/index.html.erb b/app/views/stop_points/index.html.erb
index 6f3b69ae0..486aefb5f 100644
--- a/app/views/stop_points/index.html.erb
+++ b/app/views/stop_points/index.html.erb
@@ -26,10 +26,9 @@
<% @stop_points.each do |sp| %>
<input type="hidden" id="<%= "pos_#{sp.position}" %>" name="stop_point[]" value="<%= sp.id %>" />
<% end %>
- <%= form.buttons do %>
- <%= form.commit_button t('.reorder_button') %>
- <li><%= t('or') %></li>
- <li><%= link_to t('cancel'), referential_line_route_stop_points_path(@referential, @line, @route) %></li>
+ <%= form.actions do %>
+ <%= form.action :submit, :as => :button, :label => t('.reorder_button') %>
+ <%= form.action :cancel, :as => :link , :url => referential_line_route_stop_points_path(@referential, @line, @route) %>
<% end %>
<% end %>
</div>
diff --git a/app/views/stop_points/new.html.erb b/app/views/stop_points/new.html.erb
index 3b2e86c41..e7f460c8c 100644
--- a/app/views/stop_points/new.html.erb
+++ b/app/views/stop_points/new.html.erb
@@ -6,11 +6,10 @@
<%= form.input :stop_area_id, :label => t('.select_area'),:input_html => { :"data-pre" => [].to_json } %>
<% end %>
- <%= form.buttons do %>
- <%= form.commit_button true %>
- <li><%= t('or') %></li>
- <li><%= link_to t('cancel'), :back %></li>
- <% end %>
+ <%= form.actions do %>
+ <%= form.action :submit, :as => :button %>
+ <%= form.action :cancel, :as => :link %>
+ <% end %>
</div>
<% end %>
diff --git a/app/views/time_table_dates/_form.html.erb b/app/views/time_table_dates/_form.html.erb
index c0218eb64..decc0b3cc 100644
--- a/app/views/time_table_dates/_form.html.erb
+++ b/app/views/time_table_dates/_form.html.erb
@@ -1,11 +1,11 @@
<%= semantic_form_for [@referential, @time_table, @time_table_date] do |form| %>
<%= form.inputs do %>
<%= form.input :date, :as => :date, :label => @time_table_date.human_attribute_name("date") %>
+
<% end %>
- <%= form.buttons do %>
- <%= form.commit_button %>
- <li><%= t('or') %></li>
- <li><%= link_to t('cancel'), :back %></li>
- <% end %>
+ <%= form.actions do %>
+ <%= form.action :submit, :as => :button %>
+ <%= form.action :cancel, :as => :link %>
+ <% end %>
<% end %>
diff --git a/app/views/time_table_periods/_form.html.erb b/app/views/time_table_periods/_form.html.erb
index 6f390c7d5..71f8f3fd1 100644
--- a/app/views/time_table_periods/_form.html.erb
+++ b/app/views/time_table_periods/_form.html.erb
@@ -3,10 +3,9 @@
<%= form.input :period_start, :as => :date, :label => @time_table_period.human_attribute_name("period_start") %>
<%= form.input :period_end, :as => :date, :label => @time_table_period.human_attribute_name("period_end") %>
<% end %>
- <%= form.buttons do %>
- <%= form.commit_button %>
- <li><%= t('or') %></li>
- <li><%= link_to t('cancel'), :back %></li>
- <% end %>
+ <%= form.actions do %>
+ <%= form.action :submit, :as => :button %>
+ <%= form.action :cancel, :as => :link %>
+ <% end %>
<% end %>
diff --git a/app/views/time_tables/_form.erb b/app/views/time_tables/_form.erb
index 59cc30947..f72e081da 100644
--- a/app/views/time_tables/_form.erb
+++ b/app/views/time_tables/_form.erb
@@ -24,11 +24,10 @@
<% end %>
<% end %>
<p/>
- <%= form.buttons do %>
- <%= form.commit_button %>
- <li><%= t('or') %></li>
- <li><%= link_to t('cancel'), :back %></li>
- <% end %>
+ <%= form.actions do %>
+ <%= form.action :submit, :as => :button %>
+ <%= form.action :cancel, :as => :link %>
+ <% end %>
<% end %>
<h3 class="dates"><%= t('.dates') %></h3>
<%= render "dates" %>
diff --git a/app/views/vehicle_journeys/_form.html.erb b/app/views/vehicle_journeys/_form.html.erb
index 582253b0f..6258d634a 100644
--- a/app/views/vehicle_journeys/_form.html.erb
+++ b/app/views/vehicle_journeys/_form.html.erb
@@ -4,18 +4,11 @@
<%= 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 :transport_mode, :as => :select, :collection => Chouette::Line.transport_modes, :include_blank => true, :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 %>
+ <%= form.input :objectid, :input_html => { :disabled => !@vehicle_journey.new_record? } %>
<%= form.inputs :class => "stop_times", :name => @vehicle_journey.human_attribute_name(:vehicle_journey_at_stop_ids) do %>
<table border="0" class="vehicle_journey_at_stops">
@@ -40,22 +33,19 @@
</tbody>
</table>
<% end %>
- <%= form.inputs :class => "time_tables", :name=> @vehicle_journey.human_attribute_name(:time_table_ids) do %>
- <div class="time_table_list">
<%= form.input :time_table_tokens, :label => t('.time_tables'), :as => :text, :input_html => { :"data-pre" => ( @vehicle_journey.time_tables.map { |time_table| { :id => time_table.id, :name => time_table.comment } } ).to_json } %>
- </div>
- <% end %>
<% end %>
- <%= form.buttons do %>
- <%= form.commit_button true %>
- <li><%= t('or') %></li>
- <li><%= link_to t('cancel'), :back %></li>
- <% end %>
+ <%= form.actions do %>
+ <%= form.action :submit, :as => :button %>
+ <%= form.action :cancel, :as => :link %>
+ <% end %>
<% end %>
-<% unless @vehicle_journey.new_record? %>
+<% 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/_time_filter.html.erb b/app/views/vehicle_journeys/_time_filter.html.erb
new file mode 100644
index 000000000..0f1e8d439
--- /dev/null
+++ b/app/views/vehicle_journeys/_time_filter.html.erb
@@ -0,0 +1,11 @@
+ <%= search_form_for @q, :url => referential_line_route_vehicle_journeys_path(@referential, @line, @route) do |f| %>
+ <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">
+ <%= 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)") %>
+ <%= f.submit t('.time_range_filter') %>
+ <% 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
index f6feab945..218027dae 100644
--- a/app/views/vehicle_journeys/_vehicle_journey_at_stop_fields.html.erb
+++ b/app/views/vehicle_journeys/_vehicle_journey_at_stop_fields.html.erb
@@ -1,6 +1,6 @@
<% vjas = vehicle_journey_at_stop %>
-<tr class="time input optional <%= vjas._destroy ? "no_stop" : "" %> <%= (vehicle_journey_at_stop_counter%2==0) ? "odd" : "even" %>">
- <td>
+<tr class="time input optional <%= vjas._destroy ? "no_stop" : "" %> <%= (vehicle_journey_at_stop_counter%2==0) ? "odd" : "even" %>" >
+ <td class="arrival_time <%= vjas.arrival_time.nil? ? "missing" : "" %> <%= vjas.errors[:arrival_time].blank? ? "" : "invalid_position" %>">
<%= select_hour(vjas.arrival_time ? vjas.arrival_time.hour : 0, :prefix => "vehicle_journey", :field_name => "vehicle_journey_at_stops_attributes[#{vehicle_journey_at_stop_counter}][arrival_time(4i)]") %>
<%= select_minute(vjas.arrival_time ? vjas.arrival_time.min : 0, :prefix => "vehicle_journey", :field_name => "vehicle_journey_at_stops_attributes[#{vehicle_journey_at_stop_counter}][arrival_time(5i)]") %>
</td>
@@ -16,7 +16,7 @@
<input name=<%= "vehicle_journey[vehicle_journey_at_stops_attributes][#{vehicle_journey_at_stop_counter}][arrival_time(1i)]" %> type="hidden" value="2000">
<label for=<%= "vehicle_journey_vehicle_journey_at_stops_attributes_#{vehicle_journey_at_stop_counter}_departure_time_5i" %>><%= vjas.stop_point.stop_area.name %></label>
</td>
- <td>
+ <td class="departure_time <%= vjas.departure_time.nil? ? "missing" : "" %> <%= vjas.errors[:departure_time].blank? ? "" : "invalid_position" %>">
<%= select_hour(vjas.departure_time ? vjas.departure_time.hour : 0, :prefix => "vehicle_journey", :field_name => "vehicle_journey_at_stops_attributes[#{vehicle_journey_at_stop_counter}][departure_time(4i)]") %>
<%= select_minute(vjas.departure_time ? vjas.departure_time.min : 0, :prefix => "vehicle_journey", :field_name => "vehicle_journey_at_stops_attributes[#{vehicle_journey_at_stop_counter}][departure_time(5i)]") %>
</td>
diff --git a/app/views/vehicle_journeys/index.html.erb b/app/views/vehicle_journeys/index.html.erb
index 8d000bac3..3d5bf31ac 100644
--- a/app/views/vehicle_journeys/index.html.erb
+++ b/app/views/vehicle_journeys/index.html.erb
@@ -23,14 +23,13 @@
<table>
<thead>
<tr>
- <th class="title">Missions : </th>
- <% @vehicle_journeys.each do |vj| %>
- <th> <%= link_to vj.journey_pattern.published_name.blank? ? vj.journey_pattern.id: vj.journey_pattern.published_name.first(8),
- [@referential, @line, @route, vj.journey_pattern]%></th>
- <% end %>
+ <th class="title"><%= Chouette::JourneyPattern.model_name.human.pluralize %> :</th>
+ <% @vehicle_journeys.map(&:journey_pattern).each do |jp| %>
+ <th><%= link_to journey_name( jp), [@referential, @line, @route, jp] %></th>
+ <% end %>
</tr>
<tr>
- <th class="title">Calendriers : </th>
+ <th class="title"><%= Chouette::TimeTable.model_name.human.pluralize %> :</th>
<% @vehicle_journeys.each do |vj| %>
<th title="<%= time_tables_info( vj) %>" class="calendars">
<%= time_tables_shortest_info( vj) %>
@@ -38,9 +37,9 @@
<% end %>
</tr>
<tr>
- <th class="title">Courses : </th>
+ <th class="title"><%= Chouette::VehicleJourney.model_name.human.pluralize %> :</th>
<% @vehicle_journeys.each do |vj| %>
- <th> <%= link_to "c", [@referential, @line, @route, vj]%></th>
+ <th> <%= link_to vehicle_name(vj), [@referential, @line, @route, vj]%></th>
<% end %>
</tr>
</thead>
@@ -49,7 +48,9 @@
<tr class="<%= cycle('odd', 'even') %>">
<td class="stop_area"><%= sp.stop_area.name %></td>
<% @vehicle_journeys.each do |vj| %>
- <td class="hours"><%= @matrix["#{vj.id}-#{sp.id}"] ? l( @matrix["#{vj.id}-#{sp.id}"].departure_time, :format => :hour) : "" %></td>
+ <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 %>
@@ -57,20 +58,32 @@
</table>
</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>
-</ul>
-<h3><%= t(".selection") %></h3>
+ <ul class="actions">
+ <li>
+ <%= link_to t('vehicle_journeys.actions.new'), new_referential_line_route_vehicle_journey_path(@referential, @line, @route), :class => "add" %>
+ </li>
+ </ul>
+ <h3><%= t(".selection") %></h3>
-<h4><%= Chouette::JourneyPattern.model_name.human.pluralize %></h4>
+ <h4><%= Chouette::JourneyPattern.model_name.human.pluralize %></h4>
-<ul class="selection">
-<% @route.journey_patterns.each do |journey_pattern| %>
-<li><%= link_with_search journey_pattern.name, "journey_pattern_id_eq" => journey_pattern.id %></li>
-<% end %>
-<li><%= link_with_search t(".selection_all"), {"journey_pattern_id_eq" => nil}, :class => "all" %></li>
-</ul>
+ <ul class="selection">
+ <% @route.journey_patterns.each do |journey_pattern| %>
+ <li><%= link_with_search journey_name(journey_pattern), "journey_pattern_id_eq" => journey_pattern.id %></li>
+ <% end %>
+ <li><%= link_with_search t(".selection_all"), {"journey_pattern_id_eq" => nil}, :class => "all" %></li>
+ </ul>
+ <h4><%= Chouette::TimeTable.model_name.human.pluralize %></h4>
+
+ <ul class="selection">
+ <% @route.time_tables.each do |time_table| %>
+ <li><%= link_with_search time_table.comment, "time_tables_comment_eq" => time_table.comment %></li>
+ <% end %>
+ <li><%= link_with_search t(".selection_all"), {"time_tables_comment_eq" => nil}, :class => "all" %></li>
+ </ul>
+
+ <h4><%= t('.time_range') %></h4>
+ <%= render :partial => "time_filter", :locals => { :time_field => "departure_time"} %>
<% end %>
+
diff --git a/app/views/vehicle_journeys/new.js.erb b/app/views/vehicle_journeys/new.js.erb
new file mode 100644
index 000000000..473c6be57
--- /dev/null
+++ b/app/views/vehicle_journeys/new.js.erb
@@ -0,0 +1,11 @@
+$(document).ready(function() {
+ $("#vehicle_journey_journey_pattern_id").change(
+ function(){
+ var url = "<%= "/referentials/#{@referential.id}/lines/#{@line.id}/routes/#{@route.id}/journey_patterns/" %>";
+ url = url + $("#vehicle_journey_journey_pattern_input select option:selected").attr("value") +
+ "/new_vehicle_journey";
+ $.get(url);
+ }
+ )
+});
+
diff --git a/app/views/vehicle_journeys/show.html.erb b/app/views/vehicle_journeys/show.html.erb
index 06f6f0c9f..8570261dd 100644
--- a/app/views/vehicle_journeys/show.html.erb
+++ b/app/views/vehicle_journeys/show.html.erb
@@ -65,9 +65,9 @@
<tbody>
<% @vehicle_journey.vehicle_journey_at_stops.each_with_index do |vjas, index| %>
<tr class="<%= index%2==0 ? "odd" : "even" %>">
- <td class="hour"><%= vjas.arrival_time ? l( vjas.arrival_time, :format => :hour) : "" %></td>
+ <td 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 ? l( vjas.departure_time, :format => :hour) : "" %></td>
+ <td class="hour <%= vjas.departure_time.nil? ? "missing" : "" %>"><%= vjas.departure_time ? l( vjas.departure_time, :format => :hour) : "" %></td>
</tr>
<% end %>
</tbody>
diff --git a/config/locales/formtastic.yml b/config/locales/formtastic.yml
new file mode 100644
index 000000000..539645241
--- /dev/null
+++ b/config/locales/formtastic.yml
@@ -0,0 +1,10 @@
+fr:
+ formtastic:
+ yes: 'Oui'
+ no: 'Non'
+ create: "Créer %{model}"
+ update: "Modifier %{model}"
+ submit: 'Valider %{model}'
+ cancel: 'Annuler %{model}'
+ reset: 'Réinitialiser %{model}'
+ required: 'required' \ No newline at end of file
diff --git a/config/locales/fr.yml b/config/locales/fr.yml
index bbfacc0df..79eb8a110 100644
--- a/config/locales/fr.yml
+++ b/config/locales/fr.yml
@@ -188,10 +188,6 @@ fr:
yesterday: "Hier"
edit_periods: "Editer Périodes"
delete_periods: "Supprimer Périodes"
- formtastic:
- actions:
- create: "Créer %{model}"
- update: "Modifier %{model}"
attributes:
author: "Modifié par"
created_at: "Créé le"
diff --git a/config/locales/vehicle_journeys.yml b/config/locales/vehicle_journeys.yml
index 12f94a191..801163b82 100644
--- a/config/locales/vehicle_journeys.yml
+++ b/config/locales/vehicle_journeys.yml
@@ -31,6 +31,9 @@ en:
vehicle_journeys: "Departure's times"
selection: Filter on
selection_all: All
+ time_range: Departure time threshold
+ time_filter:
+ time_range_filter: Filter
activerecord:
models:
vehicle_journey:
@@ -57,6 +60,10 @@ en:
object_version: Version
creation_time: Created on
creator_id: Created by
+ errors:
+ models:
+ vehicle_journey:
+ invalid_times: "Invalid times"
fr:
vehicle_journeys:
@@ -91,6 +98,9 @@ fr:
vehicle_journeys: "Horaires de départ aux arrêts"
selection: Filtrer sur
selection_all: Tous
+ time_range: Seuil horaire au départ
+ time_filter:
+ time_range_filter: Filtrer
activerecord:
models:
vehicle_journey:
@@ -117,4 +127,8 @@ fr:
object_version: Version
creation_time: Créé le
creator_id: Créé par
+ errors:
+ models:
+ vehicle_journey:
+ invalid_times: "Horaires invalides"
diff --git a/config/routes.rb b/config/routes.rb
index 01995f0ed..90e29a039 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -34,7 +34,11 @@ ChouetteIhm::Application.routes.draw do
end
end
resources :routes do
- resources :journey_patterns
+ resources :journey_patterns do
+ member do
+ get 'new_vehicle_journey'
+ end
+ end
resources :vehicle_journeys do
member do
get 'select_journey_pattern'
diff --git a/doc/mockups/import-data-index.bmml b/doc/mockups/import-data-index.bmml
new file mode 100644
index 000000000..2b0d516ea
--- /dev/null
+++ b/doc/mockups/import-data-index.bmml
@@ -0,0 +1,149 @@
+<mockup version="1.0" skin="sketch" measuredW="942" measuredH="589" mockupW="753" mockupH="564">
+ <controls>
+ <control controlID="18" controlTypeID="com.balsamiq.mockups::Title" x="226" y="147" w="-1" h="-1" measuredW="526" measuredH="37" zOrder="2" locked="false" isInGroup="-1">
+ <controlProperties>
+ <size>28</size>
+ <text>Import%20de%20donn%E9es%20brutes%20%3A%20Donnees%20Mars</text>
+ </controlProperties>
+ </control>
+ <control controlID="20" controlTypeID="com.balsamiq.mockups::ButtonBar" x="226" y="90" w="-1" h="-1" measuredW="381" measuredH="29" zOrder="3" locked="false" isInGroup="-1">
+ <controlProperties>
+ <selectedIndex>2</selectedIndex>
+ <text>Tableau%20de%20bord%2C%20Lignes%2C%20Arr%EAts%2C%20...%2C%20Courses</text>
+ </controlProperties>
+ </control>
+ <control controlID="23" controlTypeID="com.balsamiq.mockups::FieldSet" x="189" y="121" w="588" h="468" measuredW="200" measuredH="170" zOrder="1" locked="false" isInGroup="-1">
+ <controlProperties>
+ <text/>
+ </controlProperties>
+ </control>
+ <control controlID="24" controlTypeID="com.balsamiq.mockups::FieldSet" x="189" y="25" w="753" h="96" measuredW="200" measuredH="170" zOrder="0" locked="false" isInGroup="-1">
+ <controlProperties>
+ <text/>
+ </controlProperties>
+ </control>
+ <control controlID="74" controlTypeID="com.balsamiq.mockups::StickyNote" x="800" y="184" w="242" h="90" measuredW="109" measuredH="123" zOrder="5" locked="false" isInGroup="-1">
+ <controlProperties>
+ <text>Facilitateurs%20qui%20apparaissent%20quand%20on%20survole%20le%20passage</text>
+ </controlProperties>
+ </control>
+ <control controlID="76" controlTypeID="com.balsamiq.mockups::Arrow" x="668" y="228" w="221" h="39" measuredW="150" measuredH="100" zOrder="4" locked="false" isInGroup="-1">
+ <controlProperties>
+ <direction>bottom</direction>
+ <rightArrow>false</rightArrow>
+ <text/>
+ </controlProperties>
+ </control>
+ <control controlID="77" controlTypeID="com.balsamiq.mockups::Arrow" x="668" y="354" w="221" h="39" measuredW="150" measuredH="100" zOrder="6" locked="false" isInGroup="-1">
+ <controlProperties>
+ <direction>bottom</direction>
+ <rightArrow>false</rightArrow>
+ <text/>
+ </controlProperties>
+ </control>
+ <control controlID="78" controlTypeID="com.balsamiq.mockups::StickyNote" x="800" y="310" w="242" h="90" measuredW="109" measuredH="123" zOrder="7" locked="false" isInGroup="-1">
+ <controlProperties>
+ <text>Facilitateurs%20qui%20apparaissent%20quand%20on%20edite%20l%27horaire</text>
+ </controlProperties>
+ </control>
+ <control controlID="80" controlTypeID="com.balsamiq.mockups::StickyNote" x="516" y="551" w="182" h="114" measuredW="109" measuredH="123" zOrder="8" locked="false" isInGroup="-1">
+ <controlProperties>
+ <align>center</align>
+ <text>S%E9lection%20pour%20effectuer%20des%20op%E9rations%20sur%20plusieurs%20passages</text>
+ </controlProperties>
+ </control>
+ <control controlID="83" controlTypeID="com.balsamiq.mockups::StickyNote" x="486" y="893" w="242" h="90" measuredW="109" measuredH="123" zOrder="9" locked="false" isInGroup="-1">
+ <controlProperties>
+ <align>center</align>
+ <text>Facilitateurs%20sp%E9cifiques%20lorsqu%27une%20s%E9lection%20est%20disponible</text>
+ </controlProperties>
+ </control>
+ <control controlID="90" controlTypeID="com.balsamiq.mockups::DataGrid" x="226" y="236" w="509" h="296" measuredW="566" measuredH="307" zOrder="10" locked="false" isInGroup="-1">
+ <controlProperties>
+ <borderStyle>none</borderStyle>
+ <hasHeader>false</hasHeader>
+ <selectedIndex>-1</selectedIndex>
+ <text>71%2CCharles%20David%2CHastusTUR%3AStopArea%3ACOM601%2C43.96379%2C4.800694%2CValide%0A72%2CZola%2CHastusTUR%3AStopArea%3ACOM582%2C43.95615%2C4.845099%2CValide%0A73%2CSaint%20Lazare%2CHastusTUR%3AStopArea%3ACOM504%2C43.9502%2C4.81969%2CValide%0A74%2CLes%20Sources%2CHastusTUR%3AStopArea%3APHYsourc1%2C43.943146%2C4.812051%2CValide%0A75%2CLes%20Sources%2CHastusTUR%3AStopArea%3APHYsourc2%2C43.943146%2C4.812051%2CValide%0A76%2CIle%20Piot%2CHastusTUR%3AStopArea%3APHYpiot2%2C*0*%2C*0*%2C*Ignor%E9e*%0A77%2CIle%20Piot%2CHastusTUR%3AStopArea%3APHYpiot1%2C*0*%2C*0*%2C*Invalide*%0A78%2CPorte%20de%20l%27Oulle%2CHastusTUR%3AStopArea%3APHY103%2C43.950073%2C4.802352%2CValide%0A79%2CThiers%2CHastusTUR%3AStopArea%3APHYthier2%2C43.946439%2C4.817314%2CValide%0A80%2CThiers%2CHastusTUR%3AStopArea%3APHYthier1%2C43.946439%2C4.817314%2CValide%0A%7B0R%2C15L%2C20L%2C0R%2C0R%2C0L%7D</text>
+ </controlProperties>
+ </control>
+ <control controlID="91" controlTypeID="com.balsamiq.mockups::LinkBar" x="446" y="547" w="-1" h="-1" measuredW="289" measuredH="18" zOrder="11" locked="false" isInGroup="-1">
+ <controlProperties>
+ <size>11</size>
+ <text>%3C%20Pr%E9c%E9dent%2C%205%2C%206%2C%20*7*%2C%208%2C%209%2C%20Suivant%20%3E</text>
+ </controlProperties>
+ </control>
+ <control controlID="92" controlTypeID="com.balsamiq.mockups::ComboBox" x="251" y="213" w="120" h="-1" measuredW="58" measuredH="23" zOrder="12" locked="false" isInGroup="-1">
+ <controlProperties>
+ <text>Nom</text>
+ </controlProperties>
+ </control>
+ <control controlID="93" controlTypeID="com.balsamiq.mockups::ComboBox" x="526" y="213" w="77" h="-1" measuredW="78" measuredH="23" zOrder="13" locked="false" isInGroup="-1">
+ <controlProperties>
+ <text>Latitude</text>
+ </controlProperties>
+ </control>
+ <control controlID="94" controlTypeID="com.balsamiq.mockups::ComboBox" x="603" y="213" w="71" h="-1" measuredW="86" measuredH="23" zOrder="14" locked="false" isInGroup="-1">
+ <controlProperties>
+ <text>Longitude</text>
+ </controlProperties>
+ </control>
+ <control controlID="95" controlTypeID="com.balsamiq.mockups::ComboBox" x="371" y="213" w="155" h="-1" measuredW="81" measuredH="23" zOrder="15" locked="false" isInGroup="-1">
+ <controlProperties>
+ <text>ObjectID</text>
+ </controlProperties>
+ </control>
+ <control controlID="96" controlTypeID="com.balsamiq.mockups::Label" x="226" y="184" w="-1" h="-1" measuredW="326" measuredH="21" zOrder="16" locked="false" isInGroup="-1">
+ <controlProperties>
+ <text>97%20lignes%20de%20donn%E9es%2C%2094%20valid%E9es%2C%202%20invalides%2C%201%20ignor%E9e</text>
+ </controlProperties>
+ </control>
+ <control controlID="98" controlTypeID="com.balsamiq.mockups::Label" x="676" y="215" w="-1" h="-1" measuredW="42" measuredH="21" zOrder="17" locked="false" isInGroup="-1">
+ <controlProperties>
+ <text>Status</text>
+ </controlProperties>
+ </control>
+ <control controlID="100" controlTypeID="com.balsamiq.mockups::Link" x="793" y="155" w="-1" h="-1" measuredW="118" measuredH="21" zOrder="18" locked="false" isInGroup="-1">
+ <controlProperties>
+ <text>Valider%20les%20donn%E9es</text>
+ </controlProperties>
+ </control>
+ <control controlID="101" controlTypeID="com.balsamiq.mockups::Link" x="793" y="177" w="-1" h="-1" measuredW="129" measuredH="21" zOrder="19" locked="false" isInGroup="-1">
+ <controlProperties>
+ <state>disabled</state>
+ <text>Importer%20les%20donn%E9es</text>
+ <underline>false</underline>
+ </controlProperties>
+ </control>
+ <control controlID="102" controlTypeID="com.balsamiq.mockups::Link" x="793" y="213" w="-1" h="-1" measuredW="128" measuredH="21" zOrder="20" locked="false" isInGroup="-1">
+ <controlProperties>
+ <text>Supprimer%20cet%20import</text>
+ </controlProperties>
+ </control>
+ <control controlID="103" controlTypeID="com.balsamiq.mockups::Label" x="793" y="246" w="-1" h="-1" measuredW="64" measuredH="21" zOrder="21" locked="false" isInGroup="-1">
+ <controlProperties>
+ <bold>true</bold>
+ <text>Filtrer%20sur</text>
+ </controlProperties>
+ </control>
+ <control controlID="104" controlTypeID="com.balsamiq.mockups::Link" x="793" y="295" w="-1" h="-1" measuredW="100" measuredH="21" zOrder="22" locked="false" isInGroup="-1">
+ <controlProperties>
+ <text>Donn%E9es%20Valides</text>
+ </controlProperties>
+ </control>
+ <control controlID="105" controlTypeID="com.balsamiq.mockups::Link" x="793" y="318" w="-1" h="-1" measuredW="109" measuredH="21" zOrder="23" locked="false" isInGroup="-1">
+ <controlProperties>
+ <text>Donn%E9es%20Invalides</text>
+ </controlProperties>
+ </control>
+ <control controlID="106" controlTypeID="com.balsamiq.mockups::Link" x="793" y="345" w="-1" h="-1" measuredW="111" measuredH="21" zOrder="24" locked="false" isInGroup="-1">
+ <controlProperties>
+ <text>Donn%E9es%20Ignor%E9es</text>
+ </controlProperties>
+ </control>
+ <control controlID="107" controlTypeID="com.balsamiq.mockups::Label" x="793" y="274" w="-1" h="-1" measuredW="42" measuredH="21" zOrder="25" locked="false" isInGroup="-1">
+ <controlProperties>
+ <text>Status</text>
+ </controlProperties>
+ </control>
+ </controls>
+</mockup> \ No newline at end of file
diff --git a/doc/mockups/import-data-index.png b/doc/mockups/import-data-index.png
new file mode 100644
index 000000000..3df0f57ea
--- /dev/null
+++ b/doc/mockups/import-data-index.png
Binary files differ
diff --git a/doc/mockups/imports-vehiculejourneyatstops-index.bmml b/doc/mockups/imports-vehiculejourneyatstops-index.bmml
new file mode 100644
index 000000000..e7c15ad2e
--- /dev/null
+++ b/doc/mockups/imports-vehiculejourneyatstops-index.bmml
@@ -0,0 +1,222 @@
+<mockup version="1.0" skin="sketch" measuredW="942" measuredH="760" mockupW="798" mockupH="735">
+ <controls>
+ <control controlID="18" controlTypeID="com.balsamiq.mockups::Title" x="226" y="147" w="-1" h="-1" measuredW="518" measuredH="37" zOrder="2" locked="false" isInGroup="-1">
+ <controlProperties>
+ <size>28</size>
+ <text>Import%20de%20courses%20brutes%20%3A%20Donnees%20Mars</text>
+ </controlProperties>
+ </control>
+ <control controlID="20" controlTypeID="com.balsamiq.mockups::ButtonBar" x="226" y="90" w="-1" h="-1" measuredW="381" measuredH="29" zOrder="3" locked="false" isInGroup="-1">
+ <controlProperties>
+ <selectedIndex>2</selectedIndex>
+ <text>Tableau%20de%20bord%2C%20Lignes%2C%20Arr%EAts%2C%20...%2C%20Courses</text>
+ </controlProperties>
+ </control>
+ <control controlID="23" controlTypeID="com.balsamiq.mockups::FieldSet" x="144" y="121" w="633" h="639" measuredW="200" measuredH="170" zOrder="1" locked="false" isInGroup="-1">
+ <controlProperties>
+ <text/>
+ </controlProperties>
+ </control>
+ <control controlID="24" controlTypeID="com.balsamiq.mockups::FieldSet" x="189" y="25" w="753" h="96" measuredW="200" measuredH="170" zOrder="0" locked="false" isInGroup="-1">
+ <controlProperties>
+ <text/>
+ </controlProperties>
+ </control>
+ <control controlID="74" controlTypeID="com.balsamiq.mockups::StickyNote" x="800" y="184" w="242" h="90" measuredW="109" measuredH="123" zOrder="5" locked="false" isInGroup="-1">
+ <controlProperties>
+ <text>Facilitateurs%20qui%20apparaissent%20quand%20on%20survole%20le%20passage</text>
+ </controlProperties>
+ </control>
+ <control controlID="76" controlTypeID="com.balsamiq.mockups::Arrow" x="668" y="228" w="221" h="39" measuredW="150" measuredH="100" zOrder="4" locked="false" isInGroup="-1">
+ <controlProperties>
+ <direction>bottom</direction>
+ <rightArrow>false</rightArrow>
+ <text/>
+ </controlProperties>
+ </control>
+ <control controlID="77" controlTypeID="com.balsamiq.mockups::Arrow" x="668" y="354" w="221" h="39" measuredW="150" measuredH="100" zOrder="6" locked="false" isInGroup="-1">
+ <controlProperties>
+ <direction>bottom</direction>
+ <rightArrow>false</rightArrow>
+ <text/>
+ </controlProperties>
+ </control>
+ <control controlID="78" controlTypeID="com.balsamiq.mockups::StickyNote" x="800" y="310" w="242" h="90" measuredW="109" measuredH="123" zOrder="7" locked="false" isInGroup="-1">
+ <controlProperties>
+ <text>Facilitateurs%20qui%20apparaissent%20quand%20on%20edite%20l%27horaire</text>
+ </controlProperties>
+ </control>
+ <control controlID="80" controlTypeID="com.balsamiq.mockups::StickyNote" x="516" y="551" w="182" h="114" measuredW="109" measuredH="123" zOrder="8" locked="false" isInGroup="-1">
+ <controlProperties>
+ <align>center</align>
+ <text>S%E9lection%20pour%20effectuer%20des%20op%E9rations%20sur%20plusieurs%20passages</text>
+ </controlProperties>
+ </control>
+ <control controlID="83" controlTypeID="com.balsamiq.mockups::StickyNote" x="486" y="893" w="242" h="90" measuredW="109" measuredH="123" zOrder="9" locked="false" isInGroup="-1">
+ <controlProperties>
+ <align>center</align>
+ <text>Facilitateurs%20sp%E9cifiques%20lorsqu%27une%20s%E9lection%20est%20disponible</text>
+ </controlProperties>
+ </control>
+ <control controlID="90" controlTypeID="com.balsamiq.mockups::DataGrid" x="430" y="473" w="339" h="174" measuredW="158" measuredH="97" zOrder="10" locked="false" isInGroup="-1">
+ <controlProperties>
+ <borderStyle>none</borderStyle>
+ <hasHeader>false</hasHeader>
+ <selectedIndex>-1</selectedIndex>
+ <text>17%3A23%2C18h34%2C19-12%0A17%3A26%2C-%2C19-16%0A17h32%2C18h42%2C19-25</text>
+ </controlProperties>
+ </control>
+ <control controlID="91" controlTypeID="com.balsamiq.mockups::LinkBar" x="446" y="718" w="-1" h="-1" measuredW="289" measuredH="18" zOrder="11" locked="false" isInGroup="-1">
+ <controlProperties>
+ <size>11</size>
+ <text>%3C%20Pr%E9c%E9dent%2C%205%2C%206%2C%20*7*%2C%208%2C%209%2C%20Suivant%20%3E</text>
+ </controlProperties>
+ </control>
+ <control controlID="92" controlTypeID="com.balsamiq.mockups::ComboBox" x="214" y="368" w="189" h="-1" measuredW="58" measuredH="23" zOrder="12" locked="false" isInGroup="-1">
+ <controlProperties>
+ <text>Nom</text>
+ </controlProperties>
+ </control>
+ <control controlID="94" controlTypeID="com.balsamiq.mockups::ComboBox" x="431" y="316" w="106" h="-1" measuredW="81" measuredH="23" zOrder="13" locked="false" isInGroup="-1">
+ <controlProperties>
+ <text>Semaine</text>
+ </controlProperties>
+ </control>
+ <control controlID="96" controlTypeID="com.balsamiq.mockups::Label" x="226" y="184" w="-1" h="-1" measuredW="274" measuredH="21" zOrder="14" locked="false" isInGroup="-1">
+ <controlProperties>
+ <text>97%20colonnes%2C%2094%20valid%E9es%2C%202%20invalides%2C%201%20ignor%E9e</text>
+ </controlProperties>
+ </control>
+ <control controlID="100" controlTypeID="com.balsamiq.mockups::Link" x="793" y="155" w="-1" h="-1" measuredW="118" measuredH="21" zOrder="15" locked="false" isInGroup="-1">
+ <controlProperties>
+ <text>Valider%20les%20donn%E9es</text>
+ </controlProperties>
+ </control>
+ <control controlID="101" controlTypeID="com.balsamiq.mockups::Link" x="793" y="177" w="-1" h="-1" measuredW="129" measuredH="21" zOrder="16" locked="false" isInGroup="-1">
+ <controlProperties>
+ <state>disabled</state>
+ <text>Importer%20les%20donn%E9es</text>
+ <underline>false</underline>
+ </controlProperties>
+ </control>
+ <control controlID="102" controlTypeID="com.balsamiq.mockups::Link" x="793" y="213" w="-1" h="-1" measuredW="128" measuredH="21" zOrder="17" locked="false" isInGroup="-1">
+ <controlProperties>
+ <text>Supprimer%20cet%20import</text>
+ </controlProperties>
+ </control>
+ <control controlID="103" controlTypeID="com.balsamiq.mockups::Label" x="793" y="246" w="-1" h="-1" measuredW="64" measuredH="21" zOrder="18" locked="false" isInGroup="-1">
+ <controlProperties>
+ <bold>true</bold>
+ <text>Filtrer%20sur</text>
+ </controlProperties>
+ </control>
+ <control controlID="104" controlTypeID="com.balsamiq.mockups::Link" x="793" y="295" w="-1" h="-1" measuredW="100" measuredH="21" zOrder="19" locked="false" isInGroup="-1">
+ <controlProperties>
+ <text>Donn%E9es%20Valides</text>
+ </controlProperties>
+ </control>
+ <control controlID="105" controlTypeID="com.balsamiq.mockups::Link" x="793" y="318" w="-1" h="-1" measuredW="109" measuredH="21" zOrder="20" locked="false" isInGroup="-1">
+ <controlProperties>
+ <text>Donn%E9es%20Invalides</text>
+ </controlProperties>
+ </control>
+ <control controlID="106" controlTypeID="com.balsamiq.mockups::Link" x="793" y="345" w="-1" h="-1" measuredW="111" measuredH="21" zOrder="21" locked="false" isInGroup="-1">
+ <controlProperties>
+ <text>Donn%E9es%20Ignor%E9es</text>
+ </controlProperties>
+ </control>
+ <control controlID="107" controlTypeID="com.balsamiq.mockups::Label" x="793" y="274" w="-1" h="-1" measuredW="42" measuredH="21" zOrder="22" locked="false" isInGroup="-1">
+ <controlProperties>
+ <text>Status</text>
+ </controlProperties>
+ </control>
+ <control controlID="108" controlTypeID="com.balsamiq.mockups::ComboBox" x="431" y="285" w="106" h="-1" measuredW="81" measuredH="23" zOrder="23" locked="false" isInGroup="-1">
+ <controlProperties>
+ <text>Mission%201</text>
+ </controlProperties>
+ </control>
+ <control controlID="110" controlTypeID="com.balsamiq.mockups::Label" x="358" y="286" w="-1" h="-1" measuredW="44" measuredH="21" zOrder="24" locked="false" isInGroup="-1">
+ <controlProperties>
+ <text>Mission</text>
+ </controlProperties>
+ </control>
+ <control controlID="111" controlTypeID="com.balsamiq.mockups::Label" x="357" y="320" w="-1" h="-1" measuredW="65" measuredH="21" zOrder="25" locked="false" isInGroup="-1">
+ <controlProperties>
+ <text>Calendrier</text>
+ </controlProperties>
+ </control>
+ <control controlID="112" controlTypeID="com.balsamiq.mockups::ComboBox" x="538" y="287" w="106" h="-1" measuredW="83" measuredH="23" zOrder="26" locked="false" isInGroup="-1">
+ <controlProperties>
+ <text>Mission%202</text>
+ </controlProperties>
+ </control>
+ <control controlID="113" controlTypeID="com.balsamiq.mockups::ComboBox" x="650" y="287" w="106" h="-1" measuredW="81" measuredH="23" zOrder="27" locked="false" isInGroup="-1">
+ <controlProperties>
+ <text>Mission%201</text>
+ </controlProperties>
+ </control>
+ <control controlID="114" controlTypeID="com.balsamiq.mockups::ComboBox" x="546" y="320" w="106" h="-1" measuredW="93" measuredH="23" zOrder="28" locked="false" isInGroup="-1">
+ <controlProperties>
+ <text>Week-end</text>
+ </controlProperties>
+ </control>
+ <control controlID="115" controlTypeID="com.balsamiq.mockups::ComboBox" x="659" y="322" w="106" h="-1" measuredW="93" measuredH="23" zOrder="29" locked="false" isInGroup="-1">
+ <controlProperties>
+ <text>Week-end</text>
+ </controlProperties>
+ </control>
+ <control controlID="116" controlTypeID="com.balsamiq.mockups::ComboBox" x="223" y="478" w="189" h="-1" measuredW="111" measuredH="23" zOrder="30" locked="false" isInGroup="-1">
+ <controlProperties>
+ <text>Charles%20David</text>
+ </controlProperties>
+ </control>
+ <control controlID="117" controlTypeID="com.balsamiq.mockups::ComboBox" x="222" y="510" w="189" h="-1" measuredW="114" measuredH="23" zOrder="31" locked="false" isInGroup="-1">
+ <controlProperties>
+ <text>Gare%20Centrale</text>
+ </controlProperties>
+ </control>
+ <control controlID="118" controlTypeID="com.balsamiq.mockups::ComboBox" x="223" y="539" w="189" h="-1" measuredW="71" measuredH="23" zOrder="32" locked="false" isInGroup="-1">
+ <controlProperties>
+ <text>Piscine</text>
+ </controlProperties>
+ </control>
+ <control controlID="119" controlTypeID="com.balsamiq.mockups::Label" x="214" y="446" w="-1" h="-1" measuredW="44" measuredH="21" zOrder="33" locked="false" isInGroup="-1">
+ <controlProperties>
+ <text>Arrets</text>
+ </controlProperties>
+ </control>
+ <control controlID="120" controlTypeID="com.balsamiq.mockups::DataGrid" x="433" y="368" w="336" h="64" measuredW="208" measuredH="67" zOrder="34" locked="false" isInGroup="-1">
+ <controlProperties>
+ <borderStyle>none</borderStyle>
+ <hasHeader>false</hasHeader>
+ <selectedIndex>-1</selectedIndex>
+ <text>Course%201%2C%20Course%202%2C%20Course%203%0AA%2CB%2CB</text>
+ </controlProperties>
+ </control>
+ <control controlID="121" controlTypeID="com.balsamiq.mockups::ComboBox" x="214" y="404" w="189" h="-1" measuredW="73" measuredH="23" zOrder="35" locked="false" isInGroup="-1">
+ <controlProperties>
+ <text>Inconnu</text>
+ </controlProperties>
+ </control>
+ <control controlID="122" controlTypeID="com.balsamiq.mockups::Label" x="359" y="253" w="-1" h="-1" measuredW="42" measuredH="21" zOrder="36" locked="false" isInGroup="-1">
+ <controlProperties>
+ <text>Status</text>
+ </controlProperties>
+ </control>
+ <control controlID="123" controlTypeID="com.balsamiq.mockups::Label" x="439" y="251" w="67" h="24" measuredW="40" measuredH="21" zOrder="37" locked="false" isInGroup="-1">
+ <controlProperties>
+ <text>Valide</text>
+ </controlProperties>
+ </control>
+ <control controlID="124" controlTypeID="com.balsamiq.mockups::Label" x="556" y="252" w="67" h="24" measuredW="49" measuredH="21" zOrder="38" locked="false" isInGroup="-1">
+ <controlProperties>
+ <text>Invalide</text>
+ </controlProperties>
+ </control>
+ <control controlID="125" controlTypeID="com.balsamiq.mockups::Label" x="654" y="252" w="67" h="24" measuredW="40" measuredH="21" zOrder="39" locked="false" isInGroup="-1">
+ <controlProperties>
+ <text>Valide</text>
+ </controlProperties>
+ </control>
+ </controls>
+</mockup> \ No newline at end of file
diff --git a/doc/mockups/imports-vehiculejourneyatstops-index.png b/doc/mockups/imports-vehiculejourneyatstops-index.png
new file mode 100644
index 000000000..88be62c66
--- /dev/null
+++ b/doc/mockups/imports-vehiculejourneyatstops-index.png
Binary files differ
diff --git a/spec/controllers/routes_controller_spec.rb b/spec/controllers/routes_controller_spec.rb
index 92bcbf4a8..9356e1a9a 100644
--- a/spec/controllers/routes_controller_spec.rb
+++ b/spec/controllers/routes_controller_spec.rb
@@ -3,8 +3,7 @@ require 'spec_helper'
describe RoutesController do
login_user
- let!(:referential) { create(:referential).switch }
- let!(:route) { referential; Factory(:route) }
+ let!(:route) { Factory(:route) }
it { should be_kind_of(ChouetteController) }
diff --git a/spec/controllers/stop_points_controller_spec.rb b/spec/controllers/stop_points_controller_spec.rb
index b6c9e5dfa..ef63ae613 100644
--- a/spec/controllers/stop_points_controller_spec.rb
+++ b/spec/controllers/stop_points_controller_spec.rb
@@ -3,8 +3,7 @@ require 'spec_helper'
describe StopPointsController do
login_user
- let!(:referential) { create(:referential).switch }
- let!(:route) { referential; Factory(:route) }
+ let!(:route) { Factory(:route) }
let(:permutated_stop_point_ids) {
old_stop_point_ids = route.stop_points.map(&:id)
old_stop_point_ids.permutation.to_a.select { |permutated| permutated != old_stop_point_ids}.first
diff --git a/spec/factories.rb b/spec/factories.rb
index fdd23eded..faf1fef94 100644
--- a/spec/factories.rb
+++ b/spec/factories.rb
@@ -4,6 +4,7 @@ FactoryGirl.define do
f.sequence(:name) { |n| "Test #{n}" }
f.sequence(:slug) { |n| "test_#{n}" }
f.sequence(:prefix) { |n| "test_#{n}" }
+
f.time_zone "Europe/Paris"
end
@@ -15,7 +16,7 @@ FactoryGirl.define do
factory :import do |f|
f.resources { Rack::Test::UploadedFile.new 'spec/fixtures/neptune.zip', 'application/zip', false }
- f.association :referential
+ f.referential { Referential.find_by_slug("first") }
end
factory :import_log_message do |f|
@@ -24,7 +25,7 @@ FactoryGirl.define do
end
factory :export do |f|
- f.association :referential
+ f.referential { Referential.find_by_slug("first") }
end
factory :export_log_message do |f|
diff --git a/spec/requests/companies_spec.rb b/spec/requests/companies_spec.rb
index f0716dcd9..dbacd4a71 100644
--- a/spec/requests/companies_spec.rb
+++ b/spec/requests/companies_spec.rb
@@ -4,8 +4,7 @@ require 'spec_helper'
describe "Companies" do
login_user
- let(:referential) { create(:referential).switch }
- let(:companies) { referential; Array.new(2) { create(:company) } }
+ let(:companies) { Array.new(2) { create :company } }
subject { companies.first }
describe "list" do
diff --git a/spec/requests/connection_links_spec.rb b/spec/requests/connection_links_spec.rb
index 76d8a942c..48b5aa41d 100644
--- a/spec/requests/connection_links_spec.rb
+++ b/spec/requests/connection_links_spec.rb
@@ -4,8 +4,7 @@ require 'spec_helper'
describe "ConnectionLinks" do
login_user
- let(:referential) { create(:referential).switch }
- let(:connection_links) { referential; Array.new(2) { create(:connection_link) } }
+ let(:connection_links) { Array.new(2) { create(:connection_link) } }
subject { connection_links.first }
describe "list" do
diff --git a/spec/requests/journey_pattern_spec.rb b/spec/requests/journey_pattern_spec.rb
index ce36b3002..d5afcfbf0 100644
--- a/spec/requests/journey_pattern_spec.rb
+++ b/spec/requests/journey_pattern_spec.rb
@@ -4,7 +4,6 @@ require 'spec_helper'
describe "JourneyPatterns" do
login_user
- let(:referential) { create(:referential).switch }
let(:line) { Factory(:line) }
let(:route) { Factory(:route, :line => line) }
let(:journey_pattern) { Factory(:journey_pattern, :route => route) }
diff --git a/spec/requests/lines_spec.rb b/spec/requests/lines_spec.rb
index 32254bce1..10d653f30 100644
--- a/spec/requests/lines_spec.rb
+++ b/spec/requests/lines_spec.rb
@@ -4,7 +4,6 @@ require 'spec_helper'
describe "Lines" do
login_user
- let(:referential) { create(:referential).switch }
let(:network) { Factory(:network) }
let(:company) { Factory(:company) }
let(:lines) { referential; Array.new(2) { Factory(:line, :network => network, :company => company) } }
diff --git a/spec/requests/networks_spec.rb b/spec/requests/networks_spec.rb
index 1b15436ee..f73724a48 100644
--- a/spec/requests/networks_spec.rb
+++ b/spec/requests/networks_spec.rb
@@ -4,8 +4,7 @@ require 'spec_helper'
describe "Networks" do
login_user
- let(:referential) { create(:referential).switch }
- let(:networks) { referential; Array.new(2) { Factory(:network) } }
+ let(:networks) { Array.new(2) { Factory(:network) } }
subject { networks.first }
describe "list" do
diff --git a/spec/requests/routes_spec.rb b/spec/requests/routes_spec.rb
index baddfdf95..3ba1985eb 100644
--- a/spec/requests/routes_spec.rb
+++ b/spec/requests/routes_spec.rb
@@ -4,7 +4,6 @@ require 'spec_helper'
describe "Routes" do
login_user
- let(:referential) { create(:referential).switch }
let(:line) { Factory(:line) }
let(:route) { Factory(:route, :line => line) }
let(:route2) { Factory(:route, :line => line) }
diff --git a/spec/requests/stop_areas_spec.rb b/spec/requests/stop_areas_spec.rb
index b81f70a6c..5d4e3afb3 100644
--- a/spec/requests/stop_areas_spec.rb
+++ b/spec/requests/stop_areas_spec.rb
@@ -4,8 +4,7 @@ require 'spec_helper'
describe "StopAreas" do
login_user
- let(:referential) { create(:referential).switch }
- let(:stop_areas) { referential; Array.new(2) { Factory(:stop_area) } }
+ let(:stop_areas) { Array.new(2) { Factory(:stop_area) } }
subject { stop_areas.first }
describe "list" do
diff --git a/spec/requests/stop_points_spec.rb b/spec/requests/stop_points_spec.rb
index e6e3303ab..39467174f 100644
--- a/spec/requests/stop_points_spec.rb
+++ b/spec/requests/stop_points_spec.rb
@@ -4,10 +4,9 @@ require 'spec_helper'
describe "StopPoints" do
login_user
- let(:referential) { create(:referential).switch }
- let(:line) { referential; Factory(:line) }
- let(:route) { referential; Factory(:route, :line => line) }
- let(:route2) { referential; Factory(:route, :line => line) }
+ let(:line) { Factory(:line) }
+ let(:route) { Factory(:route, :line => line) }
+ let(:route2) { Factory(:route, :line => line) }
describe "from route's page to a stop points page" do
it "display route's stop points" do
diff --git a/spec/requests/time_tables_spec.rb b/spec/requests/time_tables_spec.rb
index bd401dbbf..c935587b3 100644
--- a/spec/requests/time_tables_spec.rb
+++ b/spec/requests/time_tables_spec.rb
@@ -4,8 +4,7 @@ require 'spec_helper'
describe "TimeTables" do
login_user
- let(:referential) { create(:referential).switch }
- let(:time_tables) { referential; Array.new(2) { create(:time_table) } }
+ let(:time_tables) { Array.new(2) { create(:time_table) } }
subject { time_tables.first }
describe "list" do
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index ce52830b4..7f465ca11 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -20,10 +20,9 @@ require 'chouette_factories'
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
require 'will_paginate/array'
-require 'database_cleaner'
RSpec.configure do |config|
- DatabaseCleaner.logger = Rails.logger
+
# ## Mock Framework
#
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
@@ -45,28 +44,4 @@ RSpec.configure do |config|
# rspec-rails.
config.infer_base_class_for_anonymous_controllers = false
- config.before(:suite) do
- DatabaseCleaner.strategy = :transaction
-
- begin
- Apartment.database_names.each do |database|
- Apartment::Database.drop(database)
- end
- rescue
- # FIXME referentials table not found in jenkins build #13
- end
-
- DatabaseCleaner.clean_with(:truncation, {:except => %w[spatial_ref_sys geometry_columns]} )
- end
-
- config.before(:each) do
- Apartment::Database.switch(nil)
- DatabaseCleaner.start
- end
-
- config.after(:each) do
- DatabaseCleaner.clean
- Apartment::Database.switch(nil)
- end
-
end
diff --git a/spec/support/referential.rb b/spec/support/referential.rb
new file mode 100644
index 000000000..0d3a7b89a
--- /dev/null
+++ b/spec/support/referential.rb
@@ -0,0 +1,39 @@
+module ReferentialHelper
+
+ def first_referential
+ Referential.find_by_slug("first")
+ end
+
+ def self.included(base)
+ base.class_eval do
+ extend ClassMethods
+ alias_method :referential, :first_referential
+ end
+ end
+
+ module ClassMethods
+
+ def assign_referential
+ before(:each) do
+ assign :referential, referential
+ end
+ end
+
+ end
+
+end
+
+RSpec.configure do |config|
+ config.include ReferentialHelper
+
+ config.before(:suite) do
+ Referential.find_or_create_by_slug FactoryGirl.attributes_for(:referential, :slug => "first")
+ # FIXME in Rails 3.2 :
+ # Referential.where(:slug => 'first').first_or_create(FactoryGirl.attributes_for(:referential))
+ end
+
+ config.before(:each) do
+ first_referential.switch
+ end
+
+end
diff --git a/spec/views/companies/edit.html.erb_spec.rb b/spec/views/companies/edit.html.erb_spec.rb
index 22a561daf..0f7bde351 100644
--- a/spec/views/companies/edit.html.erb_spec.rb
+++ b/spec/views/companies/edit.html.erb_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe "/companies/edit" do
- let!(:referential) { assign(:referential, create(:referential)) }
+ assign_referential
let!(:company) { assign(:company, create(:company)) }
let!(:companies) { Array.new(2) { create(:company) } }
diff --git a/spec/views/companies/index.html.erb_spec.rb b/spec/views/companies/index.html.erb_spec.rb
index 23aa91def..686e8ab69 100644
--- a/spec/views/companies/index.html.erb_spec.rb
+++ b/spec/views/companies/index.html.erb_spec.rb
@@ -2,7 +2,7 @@ require 'spec_helper'
describe "/companies/index" do
- let!(:referential) { assign( :referential, create(:referential) ) }
+ assign_referential
let!(:companies) { assign :companies, Array.new(2) { create(:company) }.paginate }
let!(:search) { assign :q, Ransack::Search.new(Chouette::Company) }
diff --git a/spec/views/companies/new.html.erb_spec.rb b/spec/views/companies/new.html.erb_spec.rb
index a28e430f3..86f252cbd 100644
--- a/spec/views/companies/new.html.erb_spec.rb
+++ b/spec/views/companies/new.html.erb_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe "/companies/new" do
- let!(:referential) { assign(:referential, create(:referential)) }
+ assign_referential
let!(:company) { assign(:company, build(:company)) }
describe "form" do
diff --git a/spec/views/companies/show.html.erb_spec.rb b/spec/views/companies/show.html.erb_spec.rb
index 7bd20df8c..eea95a406 100644
--- a/spec/views/companies/show.html.erb_spec.rb
+++ b/spec/views/companies/show.html.erb_spec.rb
@@ -2,7 +2,7 @@ require 'spec_helper'
describe "/companies/show" do
- let!(:referential) { assign(:referential, create(:referential)) }
+ assign_referential
let!(:company) { assign(:company, create(:company)) }
it "should render h2 with the company name" do
diff --git a/spec/views/connection_links/edit.html.erb_spec.rb b/spec/views/connection_links/edit.html.erb_spec.rb
index 331529ff8..4294cd6c0 100644
--- a/spec/views/connection_links/edit.html.erb_spec.rb
+++ b/spec/views/connection_links/edit.html.erb_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe "/connection_links/edit" do
- let!(:referential) { assign(:referential, create(:referential)) }
+ assign_referential
let!(:connection_link) { assign(:connection_link, create(:connection_link)) }
let!(:connection_links) { Array.new(2) { create(:connection_link) } }
diff --git a/spec/views/connection_links/index.html.erb_spec.rb b/spec/views/connection_links/index.html.erb_spec.rb
index 9732c16c5..39671bdc1 100644
--- a/spec/views/connection_links/index.html.erb_spec.rb
+++ b/spec/views/connection_links/index.html.erb_spec.rb
@@ -2,7 +2,7 @@ require 'spec_helper'
describe "/connection_links/index" do
- let!(:referential) { assign( :referential, create(:referential) ) }
+ assign_referential
let!(:connection_links) { assign :connection_links, Array.new(2) { create(:connection_link) }.paginate }
let!(:search) { assign :q, Ransack::Search.new(Chouette::ConnectionLink) }
diff --git a/spec/views/connection_links/new.html.erb_spec.rb b/spec/views/connection_links/new.html.erb_spec.rb
index 1e9ee570d..c914fccbf 100644
--- a/spec/views/connection_links/new.html.erb_spec.rb
+++ b/spec/views/connection_links/new.html.erb_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe "/connection_links/new" do
- let!(:referential) { assign(:referential, create(:referential)) }
+ assign_referential
let!(:connection_link) { assign(:connection_link, build(:connection_link)) }
describe "form" do
diff --git a/spec/views/connection_links/show.html.erb_spec.rb b/spec/views/connection_links/show.html.erb_spec.rb
index 80d3adfb6..433ebc227 100644
--- a/spec/views/connection_links/show.html.erb_spec.rb
+++ b/spec/views/connection_links/show.html.erb_spec.rb
@@ -2,7 +2,7 @@ require 'spec_helper'
describe "/connection_links/show" do
- let!(:referential) { assign(:referential, create(:referential)) }
+ assign_referential
let!(:connection_link) { assign(:connection_link, create(:connection_link)) }
let!(:map) { assign(:map, mock(:to_html => '<div id="map"/>'.html_safe)) }
diff --git a/spec/views/imports/new.html.erb_spec.rb b/spec/views/imports/new.html.erb_spec.rb
index f12932353..dd39a06d5 100644
--- a/spec/views/imports/new.html.erb_spec.rb
+++ b/spec/views/imports/new.html.erb_spec.rb
@@ -2,7 +2,7 @@ require 'spec_helper'
describe "imports/new.html.erb" do
- let!(:referential) { assign(:referential, create(:referential)) }
+ assign_referential
let!(:import) { assign(:import, NeptuneImport.new) }
let!(:available_imports) { assign(:available_imports, []) }
diff --git a/spec/views/lines/edit.html.erb_spec.rb b/spec/views/lines/edit.html.erb_spec.rb
index ca17fbeab..9d733e600 100644
--- a/spec/views/lines/edit.html.erb_spec.rb
+++ b/spec/views/lines/edit.html.erb_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe "/lines/edit" do
- let!(:referential) { assign(:referential, create(:referential)) }
+ assign_referential
let!(:network) { create(:network) }
let!(:company) { create(:company) }
let!(:line) { assign(:line, create(:line, :network => network, :company => company)) }
diff --git a/spec/views/lines/index.html.erb_spec.rb b/spec/views/lines/index.html.erb_spec.rb
index 853da2103..2870e6b18 100644
--- a/spec/views/lines/index.html.erb_spec.rb
+++ b/spec/views/lines/index.html.erb_spec.rb
@@ -2,7 +2,7 @@ require 'spec_helper'
describe "/lines/index" do
- let!(:referential) { assign :referential, create(:referential) }
+ assign_referential
let!(:network) { create :network }
let!(:company) { create :company }
let!(:lines) { assign :lines, Array.new(2) { create(:line, :network => network, :company => company) }.paginate }
diff --git a/spec/views/lines/new.html.erb_spec.rb b/spec/views/lines/new.html.erb_spec.rb
index 7433162d1..cd436ffcf 100644
--- a/spec/views/lines/new.html.erb_spec.rb
+++ b/spec/views/lines/new.html.erb_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe "/lines/new" do
- let!(:referential) { assign(:referential, create(:referential)) }
+ assign_referential
let!(:network) { create(:network) }
let!(:company) { create(:company) }
let!(:line) { assign(:line, build(:line, :network => network, :company => company )) }
diff --git a/spec/views/lines/show.html.erb_spec.rb b/spec/views/lines/show.html.erb_spec.rb
index f77722672..5ef414c01 100644
--- a/spec/views/lines/show.html.erb_spec.rb
+++ b/spec/views/lines/show.html.erb_spec.rb
@@ -2,7 +2,7 @@ require 'spec_helper'
describe "/lines/show" do
- let!(:referential) { assign :referential, create(:referential) }
+ assign_referential
let!(:line) { assign :line, create(:line) }
let!(:routes) { assign :routes, Array.new(2) { create(:route, :line => line) }.paginate }
let!(:map) { assign(:map, mock(:to_html => '<div id="map"/>'.html_safe)) }
diff --git a/spec/views/networks/edit.html.erb_spec.rb b/spec/views/networks/edit.html.erb_spec.rb
index b8ea64288..2dab39089 100644
--- a/spec/views/networks/edit.html.erb_spec.rb
+++ b/spec/views/networks/edit.html.erb_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe "/networks/edit" do
- let!(:referential) { assign(:referential, create(:referential)) }
+ assign_referential
let!(:network) { assign(:network, create(:network) ) }
describe "test" do
diff --git a/spec/views/networks/index.html.erb_spec.rb b/spec/views/networks/index.html.erb_spec.rb
index 6e20c2c46..7e0c24fa5 100644
--- a/spec/views/networks/index.html.erb_spec.rb
+++ b/spec/views/networks/index.html.erb_spec.rb
@@ -2,7 +2,7 @@ require 'spec_helper'
describe "/networks/index" do
- let!(:referential) { assign :referential, create(:referential) }
+ assign_referential
let!(:networks) { assign :networks, Array.new(2){ create(:network) }.paginate }
let!(:search) { assign :q, Ransack::Search.new(Chouette::Network) }
diff --git a/spec/views/networks/new.html.erb_spec.rb b/spec/views/networks/new.html.erb_spec.rb
index 4a2551fcd..8299fdb0d 100644
--- a/spec/views/networks/new.html.erb_spec.rb
+++ b/spec/views/networks/new.html.erb_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe "/networks/new" do
- let!(:referential) { assign(:referential, create(:referential)) }
+ assign_referential
let!(:network) { assign(:network, build(:network)) }
describe "form" do
diff --git a/spec/views/networks/show.html.erb_spec.rb b/spec/views/networks/show.html.erb_spec.rb
index 08ecdd95d..a3aab1d9e 100644
--- a/spec/views/networks/show.html.erb_spec.rb
+++ b/spec/views/networks/show.html.erb_spec.rb
@@ -2,7 +2,7 @@ require 'spec_helper'
describe "/networks/show" do
- let!(:referential) { assign(:referential, create(:referential)) }
+ assign_referential
let!(:network) { assign(:network, create(:network)) }
let!(:map) { assign(:map, mock(:to_html => '<div id="map"/>'.html_safe)) }
diff --git a/spec/views/referentials/new.html.erb_spec.rb b/spec/views/referentials/new.html.erb_spec.rb
index dccd990cb..05766ad50 100644
--- a/spec/views/referentials/new.html.erb_spec.rb
+++ b/spec/views/referentials/new.html.erb_spec.rb
@@ -2,7 +2,7 @@ require 'spec_helper'
describe "referentials/new.html.erb" do
- let!(:referential) { assign(:referential, Referential.new) }
+ assign_referential
it "should have a textfield for name" do
render
diff --git a/spec/views/referentials/show.html.erb_spec.rb b/spec/views/referentials/show.html.erb_spec.rb
index 70518a270..e7f5427c2 100644
--- a/spec/views/referentials/show.html.erb_spec.rb
+++ b/spec/views/referentials/show.html.erb_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe "referentials/show.html.erb" do
- let!(:referential) { assign(:referential, create(:referential)) }
+ assign_referential
it "should have a title with name" do
render
diff --git a/spec/views/routes/show.html.erb_spec.rb b/spec/views/routes/show.html.erb_spec.rb
index 2f39adb9a..983b63fcb 100644
--- a/spec/views/routes/show.html.erb_spec.rb
+++ b/spec/views/routes/show.html.erb_spec.rb
@@ -2,7 +2,7 @@ require 'spec_helper'
describe "/routes/show" do
- let!(:referential) { assign :referential, create(:referential) }
+ assign_referential
let!(:line) { assign :line, create(:line) }
let!(:route) { assign :route, create(:route, :line => line) }
let!(:stop_points) { assign :stop_points, Array.new(2) { create(:stop_point) }.paginate }
diff --git a/spec/views/stop_areas/edit.html.erb_spec.rb b/spec/views/stop_areas/edit.html.erb_spec.rb
index 17e9ca104..5d3dac112 100644
--- a/spec/views/stop_areas/edit.html.erb_spec.rb
+++ b/spec/views/stop_areas/edit.html.erb_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe "/stop_areas/edit" do
- let!(:referential) { assign(:referential, create(:referential)) }
+ assign_referential
let!(:stop_area) { assign(:stop_area, create(:stop_area)) }
let!(:map) { assign(:map, mock(:to_html => '<div id="map"/>'.html_safe)) }
diff --git a/spec/views/stop_areas/index.html.erb_spec.rb b/spec/views/stop_areas/index.html.erb_spec.rb
index 3adecdd0d..d758304a2 100644
--- a/spec/views/stop_areas/index.html.erb_spec.rb
+++ b/spec/views/stop_areas/index.html.erb_spec.rb
@@ -2,7 +2,7 @@ require 'spec_helper'
describe "/stop_areas/index" do
- let!(:referential) { assign :referential, create(:referential) }
+ assign_referential
let!(:stop_areas) { assign :stop_areas, Array.new(2) { create(:stop_area) }.paginate }
let!(:q) { assign :q, Ransack::Search.new(Chouette::StopArea) }
diff --git a/spec/views/stop_areas/new.html.erb_spec.rb b/spec/views/stop_areas/new.html.erb_spec.rb
index be1b7593b..7366a9dc5 100644
--- a/spec/views/stop_areas/new.html.erb_spec.rb
+++ b/spec/views/stop_areas/new.html.erb_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe "/stop_areas/new" do
- let!(:referential) { assign(:referential, create(:referential)) }
+ assign_referential
let!(:stop_area) { assign(:stop_area, build(:stop_area)) }
describe "form" do
diff --git a/spec/views/stop_areas/show.html.erb_spec.rb b/spec/views/stop_areas/show.html.erb_spec.rb
index b4be2c5e0..19e3d9de0 100644
--- a/spec/views/stop_areas/show.html.erb_spec.rb
+++ b/spec/views/stop_areas/show.html.erb_spec.rb
@@ -2,7 +2,7 @@ require 'spec_helper'
describe "/stop_areas/show" do
- let!(:referential) { assign :referential, create(:referential) }
+ assign_referential
let!(:stop_area) { assign :stop_area, create(:stop_area) }
let!(:map) { assign(:map, mock(:to_html => '<div id="map"/>'.html_safe)) }
diff --git a/spec/views/time_tables/edit.html.erb_spec.rb b/spec/views/time_tables/edit.html.erb_spec.rb
index 6baf741fc..9c3cc485c 100644
--- a/spec/views/time_tables/edit.html.erb_spec.rb
+++ b/spec/views/time_tables/edit.html.erb_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe "/time_tables/edit" do
- let!(:referential) { assign(:referential, create(:referential)) }
+ assign_referential
let!(:time_table) { assign(:time_table, create(:time_table) ) }
describe "test" do
diff --git a/spec/views/time_tables/index.html.erb_spec.rb b/spec/views/time_tables/index.html.erb_spec.rb
index 7d56ad982..b8f1cb6d3 100644
--- a/spec/views/time_tables/index.html.erb_spec.rb
+++ b/spec/views/time_tables/index.html.erb_spec.rb
@@ -2,7 +2,7 @@ require 'spec_helper'
describe "/time_tables/index" do
- let!(:referential) { assign :referential, create(:referential) }
+ assign_referential
let!(:time_tables) { assign :time_tables, Array.new(2){ create(:time_table) }.paginate }
let!(:search) { assign :q, Ransack::Search.new(Chouette::TimeTable) }
diff --git a/spec/views/time_tables/new.html.erb_spec.rb b/spec/views/time_tables/new.html.erb_spec.rb
index dd7a35b3b..6ec28add3 100644
--- a/spec/views/time_tables/new.html.erb_spec.rb
+++ b/spec/views/time_tables/new.html.erb_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe "/time_tables/new" do
- let!(:referential) { assign(:referential, create(:referential)) }
+ assign_referential
let!(:time_table) { assign(:time_table, build(:time_table)) }
describe "form" do
diff --git a/spec/views/time_tables/show.html.erb_spec.rb b/spec/views/time_tables/show.html.erb_spec.rb
index 056919b2b..17449748b 100644
--- a/spec/views/time_tables/show.html.erb_spec.rb
+++ b/spec/views/time_tables/show.html.erb_spec.rb
@@ -2,7 +2,7 @@ require 'spec_helper'
describe "/time_tables/show" do
- let!(:referential) { assign(:referential, create(:referential)) }
+ assign_referential
let!(:time_table) { assign(:time_table, create(:time_table)) }
it "should render h2 with the time_table comment" do
diff --git a/spec/views/vehicle_journeys/_form.html.erb_spec.rb b/spec/views/vehicle_journeys/_form.html.erb_spec.rb
index 385de64c9..9cbeb76b0 100644
--- a/spec/views/vehicle_journeys/_form.html.erb_spec.rb
+++ b/spec/views/vehicle_journeys/_form.html.erb_spec.rb
@@ -2,7 +2,7 @@ require 'spec_helper'
describe "/vehicle_journeys/_form" do
- let!(:referential) { assign :referential, create(:referential) }
+ assign_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) }
@@ -49,7 +49,9 @@ describe "/vehicle_journeys/_form" do
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)
+ rendered.should have_selector("form") do
+ with_selector "input[type=text][objectid=][disabled=true]", vehicle_journey.objectid
+ end
end
end
context "when new vehicle_journey" do
@@ -57,7 +59,7 @@ describe "/vehicle_journeys/_form" do
it "should render an input for objectid" do
render
rendered.should have_selector("form") do
- with_selector "input[type=text][objectid=]", vehicle_journey.objectid
+ with_selector "input[type=text][objectid=][disabled=false]", vehicle_journey.objectid
end
end
end
diff --git a/spec/views/vehicle_journeys/_vehicle_journey_at_stop_fields.html.erb_spec.rb b/spec/views/vehicle_journeys/_vehicle_journey_at_stop_fields.html.erb_spec.rb
index 70b0fc4ef..e5ee0d635 100644
--- a/spec/views/vehicle_journeys/_vehicle_journey_at_stop_fields.html.erb_spec.rb
+++ b/spec/views/vehicle_journeys/_vehicle_journey_at_stop_fields.html.erb_spec.rb
@@ -2,7 +2,7 @@ require 'spec_helper'
describe "/vehicle_journeys/_vehicle_journey_at_stop_fields" do
- let!(:referential) { assign :referential, create(:referential) }
+ assign_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) }
@@ -49,9 +49,9 @@ describe "/vehicle_journeys/_vehicle_journey_at_stop_fields" do
rendered.should have_selector("tr.no_stop")
end
end
- context "for a destroyed vehicle_journey_at_stop" do
+ context "for a not destroyed vehicle_journey_at_stop" do
before(:each) do
- vehicle_journey_at_stop.stub!(:_destroy => true)
+ vehicle_journey_at_stop.stub!(:_destroy => false)
end
it "should not render tr.no_stop" do
render_collection
diff --git a/spec/views/vehicle_journeys/edit.html.erb_spec.rb b/spec/views/vehicle_journeys/edit.html.erb_spec.rb
index 7d69f3ec1..a3eb871e2 100644
--- a/spec/views/vehicle_journeys/edit.html.erb_spec.rb
+++ b/spec/views/vehicle_journeys/edit.html.erb_spec.rb
@@ -2,7 +2,7 @@ require 'spec_helper'
describe "/vehicle_journeys/edit" do
- let!(:referential) { assign :referential, create(:referential) }
+ assign_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) }
diff --git a/spec/views/vehicle_journeys/new.html.erb_spec.rb b/spec/views/vehicle_journeys/new.html.erb_spec.rb
index 152c48e46..495b667bd 100644
--- a/spec/views/vehicle_journeys/new.html.erb_spec.rb
+++ b/spec/views/vehicle_journeys/new.html.erb_spec.rb
@@ -2,7 +2,7 @@ require 'spec_helper'
describe "/vehicle_journeys/new" do
- let!(:referential) { assign :referential, create(:referential) }
+ assign_referential
let!(:line) { assign :line, create(:line) }
let!(:route) { assign :route, create(:route, :line => line) }
let!(:vehicle_journey) { assign :vehicle_journey, build(:vehicle_journey, :route => route) }