aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Florisson2012-06-25 21:36:03 +0200
committerMarc Florisson2012-06-25 21:36:03 +0200
commit8323bcc04d267946c8bdf664fd7d6d2253e3ae5f (patch)
tree17a278d1cd406a58b61d70ee7c926d089a304cf0
parent889d812612603b758c2e8aa0cd251826d36e364c (diff)
parentb42fdd1d710ab460bdbf607dd01ee5ded90827f8 (diff)
downloadchouette-core-8323bcc04d267946c8bdf664fd7d6d2253e3ae5f.tar.bz2
Merge branch 'master' of chouette.dryade.priv:/srv/git/chouette2
-rw-r--r--Gemfile19
-rw-r--r--Gemfile.github79
-rw-r--r--Gemfile.lock31
-rw-r--r--app/assets/javascripts/application.js3
-rw-r--r--app/assets/javascripts/exports.js.coffee15
-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/layout.css.scss16
-rw-r--r--app/assets/stylesheets/referentials.css.scss7
-rw-r--r--app/assets/stylesheets/stop_points.css.scss8
-rw-r--r--app/assets/stylesheets/token-input.css3
-rw-r--r--app/controllers/exports_controller.rb10
-rw-r--r--app/controllers/stop_area_children_controller.rb2
-rw-r--r--app/helpers/exports_helper.rb68
-rw-r--r--app/models/export.rb71
-rw-r--r--app/models/export_log_message.rb5
-rw-r--r--app/models/import_log_message.rb2
-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/exports/new.html.erb10
-rw-r--r--app/views/exports/new.js.coffee4
-rw-r--r--app/views/exports/show.html.erb11
-rw-r--r--app/views/help/index.textile21
-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/referentials/show.html.erb2
-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.erb9
-rw-r--r--app/views/vehicle_journeys/index.html.erb2
-rw-r--r--config/database.yml4
-rw-r--r--config/environments/development.rb2
-rw-r--r--config/environments/production.rb3
-rw-r--r--config/locales/exports.yml23
-rw-r--r--config/locales/formtastic.yml10
-rw-r--r--config/locales/fr.yml4
-rw-r--r--config/locales/layouts.yml4
-rw-r--r--config/routes.rb6
-rw-r--r--db/migrate/20120620064014_add_references_to_export.rb7
-rw-r--r--db/schema.rb5
-rw-r--r--spec/models/export_spec.rb88
54 files changed, 602 insertions, 306 deletions
diff --git a/Gemfile b/Gemfile
index 519bf4fd6..a1414957c 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,17 +1,17 @@
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'
-gem "jruby-rack-worker"
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
platforms :ruby do
@@ -22,24 +22,26 @@ end
gem "map_layers", "~> 0.0.4"
gem "georuby-ext", :git => 'git://github.com/dryade/georuby-ext.git'
+#gem 'user_interface', :git => 'git://github.com/dryade/user-interface.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.
@@ -48,7 +50,8 @@ group :assets do
gem 'coffee-rails', '~> 3.1.1'
gem 'coffee-script-source'
gem 'uglifier', '>= 1.0.3'
- gem 'therubyrhino'
+ gem 'therubyrhino', :platform => :jruby
+ gem 'therubyracer', :platform => :ruby
end
group :development do
@@ -69,7 +72,7 @@ end
group :test do
gem 'capybara'
gem 'launchy'
- gem 'database_cleaner'
+ gem 'database_cleaner', :git => 'git://github.com/dnagir/database_cleaner.git', :branch => 'postgre_jruby_issue'
gem 'factory_girl_rails', '1.7'
end
diff --git a/Gemfile.github b/Gemfile.github
new file mode 100644
index 000000000..5f9acce31
--- /dev/null
+++ b/Gemfile.github
@@ -0,0 +1,79 @@
+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'
+gem "jruby-rack-worker"
+
+platforms :jruby do
+ gem 'activerecord-jdbcpostgresql-adapter', :git => 'git://github.com/dryade/activerecord-jdbc-adapter.git'
+ gem 'activerecord-jdbcsqlite3-adapter'
+ gem 'jruby-openssl'
+ gem 'warbler'
+end
+
+platforms :ruby do
+ gem 'pg', '~> 0.11.0'
+ gem 'sqlite3'
+end
+
+gem "map_layers", "~> 0.0.4"
+gem "georuby-ext", :git => 'git://github.com/dryade/georuby-ext.git'
+
+gem 'user_interface', :git => 'git://github.com/dryade/user-interface.git'
+gem 'json'
+gem 'cocoon'
+gem 'formtastic', '2.0.2'
+gem 'inherited_resources'
+gem 'will_paginate', '~> 3.0'
+# gem 'will-paginate-i18n','~> 0.1.5'
+gem 'ransack'
+gem 'squeel'
+gem 'RedCloth'
+
+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://github.com/dryade/ninoxe.git'
+gem 'acts_as_list', '0.1.6'
+gem 'composite_primary_keys', '4.1.2'
+
+gem 'delayed_job_active_record'
+
+# Gems used only for assets and not required
+# in production environments by default.
+group :assets do
+ gem 'sass-rails', '= 3.1.4'
+ gem 'coffee-rails', '~> 3.1.1'
+ gem 'coffee-script-source'
+ gem 'uglifier', '>= 1.0.3'
+ gem 'therubyrhino'
+end
+
+group :development do
+ gem 'capistrano'
+ gem 'capistrano-ext'
+ gem 'guard'
+ gem 'guard-rspec'
+end
+
+group :test, :development do
+ gem "rspec"
+ gem "rspec-rails"
+ gem "remarkable", "~> 4.0.0.alpha4"
+ gem "remarkable_activerecord", "~> 4.0.0.alpha4"
+ gem "shoulda", :git => 'git://github.com/thoughtbot/shoulda.git'
+end
+
+group :test do
+ gem 'capybara'
+ gem 'launchy'
+ gem 'database_cleaner'
+ gem 'factory_girl_rails', '1.7'
+end
+
+group :production do
+ gem "SyslogLogger"
+end
+
diff --git a/Gemfile.lock b/Gemfile.lock
index 68889cf74..75db94035 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -11,6 +11,13 @@ GIT
rails (= 3.1.3)
GIT
+ remote: git://github.com/dnagir/database_cleaner.git
+ revision: 0c0aa44f13ae392000a6f506b62d5d1602cb4e53
+ branch: postgre_jruby_issue
+ specs:
+ database_cleaner (0.7.0)
+
+GIT
remote: git://github.com/dryade/activerecord-jdbc-adapter.git
revision: 0bf424bc3bcaf9f44646976cc4c1a8e9e57f11b4
specs:
@@ -62,7 +69,7 @@ GIT
GIT
remote: git://sim.dryade.priv/user_interface
- revision: c75665070cace889923bea6a0fb1f7ff724d1368
+ revision: 864d4d6e566674af74d37fc507985b31b03e239e
specs:
user_interface (0.0.1)
rails (~> 3.1.0)
@@ -139,7 +146,6 @@ GEM
coffee-script-source (1.3.3)
composite_primary_keys (4.1.2)
activerecord (~> 3.1)
- database_cleaner (0.8.0)
delayed_job (3.0.3)
activesupport (~> 3.0)
delayed_job_active_record (0.3.2)
@@ -163,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)
@@ -190,6 +196,7 @@ GEM
jruby-rack (1.1.6)
jruby-rack-worker (0.3-java)
jruby-rack (>= 1.0.1)
+ json (1.7.3)
json (1.7.3-java)
json_pure (1.7.3)
launchy (2.1.0)
@@ -198,6 +205,7 @@ GEM
addressable (~> 2.2.6)
ffi (~> 1.0.9)
spoon (~> 0.0.1)
+ libv8 (3.3.10.4)
libwebsocket (0.1.3)
addressable
listen (0.4.5)
@@ -209,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)
@@ -221,6 +231,7 @@ GEM
nokogiri (1.5.4)
nokogiri (1.5.4-java)
orm_adapter (0.0.7)
+ pg (0.11.0)
polyamorous (0.5.0)
activerecord (~> 3.0)
polyglot (0.3.3)
@@ -307,10 +318,13 @@ GEM
hike (~> 1.2)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
+ sqlite3 (1.3.6)
squeel (1.0.5)
activerecord (~> 3.0)
activesupport (~> 3.0)
polyamorous (~> 0.5.0)
+ therubyracer (0.10.1)
+ libv8 (~> 3.3.10)
therubyrhino (1.73.4)
thor (0.14.6)
tilt (1.3.3)
@@ -334,6 +348,7 @@ GEM
PLATFORMS
java
+ ruby
DEPENDENCIES
RedCloth
@@ -350,12 +365,12 @@ DEPENDENCIES
coffee-rails (~> 3.1.1)
coffee-script-source
composite_primary_keys (= 4.1.2)
- database_cleaner
+ database_cleaner!
delayed_job_active_record
devise
factory_girl_rails (= 1.7)
ffi-proj4!
- formtastic (= 2.0.2)
+ formtastic
georuby-ext!
guard
guard-rspec
@@ -366,6 +381,7 @@ DEPENDENCIES
json
launchy
map_layers (~> 0.0.4)
+ modernizr
ninoxe!
pg (~> 0.11.0)
rails (= 3.1.3)
@@ -378,6 +394,7 @@ DEPENDENCIES
shoulda!
sqlite3
squeel
+ therubyracer
therubyrhino
uglifier (>= 1.0.3)
user_interface!
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/exports.js.coffee b/app/assets/javascripts/exports.js.coffee
index 761567942..025f9fcce 100644
--- a/app/assets/javascripts/exports.js.coffee
+++ b/app/assets/javascripts/exports.js.coffee
@@ -1,3 +1,18 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
+
+jQuery ->
+ export_references_type_change = (event) ->
+ references_type = $("select option:selected").attr("value")
+
+ toggle_input = (li) ->
+ enabled = (li.data("type") == references_type)
+ # Hide li block
+ li.toggle(enabled)
+ # Disable textarea to ignore it in POST data
+ li.find("textarea").attr("disabled", ! enabled)
+
+ toggle_input($(li)) for li in $(".export_reference_ids")
+
+ $('#export_references_type').change(export_references_type_change)
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/layout.css.scss b/app/assets/stylesheets/layout.css.scss
index 10ab70fb8..79126e7ed 100644
--- a/app/assets/stylesheets/layout.css.scss
+++ b/app/assets/stylesheets/layout.css.scss
@@ -7,12 +7,16 @@ $text_color: #222;
@import "user_interface/layout";
-#header .infos div.title h1 {
- border: 1px solid white;
- font-size: 30px;
- margin: 20px 0 0 100px;
- padding: 3px 15px 3px 15px;
- font-weight: bold;
+#header .infos div.title
+{
+ margin: 20px 0 0 30px;
+
+ h1 {
+ font-family: "Comic Sans", "Comic Sans MS", cursive;
+ font-size: 32px;
+ font-weight: bold;
+ padding: 0px;
+ }
}
diff --git a/app/assets/stylesheets/referentials.css.scss b/app/assets/stylesheets/referentials.css.scss
index 721474cbd..dd03adb05 100644
--- a/app/assets/stylesheets/referentials.css.scss
+++ b/app/assets/stylesheets/referentials.css.scss
@@ -2,6 +2,13 @@
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
+#workspace.referentials.show
+{
+ .summary p label {
+ font-weight: bold;
+ }
+}
+
ul.logos {
margin: 30px 30px 0 0;
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/token-input.css b/app/assets/stylesheets/token-input.css
index 03bb01c4d..55a7f5656 100644
--- a/app/assets/stylesheets/token-input.css
+++ b/app/assets/stylesheets/token-input.css
@@ -111,3 +111,6 @@ div.token-input-dropdown ul li.token-input-selected-dropdown-item {
background-color: #d0efa0;
}
+form.formtastic .token-input-list {
+display: inline-block;
+} \ No newline at end of file
diff --git a/app/controllers/exports_controller.rb b/app/controllers/exports_controller.rb
index 6a77f7f45..ee7e186b9 100644
--- a/app/controllers/exports_controller.rb
+++ b/app/controllers/exports_controller.rb
@@ -1,6 +1,6 @@
class ExportsController < ChouetteController
- respond_to :html, :xml, :json
+ respond_to :html, :xml, :json, :js
respond_to :zip, :only => :show
belongs_to :referential
@@ -17,6 +17,14 @@ class ExportsController < ChouetteController
end
end
+ def references
+ @references = referential.send(params[:type]).where("name ilike ?", "%#{params[:q]}%")
+ respond_to do |format|
+ format.json do
+ render :json => @references.collect { |child| { :id => child.id, :name => child.name } }
+ end
+ end
+ end
protected
diff --git a/app/controllers/stop_area_children_controller.rb b/app/controllers/stop_area_children_controller.rb
index a3a59047f..111fcb93c 100644
--- a/app/controllers/stop_area_children_controller.rb
+++ b/app/controllers/stop_area_children_controller.rb
@@ -8,6 +8,8 @@ class StopAreaChildrenController < ChouetteController
end
end
+ protected
+
def children_maps
children.collect do |child|
{ :id => child.id.to_s, :name => "#{child.name} #{child.country_code}" }
diff --git a/app/helpers/exports_helper.rb b/app/helpers/exports_helper.rb
index bd84b9886..1b441f995 100644
--- a/app/helpers/exports_helper.rb
+++ b/app/helpers/exports_helper.rb
@@ -1,2 +1,70 @@
module ExportsHelper
+
+ @@export_references_type = {}
+ def export_references_type(type)
+ @@export_references_type[type] ||= ReferencesTypeHelper.new(type)
+ end
+
+ class ReferencesTypeHelper
+
+ attr_accessor :type
+
+ def initialize(type)
+ @type = type.to_s
+ end
+
+ def relation_name
+ Export.references_relation(type)
+ end
+
+ def input_id
+ "export_reference_#{relation_name}_ids"
+ end
+
+ end
+
+ def export_references_input(form, export, type)
+ ReferencesInput.new form, export, export_references_type(type)
+ end
+
+ class ReferencesInput
+
+ attr_accessor :form, :export, :type_helper
+ def initialize(form, export, type_helper)
+ @form, @export, @type_helper = form, export, type_helper
+ end
+
+ delegate :input_id, :type, :to => :type_helper
+
+ def current?
+ export.references_type == type
+ end
+
+ def references_map
+ references.collect { |child| { :id => child.id, :name => child.name } }
+ end
+
+ def wrapper_html_options
+ {
+ :class => "export_reference_ids",
+ :id => "#{input_id}_input",
+ :"data-type" => type,
+ :style => ("display: none" unless current?)
+ }
+ end
+
+ def input_html_options
+ {
+ :id => input_id,
+ :"data-pre" => ( references_map.to_json if current? ),
+ :disabled => (true unless current?)
+ }
+ end
+
+ def input
+ form.input :reference_ids, :as => :text, :wrapper_html => wrapper_html_options, :input_html => input_html_options
+ end
+
+ end
+
end
diff --git a/app/models/export.rb b/app/models/export.rb
index a202e77ef..401541a13 100644
--- a/app/models/export.rb
+++ b/app/models/export.rb
@@ -21,6 +21,10 @@ class Export < ActiveRecord::Base
end
end
+ def exporter
+ exporter ||= ::Chouette::Exporter.new(referential.slug)
+ end
+
def options
read_attribute(:options) || write_attribute(:options, {})
end
@@ -42,7 +46,18 @@ class Export < ActiveRecord::Base
end
def export_options
- { :export_id => self.id, :output_file => file }
+ { :export_id => self.id, :o => export_object_type }.tap do |options|
+ options[:id] = reference_ids.join(',') if reference_ids.present?
+ end
+ end
+
+ def export_object_type
+ case references_type
+ when "Chouette::Network"
+ "ptnetwork"
+ else
+ references_relation ? references_relation.singularize : "line"
+ end
end
before_validation :define_default_attributes, :on => :create
@@ -61,8 +76,7 @@ class Export < ActiveRecord::Base
begin
log_messages.create :key => :started
- # TODO
- # Make real export here
+ exporter.export file, export_options
update_attribute :status, "completed"
rescue => e
@@ -81,4 +95,55 @@ class Export < ActiveRecord::Base
end
end
+ @@references_types = [ Chouette::Line, Chouette::Network, Chouette::Company ]
+ cattr_reader :references_types
+
+ validates_inclusion_of :references_type, :in => references_types.map(&:to_s), :all_blank => true, :allow_nil => true
+
+ def references
+ if references_relation.present? and reference_ids.present?
+ referential.send(references_relation).find(reference_ids)
+ else
+ []
+ end
+ end
+
+ def references=(references)
+ unless references.blank?
+ self.references_type = references.first.class.name
+ self.reference_ids = references.map(&:id)
+ else
+ self.references_type = nil
+ self.reference_ids = []
+ end
+ end
+
+ def references_relation
+ if references_type.present?
+ relation = self.class.references_relation(references_type)
+ relation if referential.respond_to?(relation)
+ end
+ end
+
+ def self.references_relation(type)
+ type.to_s.demodulize.underscore.pluralize
+ end
+
+ def reference_ids
+ if raw_reference_ids
+ raw_reference_ids.split(',').map(&:to_i)
+ else
+ []
+ end
+ end
+
+ def reference_ids=(records)
+ records = Array(records)
+ write_attribute :reference_ids, (records.present? ? records.join(',') : nil)
+ end
+
+ def raw_reference_ids
+ read_attribute :reference_ids
+ end
+
end
diff --git a/app/models/export_log_message.rb b/app/models/export_log_message.rb
index 61068689c..8d6a09a6b 100644
--- a/app/models/export_log_message.rb
+++ b/app/models/export_log_message.rb
@@ -4,7 +4,7 @@ class ExportLogMessage < ActiveRecord::Base
acts_as_list :scope => :export
validates_presence_of :key
- validates_inclusion_of :severity, :in => %w{info warning error}
+ validates_inclusion_of :severity, :in => %w{info warning error ok uncheck fatal}
def arguments=(arguments)
write_attribute :arguments, (arguments.to_json if arguments.present?)
@@ -31,6 +31,7 @@ class ExportLogMessage < ActiveRecord::Base
end
def full_message
- I18n.translate key, arguments.symbolize_keys.merge(:scope => "export_log_messages.messages")
+ last_key=key.rpartition("|").last
+ I18n.translate last_key, arguments.symbolize_keys.merge(:scope => "export_log_messages.messages").merge(:default => :undefined).merge(:key => last_key)
end
end
diff --git a/app/models/import_log_message.rb b/app/models/import_log_message.rb
index f06a61213..ae331eb20 100644
--- a/app/models/import_log_message.rb
+++ b/app/models/import_log_message.rb
@@ -3,7 +3,7 @@ class ImportLogMessage < ActiveRecord::Base
acts_as_list :scope => :import
validates_presence_of :key
- validates_inclusion_of :severity, :in => %w{info warning error}
+ validates_inclusion_of :severity, :in => %w{info warning error ok uncheck fatal}
def arguments=(arguments)
write_attribute :arguments, (arguments.to_json if arguments.present?)
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/exports/new.html.erb b/app/views/exports/new.html.erb
index 24022e0f8..16c6e9720 100644
--- a/app/views/exports/new.html.erb
+++ b/app/views/exports/new.html.erb
@@ -1,9 +1,19 @@
<%= title_tag t(".title") %>
<%= semantic_form_for [@referential, @export], :as => :export, :url => referential_exports_path(@referential) do |form| %>
+ <%= form.inputs do %>
+ <%= form.input :references_type, :as => :select, :collection => Export.references_types.map { |c| [ c.model_name.human.capitalize.pluralize, c.name ] }, :include_blank => t(".all") %>
+
+ <% Export.references_types.each do |type| %>
+ <%= export_references_input(form, @export, type).input %>
+ <% end %>
+ <% end %>
+
<%= form.buttons do %>
<%= form.commit_button true %>
<li><%= t('or') %></li>
<li><%= link_to t('cancel'), :back %></li>
<% end %>
<% end %>
+
+<%= javascript_include_tag new_referential_export_path(@referential, :format => :js) %>
diff --git a/app/views/exports/new.js.coffee b/app/views/exports/new.js.coffee
new file mode 100644
index 000000000..198af96c8
--- /dev/null
+++ b/app/views/exports/new.js.coffee
@@ -0,0 +1,4 @@
+jQuery ->
+ <% Export.references_types.each do |type| %>
+ $("#<%= export_references_type(type).input_id %>" ).tokenInput('<%= references_referential_exports_path(@referential, :type => export_references_type(type).relation_name, :format => :json) %>', { prePopulate: $('#').data('pre'), minChars: 3 });
+ <% end %>
diff --git a/app/views/exports/show.html.erb b/app/views/exports/show.html.erb
index c3248b47a..21271c302 100644
--- a/app/views/exports/show.html.erb
+++ b/app/views/exports/show.html.erb
@@ -12,6 +12,16 @@
</p>
</div>
+ <% if @export.references.present? %>
+ <h3><%= Export.human_attribute_name(:references) %></h3>
+ <ul>
+ <% @export.references.each do |reference| %>
+ <li><%= link_to "#{reference.class.model_name.humanize} #{reference.name}", [@referential, reference] %>
+ <% end %>
+ </ul>
+ <% end %>
+
+ <% if @export.log_messages.present? %>
<h3><%= t(".report") %></h3>
<table>
<tr>
@@ -29,6 +39,7 @@
</tr>
<% end %>
</table>
+ <% end %>
</div>
<% content_for :sidebar do %>
diff --git a/app/views/help/index.textile b/app/views/help/index.textile
index bea9502ec..838689df3 100644
--- a/app/views/help/index.textile
+++ b/app/views/help/index.textile
@@ -3,7 +3,7 @@ layout: default
title: Présentation
---
-Chouette v2 : it&eacute;ration 7 du 04/06/2012
+Chouette v2 : it&eacute;ration 8 du 19/06/2012
Cette it&eacute;ration pr&eacute;sente les formulaires de :
@@ -11,11 +11,16 @@ Cette it&eacute;ration pr&eacute;sente les formulaires de :
* transporteurs
* lignes
** s&eacute;quences d'arr&ecirc;ts
-** missions
+*** missions
+*** courses/horaires
* arr&ecirc;ts
+** arr&ecirc;ts physiques
+** zones d'arr&ecirc;t
+** ITL
* calendriers d'application
* correspondances
-* imports Neptune
+* imports Neptune et CSV
+* exports Neptune
l'avancement actuel permet de :
@@ -25,20 +30,20 @@ l'avancement actuel permet de :
* d&eacute;placer un arr&ecirc;t depuis la carte (voir mode op&eacute;ratoire dans l'aide des arr&ecirc;ts)
* associer les arr&ecirc;ts &agrave; leurs parents
* ajouter des fils &agrave; un arr&ecirc;t
-* importer des lignes au format Neptune (fichier ZIP uniquement)
+* importer des lignes aux formats Neptune et CSV (zip et fichier non compress&eacute;)
+* exporter des lignes au format Neptune (zip)
* &eacute;diter des s&eacute;quences d'arr&ecirc;ts :
** ajouter, d&eacute;placer et retirer des arr&ecirc;ts dans la s&eacute;quence
** ajouter, modifier les missions de la s&eacute;quence
+** afficher, ajouter, modifier, supprimer des courses/horaires
* pr&eacute;ciser des param&egrave;tres g&eacute;n&eacute;raux de l'espace de donn&eacute;es
les actions suivantes ne sont pas encore disponible :
* afficher le fond G&eacute;oportail
-* associer une ITL &agrave; une ligne
-* imports &agrave; d'autres formats que Neptune
-* exports de donn&eacute;es
+* exports de donn&eacute;es &agrave; d'autres formats que Neptune (GTFS/CSV)
* d&eacute;finir l'emprise g&eacute;n&eacute;rale du r&eacute;seau
* g&eacute;rer le second r&eacute;f&eacute;rentiel de projection
-* consulter/cr&eacute;er/&eacute;diter les courses et les horaires
+* afficher des informations dans le tableau de bord
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 437aad3a7..4318d7484 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/referentials/show.html.erb b/app/views/referentials/show.html.erb
index e72c0ad06..2f2afdbed 100644
--- a/app/views/referentials/show.html.erb
+++ b/app/views/referentials/show.html.erb
@@ -1,6 +1,6 @@
<%= title_tag @referential.name %>
-<div>
+<div class="summary">
<p>
<label><%= Referential.human_attribute_name("slug") %>: </label>
<%= @referential.slug %>
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..f314e0453 100644
--- a/app/views/vehicle_journeys/_form.html.erb
+++ b/app/views/vehicle_journeys/_form.html.erb
@@ -48,11 +48,10 @@
<% 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? %>
diff --git a/app/views/vehicle_journeys/index.html.erb b/app/views/vehicle_journeys/index.html.erb
index dc0900b9e..d449c839d 100644
--- a/app/views/vehicle_journeys/index.html.erb
+++ b/app/views/vehicle_journeys/index.html.erb
@@ -87,4 +87,4 @@
<%= render :partial => "time_filter", :locals => { :time_field => "departure_time"} %>
<% end %>
-
+<% end %>
diff --git a/config/database.yml b/config/database.yml
index a3e357d3a..599c581da 100644
--- a/config/database.yml
+++ b/config/database.yml
@@ -5,7 +5,7 @@
# gem 'activerecord-jdbcsqlite3-adapter'
#
development:
- adapter: jdbcpostgresql
+ adapter: <%= RUBY_PLATFORM == "java" ? "jdbcpostgresql" : "postgresql" %>
database: chouette_dev
encoding: utf8
username: chouette
@@ -15,7 +15,7 @@ development:
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
- adapter: jdbcpostgresql
+ adapter: <%= RUBY_PLATFORM == "java" ? "jdbcpostgresql" : "postgresql" %>
database: chouette_test
encoding: utf8
username: chouette
diff --git a/config/environments/development.rb b/config/environments/development.rb
index 250c17def..73606fc10 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -26,7 +26,7 @@ ChouetteIhm::Application.configure do
config.assets.compress = false
# Expands the lines which load the assets
- config.assets.debug = true
+ config.assets.debug = false
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
diff --git a/config/environments/production.rb b/config/environments/production.rb
index ffbd6be76..d9e41624c 100644
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -65,8 +65,9 @@ ChouetteIhm::Application.configure do
config.action_mailer.default_url_options = { :host => 'chouette.dryade.net/chouette2' }
config.to_prepare do
- Chouette::Command.command = "/usr/local/lib/chouette-command/chouette"
+ Chouette::Command.command = "/usr/local/opt/chouette-command/chouette-gui-2.0.0/chouette"
Import.root = "/var/lib/chouette/imports"
+ Export.root = "/var/lib/chouette/exports"
end
end
diff --git a/config/locales/exports.yml b/config/locales/exports.yml
index 74b7cd387..bf943c8af 100644
--- a/config/locales/exports.yml
+++ b/config/locales/exports.yml
@@ -7,6 +7,7 @@ en:
download: Download
new:
title: New export
+ all: All
index:
title: Exports
show:
@@ -20,10 +21,15 @@ en:
started: Started export
completed: Completed export
failed: Failed export
+ undefined: %{key} undefined
+ NEPTUNE_EXPORT: Neptune Export
+ NEPTUNE_EXPORTED_LINE: "Line %{0} (%{1}) exported"
severities:
info: Information
+ ok: Ok
warning: Warning
error: Error
+ fatal: Fatal
activerecord:
models:
export:
@@ -33,6 +39,8 @@ en:
attributes:
export:
status: Status
+ references_type: Associated Data Type
+ reference_ids: Associated Data
export_log_message:
created_at: Date
position: N.
@@ -46,6 +54,7 @@ fr:
download: Télécharger
new:
title: Nouvel export
+ all: Toutes
index:
title: Exports
show:
@@ -59,13 +68,21 @@ fr:
started: Export démarré
completed: Export achevé avec succès
failed: Export interromptu
+ undefined: %{key} non défini
+ NEPTUNE_EXPORT: Export Neptune
+ NEPTUNE_EXPORTED_LINE: "Ligne %{0} (%{1}) exportée"
severities:
info: Information
+ ok: Ok
warning: Alerte
error: Erreur
+ fatal: Fatal
activerecord:
- models:
- export: Export
+ models:
+ export:
+ zero: export
+ one: export
+ other: exports
neptune_export:
zero: Export Neptune
one: Export Neptune
@@ -73,6 +90,8 @@ fr:
attributes:
export:
status: Status
+ references_type: Type de données incluses
+ reference_ids: Données incluses
export_log_message:
created_at: Date
position: "No"
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/layouts.yml b/config/locales/layouts.yml
index d4b78e014..a665578c1 100644
--- a/config/locales/layouts.yml
+++ b/config/locales/layouts.yml
@@ -7,7 +7,7 @@ en:
profile: "My Profile"
sign_out: "Sign out"
tabs:
- dashboard: "Dashboard"
+ dashboard: "dashboard"
fr:
layouts:
back_to_dashboard: "Retour au Tableau de Bord"
@@ -17,4 +17,4 @@ fr:
profile: "Mon Profil"
sign_out: "Déconnexion"
tabs:
- dashboard: "Tableau de bord"
+ dashboard: "tableau de bord"
diff --git a/config/routes.rb b/config/routes.rb
index 313c52106..620c1d879 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -46,7 +46,11 @@ ChouetteIhm::Application.routes.draw do
end
resources :imports
- resources :exports
+ resources :exports do
+ collection do
+ get 'references'
+ end
+ end
resources :companies, :stop_areas
diff --git a/db/migrate/20120620064014_add_references_to_export.rb b/db/migrate/20120620064014_add_references_to_export.rb
new file mode 100644
index 000000000..c993c1c5d
--- /dev/null
+++ b/db/migrate/20120620064014_add_references_to_export.rb
@@ -0,0 +1,7 @@
+class AddReferencesToExport < ActiveRecord::Migration
+ def change
+ change_table :exports do |t|
+ t.string :references_type, :reference_ids
+ end
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 7d1d92845..fe3bcd594 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -10,7 +10,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20120612071936) do
+ActiveRecord::Schema.define(:version => 20120620064014) do
create_table "access_links", :force => true do |t|
t.integer "access_point_id", :limit => 8
@@ -139,6 +139,8 @@ ActiveRecord::Schema.define(:version => 20120612071936) do
t.string "options"
t.datetime "created_at"
t.datetime "updated_at"
+ t.string "references_type"
+ t.string "reference_ids"
end
add_index "exports", ["referential_id"], :name => "index_exports_on_referential_id"
@@ -297,7 +299,6 @@ ActiveRecord::Schema.define(:version => 20120612071936) do
t.datetime "updated_at"
t.string "prefix"
t.string "projection_type"
- t.string "bounding_box", :limit => nil
t.string "time_zone"
end
diff --git a/spec/models/export_spec.rb b/spec/models/export_spec.rb
index bccaa4c42..4e6a748ed 100644
--- a/spec/models/export_spec.rb
+++ b/spec/models/export_spec.rb
@@ -60,4 +60,92 @@ describe Export do
end
+ describe "#references" do
+
+ it "should be empty if references_type is nil" do
+ subject.references_type = nil
+ subject.references.should be_empty
+ end
+
+ it "should be empty if reference_ids is blank" do
+ subject.reference_ids = ""
+ subject.references.should be_empty
+ end
+
+ end
+
+ describe "#references=" do
+
+ context "with Lines" do
+
+ let(:lines) { create_list :line, 3 }
+
+ before(:each) do
+ subject.references = lines
+ end
+
+ it "should use 'Chouette::Line' as references_type" do
+ subject.references_type.should == 'Chouette::Line'
+ end
+
+ it "should use line identifiers as raw reference_ids" do
+ subject.raw_reference_ids.should == lines.map(&:id).join(',')
+ end
+
+ end
+
+ end
+
+ describe "#references_relation" do
+
+ it "should be 'lines' when relation_type is 'Chouette::Line'" do
+ subject.references_type = "Chouette::Line"
+ subject.references_relation.should == "lines"
+ end
+
+ it "should be 'networks' when relation_type is 'Chouette::Network'" do
+ subject.references_type = "Chouette::Network"
+ subject.references_relation.should == "networks"
+ end
+
+ it "should be nil when relation_type is blank" do
+ subject.references_type = ""
+ subject.references_relation.should be_nil
+ end
+
+ it "should be nil when relation_type is 'dummy'" do
+ subject.references_type = "dummy"
+ subject.references_relation.should be_nil
+ end
+
+ end
+
+ describe "#reference_ids" do
+
+ it "should parse raw_reference_ids and returns ids" do
+ subject.stub :raw_reference_ids => "1,2,3"
+ subject.reference_ids.should == [1,2,3]
+ end
+
+ it "should be empty if raw_reference_ids is blank" do
+ subject.stub :raw_reference_ids => ""
+ subject.reference_ids.should be_empty
+ end
+
+ end
+
+ describe "#reference_ids=" do
+
+ it "should join ids with comma" do
+ subject.reference_ids = [1,2,3]
+ subject.raw_reference_ids.should == "1,2,3"
+ end
+
+ it "should be nil if records is blank" do
+ subject.reference_ids = []
+ subject.raw_reference_ids.should be_nil
+ end
+
+ end
+
end