diff options
| author | Zakaria BOUZIANE | 2015-03-09 14:40:32 +0100 |
|---|---|---|
| committer | Zakaria BOUZIANE | 2015-03-09 14:40:32 +0100 |
| commit | 05fb2b7aa8ca7d490a8960a096de7d934fffe133 (patch) | |
| tree | 9b6666380cdbd2eff1f79c79d97fbd302a768006 | |
| parent | 0d5adf2fad5c0ddd8efc1eca9dc6d8e9c48b049d (diff) | |
| parent | a5f66f953120c08951b6338ad0f743c2d0eec86e (diff) | |
| download | chouette-core-05fb2b7aa8ca7d490a8960a096de7d934fffe133.tar.bz2 | |
Solving merge V2_5 pbs
111 files changed, 1620 insertions, 409 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index b5941b139..4cc071921 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,14 +1,27 @@ +# Version 2.5.3 (en cours) +* Nouvelles fonctionnalités + * Contrôle de cohérence des communes des arrêts (Mantis 31896) + * Ajout de champs dans les échanges Neptune en structurant le champ commentaire (Mantis 31897) + * ajout de notes dans les lignes et de leur références dans les courses pour les échanges hub + # Version 2.5.2 (20/01/15) -* Nouvelles foctionnalités +* Nouvelles fonctionnalités * Amélioration de l'export Hub * Ajout de points de contrôle pour la validation * Ajouts de champs pour les échanges Hub + * Ajout de Metadata à l'export (Neptune/NeTEx/GTFS) +* Améliorations + * Optimisation de jaxb +* Corrections + * Détection d'absence de fin de ligne en fin de fichier gtfs (Mantis 30988) # Version 2.5.1 (14/11/14) * Nouvelles fonctionnalités * Reprise des imports/exports GTFS * Ajout des couleurs de lignes * Ajouts de champs pour les échanges GTFS +* Améliorations + * Complétude du javadoc pour chouette-model # Version 2.5.0 (23/10/14) * Nouvelles fonctionnalités @@ -111,11 +111,13 @@ gem 'google-analytics-rails' gem 'will_paginate', '~> 3.0.7' gem 'ransack' gem 'squeel' + gem 'enumerize', '~> 0.10.0' gem 'ninoxe', :git => 'https://github.com/afimb/ninoxe.git', :branch => "rails4" #gem 'ninoxe', :git => 'https://github.com/afimb/ninoxe.git' #gem 'ninoxe',:path => '~/Projets/cityway/ninoxe' +#gem 'ninoxe', '1.1.5' gem 'acts_as_list', '~> 0.6.0' gem "acts_as_tree", '~> 2.1.0', :require => "acts_as_tree" diff --git a/Gemfile.lock b/Gemfile.lock index 13bbe6635..7af94576d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,9 +1,9 @@ GIT remote: https://github.com/afimb/ninoxe.git - revision: 05544f2d54436a7acb2985089790d071798f4de5 + revision: 7ebe2200b31f5a89498875b694f707e7c4004cfd branch: rails4 specs: - ninoxe (1.1.3) + ninoxe (1.1.5) activerecord (~> 4.1.1) acts-as-taggable-on (>= 3) acts_as_list (>= 0.1.6) @@ -18,8 +18,7 @@ GEM remote: https://rails-assets.org/ specs: RedCloth (4.2.9) - RedCloth (4.2.9-java) - SyslogLogger (1.4.1) + SyslogLogger (2.0) actionmailer (4.1.9) actionpack (= 4.1.9) actionview (= 4.1.9) @@ -40,24 +39,19 @@ GEM activemodel (= 4.1.9) activesupport (= 4.1.9) arel (~> 5.0.0) - activerecord-jdbc-adapter (1.3.13) - activerecord (>= 2.2) - activerecord-jdbcpostgresql-adapter (1.3.13) - activerecord-jdbc-adapter (~> 1.3.13) - jdbc-postgres (>= 9.1) activesupport (4.1.9) i18n (~> 0.6, >= 0.6.9) json (~> 1.7, >= 1.7.7) minitest (~> 5.1) thread_safe (~> 0.1) tzinfo (~> 1.1) - acts-as-taggable-on (3.4.4) + acts-as-taggable-on (3.5.0) activerecord (>= 3.2, < 5) acts_as_list (0.6.0) activerecord (>= 3.0) acts_as_tree (2.1.0) activerecord (>= 3.0.0) - addressable (2.3.5) + addressable (2.3.7) apartment (0.26.1) activerecord (>= 3.1.2, < 5.0) rack (>= 1.3.6) @@ -65,19 +59,16 @@ GEM ast (2.0.0) astrolabe (1.3.0) parser (>= 2.2.0.pre.3, < 3.0) - bcrypt (3.1.9) - bcrypt (3.1.9-java) + bcrypt (3.1.10) breadcrumbs_on_rails (2.3.0) builder (3.2.2) calendar_helper (0.2.5) open4 callsite (0.0.11) - capistrano (2.13.5) - highline - net-scp (>= 1.0.0) - net-sftp (>= 2.0.0) - net-ssh (>= 2.0.14) - net-ssh-gateway (>= 1.1.0) + capistrano (3.4.0) + i18n + rake (>= 10.0.0) + sshkit (~> 1.3) capistrano-ext (1.2.1) capistrano (>= 1.0.0) capybara (2.4.4) @@ -98,11 +89,12 @@ GEM coffee-script (2.3.0) coffee-script-source execjs - coffee-script-source (1.8.0) + coffee-script-source (1.9.1) + colorize (0.7.5) daemons (1.1.9) database_cleaner (1.4.0) - dbf (2.0.8) - fastercsv (~> 1.5.4) + dbf (2.0.9) + fastercsv (~> 1.5) deep_cloneable (2.0.2) activerecord (>= 3.1.0, < 5.0.0) delayed_job (4.0.6) @@ -119,17 +111,17 @@ GEM warden (~> 1.2.3) devise-encryptable (0.2.0) devise (>= 2.1.0) - devise-i18n (0.11.3) - devise_invitable (1.4.0) + devise-i18n (0.11.4) + devise_invitable (1.4.1) actionmailer (>= 3.2.6, < 5) devise (>= 3.2.0) diff-lcs (1.2.5) dr-ffi-proj4 (0.0.3) ffi (>= 1.0.0) - enumerize (0.10.0) + enumerize (0.10.1) activesupport (>= 3.2) erubis (2.7.0) - execjs (2.2.2) + execjs (2.4.0) factory_girl (4.5.0) activesupport (>= 3.0.0) factory_girl_rails (4.5.0) @@ -141,10 +133,9 @@ GEM faraday (>= 0.7.4, < 0.10) fastercsv (1.5.5) ffi (1.9.6) - ffi (1.9.6-java) ffi-geos (1.0.0) ffi (>= 1.0.0) - font-awesome-sass (4.2.0) + font-awesome-sass (4.2.2) sass (~> 3.2) foreigner (1.6.0) activerecord (>= 3.0.0) @@ -162,38 +153,37 @@ GEM geokit (= 1.6.7) georuby (>= 1.9.8) rgeo (>= 0.3.20) - google-analytics-rails (0.0.4) - guard (2.10.5) + google-analytics-rails (0.0.6) + guard (2.12.4) formatador (>= 0.2.4) listen (~> 2.7) lumberjack (~> 1.0) nenv (~> 0.1) + notiffany (~> 0.0) pry (>= 0.9.12) + shellany (~> 0.0) thor (>= 0.18.1) - guard-compat (1.2.0) + guard-compat (1.2.1) guard-rspec (4.5.0) guard (~> 2.1) guard-compat (~> 1.1) rspec (>= 2.99.0, < 4.0) - has_scope (0.6.0.rc) + has_scope (0.6.0) actionpack (>= 3.2, < 5) activesupport (>= 3.2, < 5) hashie (3.4.0) - highline (1.6.15) hike (1.2.3) hitimes (1.2.2) - hitimes (1.2.2-java) i18n (0.7.0) - inherited_resources (1.5.1) - actionpack (>= 3.2, < 4.2) + inherited_resources (1.6.0) + actionpack (>= 3.2, < 5) has_scope (~> 0.6.0.rc) - railties (>= 3.2, < 4.2) - responders (~> 1.0) - jbuilder (2.2.6) + railties (>= 3.2, < 5) + responders + jbuilder (2.2.11) activesupport (>= 3.0.0, < 5) multi_json (~> 1.2) - jdbc-postgres (9.3.1102) - jquery-rails (2.2.1) + jquery-rails (3.1.2) railties (>= 3.0, < 5.0) thor (>= 0.14, < 2.0) jquery-ui-rails (4.0.3) @@ -203,20 +193,14 @@ GEM jquery-rails jquery-ui-rails (= 4.0.3) railties (>= 3.1.0) - jruby-jars (1.7.16.1) - jruby-openssl (0.9.5-java) - jruby-rack (1.1.16) - jruby-rack-worker (0.10.0) - jruby-rack (>= 1.1.10) json (1.8.2) - json (1.8.2-java) kleisli (0.2.6) language_engine (0.0.6) rails (~> 4.1.1) - launchy (2.3.0) + launchy (2.4.3) addressable (~> 2.3) libv8 (3.3.10.4) - listen (2.8.4) + listen (2.8.6) celluloid (>= 0.15.2) rb-fsevent (>= 0.9.3) rb-inotify (>= 0.9) @@ -233,27 +217,24 @@ GEM mini_portile (0.6.2) minitest (5.5.1) modernizr-rails (2.0.6) - morrisjs-rails (0.4.3) + morrisjs-rails (0.5.1) railties (> 3.1, < 5) - multi_json (1.10.1) + multi_json (1.11.0) multipart-post (2.0.0) - nenv (0.1.1) - net-scp (1.0.4) - net-ssh (>= 1.99.1) - net-sftp (2.0.5) - net-ssh (>= 2.0.9) - net-ssh (2.6.2) - net-ssh-gateway (1.1.0) - net-ssh (>= 1.99.1) + nenv (0.2.0) + net-scp (1.2.1) + net-ssh (>= 2.6.5) + net-ssh (2.9.2) nokogiri (1.6.6.2) mini_portile (~> 0.6.0) - nokogiri (1.6.6.2-java) - open4 (1.3.0) + notiffany (0.0.6) + nenv (~> 0.1) + shellany (~> 0.0) + open4 (1.3.4) orm_adapter (0.5.0) - parser (2.2.0.pre.7) + parser (2.2.0.3) ast (>= 1.1, < 3.0) - slop (~> 3.4, >= 3.4.5) - pg (0.17.1) + pg (0.18.1) poltergeist (1.6.0) capybara (~> 2.1) cliver (~> 0.3.1) @@ -265,12 +246,7 @@ GEM coderay (~> 1.1.0) method_source (~> 0.8.1) slop (~> 3.4) - pry (0.10.1-java) - coderay (~> 1.1.0) - method_source (~> 0.8.1) - slop (~> 3.4) - spoon (~> 0.0) - rabl (0.11.4) + rabl (0.11.6) activesupport (>= 2.3.14) rack (1.5.2) rack-contrib (1.2.0) @@ -289,16 +265,16 @@ GEM sprockets-rails (~> 2.0) rails-assets-bootstrap (3.1.1) rails-assets-jquery (>= 1.9.0) - rails-assets-bootstrap-sass-official (3.3.0) + rails-assets-bootstrap-sass-official (3.3.3) rails-assets-jquery (>= 1.9.0) rails-assets-eonasdan-bootstrap-datetimepicker (3.1.3) rails-assets-bootstrap (>= 3.0) rails-assets-jquery (>= 1.8.3) rails-assets-moment (>= 2.8.0) - rails-assets-jquery (2.1.1) + rails-assets-jquery (2.1.3) rails-assets-jquery-tokeninput (1.7.0) rails-assets-jquery (>= 1.5) - rails-assets-moment (2.8.3) + rails-assets-moment (2.9.0) rails-assets-respond (1.4.2) rails-assets-tagmanager (3.0.1) rails-assets-jquery (>= 1.0.0) @@ -307,12 +283,12 @@ GEM rails-assets-typeahead.js-bootstrap3.less (0.2.3) rails-assets-bootstrap (~> 3.1.0) rails-assets-typeahead.js (~> 0.10.0) - rails-erd (1.1.0) - activerecord (>= 3.0) - activesupport (>= 3.0) + rails-erd (1.3.1) + activerecord (>= 3.2) + activesupport (>= 3.2) choice (~> 0.1.6) ruby-graphviz (~> 1.0.4) - rails-i18n (4.0.3) + rails-i18n (4.0.4) i18n (~> 0.6) railties (~> 4.0) railties (4.1.9) @@ -322,7 +298,7 @@ GEM thor (>= 0.18.1, < 2.0) rainbow (2.0.0) rake (10.4.2) - ransack (1.4.1) + ransack (1.6.3) actionpack (>= 3.0) activerecord (>= 3.0) activesupport (>= 3.0) @@ -362,8 +338,8 @@ GEM rspec-support (~> 3.1.0) rspec-support (3.1.2) ruby-graphviz (1.0.9) - ruby-ole (1.2.11.7) - rubyzip (1.1.6) + ruby-ole (1.2.11.8) + rubyzip (1.1.7) sass (3.2.19) sass-rails (4.0.5) railties (>= 4.0.0, < 5.0) @@ -373,17 +349,16 @@ GEM sdoc (0.4.1) json (~> 1.7, >= 1.7.7) rdoc (~> 4.0) + shellany (0.0.1) simple_form (3.1.0) actionpack (~> 4.0) activemodel (~> 4.0) sitemap_generator (5.0.5) builder slop (3.6.0) - spoon (0.0.4) - ffi - spreadsheet (0.9.7) + spreadsheet (1.0.2) ruby-ole (>= 1.0) - spring (1.2.0) + spring (1.3.3) sprockets (2.12.3) hike (~> 1.2) multi_json (~> 1.0) @@ -393,48 +368,41 @@ GEM actionpack (>= 3.0) activesupport (>= 3.0) sprockets (>= 2.8, < 4.0) - sqlite3 (1.3.6) - squeel (1.2.1) + sqlite3 (1.3.10) + squeel (1.2.3) activerecord (>= 3.0) activesupport (>= 3.0) polyamorous (~> 1.1.0) + sshkit (1.7.1) + colorize (>= 0.7.0) + net-scp (>= 1.1.2) + net-ssh (>= 2.8.0) therubyracer (0.10.2) libv8 (~> 3.3.10) - therubyrhino (2.0.4) - therubyrhino_jar (>= 1.7.3) - therubyrhino_jar (1.7.4) thor (0.19.1) thread_safe (0.3.4) - thread_safe (0.3.4-java) tilt (1.4.1) timers (4.0.1) hitimes - transpec (2.3.7) + transpec (3.1.0) activesupport (>= 3.0, < 5.0) astrolabe (~> 1.2) bundler (~> 1.3) json (~> 1.8) - parser (>= 2.2.0.pre.3, < 3.0) + parser (~> 2.2) rainbow (>= 1.99.1, < 3.0) turbolinks (2.5.3) coffee-rails tzinfo (1.2.2) thread_safe (~> 0.1) - uglifier (2.6.1) + uglifier (2.7.1) execjs (>= 0.3.0) json (>= 1.8.0) - warbler (1.4.4) - jruby-jars (>= 1.5.6, < 2.0) - jruby-rack (>= 1.0.0) - rake (>= 0.9.6) - rubyzip (>= 0.9, < 1.2) warden (1.2.3) rack (>= 1.0) - websocket-driver (0.5.1) - websocket-extensions (>= 0.1.0) - websocket-driver (0.5.1-java) + websocket-driver (0.5.3) websocket-extensions (>= 0.1.0) - websocket-extensions (0.1.1) + websocket-extensions (0.1.2) will_paginate (3.0.7) will_paginate-bootstrap (1.0.1) will_paginate (>= 3.0.3) @@ -442,7 +410,6 @@ GEM nokogiri (~> 1.3) PLATFORMS - java ruby DEPENDENCIES diff --git a/app/assets/stylesheets/main/lines.css.scss b/app/assets/stylesheets/main/lines.css.scss index 6e2f14dc5..94201212a 100644 --- a/app/assets/stylesheets/main/lines.css.scss +++ b/app/assets/stylesheets/main/lines.css.scss @@ -26,6 +26,14 @@ #line_color_old{ width: 100px; color: white; font-weight: bold;} + + .nested-fields.footnote, .add_footnote{ + @extend .col-md-offset-3; + } + + .footnotes_block{ + margin-bottom: 30px; + } } #workspace.lines.show diff --git a/app/assets/stylesheets/vendor/formtastic_changes.css.scss b/app/assets/stylesheets/vendor/formtastic_changes.css.scss index d64d6925f..7eb6b10c5 100644 --- a/app/assets/stylesheets/vendor/formtastic_changes.css.scss +++ b/app/assets/stylesheets/vendor/formtastic_changes.css.scss @@ -29,10 +29,6 @@ font-size: 14px !important; width: 100% !important; } - - .choice label input{ - margin: 0px 0px 0px -20px !important; - } .token-input-list { display: inline-block; diff --git a/app/controllers/referentials_controller.rb b/app/controllers/referentials_controller.rb index 643c780a4..a0ca4b4ea 100644 --- a/app/controllers/referentials_controller.rb +++ b/app/controllers/referentials_controller.rb @@ -1,11 +1,17 @@ class ReferentialsController < BreadcrumbController defaults :resource_class => Referential - + respond_to :html respond_to :json, :only => :show respond_to :js, :only => :show + def new + new! do + @referential.data_format = current_organisation.data_format + end + end + def show resource.switch show! do |format| @@ -17,7 +23,7 @@ class ReferentialsController < BreadcrumbController :referential_id => resource.id} } format.html { build_breadcrumb :show} - + end end diff --git a/app/controllers/routes_controller.rb b/app/controllers/routes_controller.rb index afaa8adba..6dfaf3dd0 100644 --- a/app/controllers/routes_controller.rb +++ b/app/controllers/routes_controller.rb @@ -9,7 +9,7 @@ class RoutesController < ChouetteController belongs_to :line, :parent_class => Chouette::Line, :optional => true, :polymorphic => true end - def index + def index index! do |format| format.html { redirect_to referential_line_path(@referential,@line) } end @@ -28,16 +28,15 @@ class RoutesController < ChouetteController render "edit_boarding_alighting" end end - + def show @map = RouteMap.new(route).with_helpers(self) - @stop_points = route.stop_points.paginate(:page => params[:page]) show! do build_breadcrumb :show end end - # overwrite inherited resources to use delete instead of destroy + # overwrite inherited resources to use delete instead of destroy # foreign keys will propagate deletion) def destroy_resource(object) object.delete @@ -52,6 +51,7 @@ class RoutesController < ChouetteController def create create! do |success, failure| success.html { redirect_to referential_line_path(@referential,@line) } + failure.html { flash[:alert] = route.errors[:flash]; render :action => :new } end end @@ -66,7 +66,7 @@ class RoutesController < ChouetteController def collection @q = parent.routes.search(params[:q]) - @routes ||= + @routes ||= begin routes = @q.result(:distinct => true).order(:name) routes = routes.paginate(:page => params[:page]) if @per_page.present? diff --git a/app/controllers/rule_parameter_sets_controller.rb b/app/controllers/rule_parameter_sets_controller.rb index a422bed15..7741411fe 100644 --- a/app/controllers/rule_parameter_sets_controller.rb +++ b/app/controllers/rule_parameter_sets_controller.rb @@ -1,29 +1,50 @@ -class RuleParameterSetsController < ChouetteController +class RuleParameterSetsController < BreadcrumbController defaults :resource_class => RuleParameterSet respond_to :html respond_to :js, :only => [ :mode ] - belongs_to :referential - def new - @rule_parameter_set = RuleParameterSet.default( @referential) + @rule_parameter_set = RuleParameterSet.default( current_organisation) new! do - build_breadcrumb :new + build_breadcrumb :new end end def destroy - if @referential.rule_parameter_sets.count == 1 - flash[:alert] = "Suppression impossible, le referentiel doit compter au minimum un jeu de parametre." - redirect_to referential_rule_parameter_sets_path( @referential ) + if current_organisation.rule_parameter_sets.count == 1 + flash[:alert] = t('rule_parameter_sets.destroy.last_rps_protected') + redirect_to organisation_rule_parameter_sets_path else - destroy! + destroy! do |success, failure| + success.html { redirect_to organisation_rule_parameter_sets_path } + end + end + end + + def update + update! do |success, failure| + success.html { redirect_to organisation_rule_parameter_sets_path } + end + end + + def create + create! do |success, failure| + success.html { redirect_to organisation_rule_parameter_sets_path } end end protected alias_method :rule_parameter_set, :resource + + def collection + @rule_parameter_sets = current_organisation.rule_parameter_sets + end + + def create_resource(rule_parameter_sets) + rule_parameter_sets.organisation = current_organisation + super + end end diff --git a/app/exporters/chouette/hub/vehicle_journey_exporter.rb b/app/exporters/chouette/hub/vehicle_journey_exporter.rb index 5ddb536c8..34e43091d 100644 --- a/app/exporters/chouette/hub/vehicle_journey_exporter.rb +++ b/app/exporters/chouette/hub/vehicle_journey_exporter.rb @@ -1,6 +1,6 @@ class Chouette::Hub::VehicleJourneyExporter include ERB::Util - attr_accessor :vehicle_journey, :directory, :template + attr_accessor :vehicle_journey, :directory, :template, :renvoi def initialize(vehicle_journey, directory, index) @vehicle_journey = vehicle_journey @@ -36,15 +36,28 @@ class Chouette::Hub::VehicleJourneyExporter unless periods.empty? periods.each { |p| @periods += "|" + p.sub(/(\w*\:\w*\:)(\w*)/, '\2') } end - # USE @renvoi for PMR and TAD and create RENVOI.TXT File + @renvoi = "" + # USE @renvoi for PMR and create RENVOI.TXT File if @vehicle_journey.mobility_restricted_suitability || @line.mobility_restricted_suitability - @renvoi = "1" + @number += 1 + @renvoi = "#{@number}" + File.open(directory + "/RENVOI.TXT" , "a:Windows_1252") do |f| + f.write("RENVOI\u000D\u000A") if f.size == 0 + f.write("p;PMR;#{number}\u000D\u000A") + end + end + + @vehicle_journey.footnotes.each do |footnote| + @number += 1 + if @renvoi + @renvoi += "|#{@number}" + else + @renvoi = "#{@number}" + end File.open(directory + "/RENVOI.TXT" , "a:Windows_1252") do |f| - if f.size == 0 - f.write("RENVOI\u000D\u000A") - f.write("a;PMR;1\u000D\u000A") - end + f.write("RENVOI\u000D\u000A") if f.size == 0 + f.write("#{footnote.code};#{footnote.label};#{@number}\u000D\u000A") end end end @@ -58,6 +71,7 @@ class Chouette::Hub::VehicleJourneyExporter end def self.save( vehicle_journeys, directory, hub_export) + @number = 0 vehicle_journeys.each_index do |index| self.new( vehicle_journeys[index], directory, index).tap do |specific_exporter| specific_exporter.save diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 88ff3fecf..eee3e1864 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -8,10 +8,19 @@ module ApplicationHelper @referential.present? and not @referential.new_record? end + def format_restriction_for_locales(referential) + if referential.data_format.blank? + "" + else + "."+referential.data_format + end + end + def polymorphic_path_patch( source) relative_url_root = Rails.application.config.relative_url_root relative_url_root && !source.starts_with?("#{relative_url_root}/") ? "#{relative_url_root}#{source}" : source end + def assets_path_patch( source) relative_url_root = Rails.application.config.relative_url_root return "/assets/#{source}" unless relative_url_root diff --git a/app/helpers/breadcrumb_helper.rb b/app/helpers/breadcrumb_helper.rb index 34e03383c..b85dc3527 100644 --- a/app/helpers/breadcrumb_helper.rb +++ b/app/helpers/breadcrumb_helper.rb @@ -53,7 +53,7 @@ module BreadcrumbHelper organisation_breadcrumb :index end end - + def network_breadcrumb(action) referential_breadcrumb @@ -121,52 +121,53 @@ module BreadcrumbHelper add_breadcrumb I18n.t("breadcrumbs.vehicle_journeys"), referential_line_route_vehicle_journeys_path(@referential, @line,@route) unless action == :index add_breadcrumb breadcrumb_label(@vehicle_journey), referential_line_route_vehicle_journey_path(@referential, @line,@route,@vehicle_journey),:title => breadcrumb_tooltip(@vehicle_journey) if action == :edit end - + def vehicle_journey_import_breadcrumb (action) route_breadcrumb :edit end def company_breadcrumb (action) - referential_breadcrumb + referential_breadcrumb add_breadcrumb Chouette::Company.model_name.human(:count => 2), referential_companies_path(@referential) unless action == :index add_breadcrumb breadcrumb_label(@company), referential_company_path(@referential, @company),:title => breadcrumb_tooltip(@company) if action == :edit end - + def import_breadcrumb (action) - referential_breadcrumb + referential_breadcrumb add_breadcrumb Referential.human_attribute_name("import_tasks"), referential_import_tasks_path(@referential) unless action == :index end - + def export_breadcrumb (action) - referential_breadcrumb + referential_breadcrumb add_breadcrumb Referential.human_attribute_name("exports"), referential_exports_path(@referential) unless action == :index end def compliance_breadcrumb (action) - referential_breadcrumb + referential_breadcrumb add_breadcrumb Referential.human_attribute_name("compliance_check_tasks"), referential_compliance_check_tasks_path(@referential) unless action == :index add_breadcrumb breadcrumb_label(@compliance_check_task), referential_compliance_check_task_path(@referential, @compliance_check_task),:title => breadcrumb_tooltip(@compliance_check_task) if action == :edit end def rule_parameter_breadcrumb (action) - referential_breadcrumb - add_breadcrumb Referential.human_attribute_name("import_tasks"), referential_import_tasks_path(@referential) - add_breadcrumb Referential.human_attribute_name("compliance_check_tasks"), referential_compliance_check_tasks_path(@referential) - add_breadcrumb Referential.human_attribute_name("rule_parameter_sets"), referential_rule_parameter_sets_path(@referential) unless action == :index + organisation_breadcrumb + add_breadcrumb Referential.human_attribute_name("rule_parameter_sets"), organisation_path unless action == :index + add_breadcrumb breadcrumb_label(@rule_parameter_set), organisation_rule_parameter_set_path(@rule_parameter_set),:title => breadcrumb_tooltip(@rule_parameter_set) if action == :edit end def referential_breadcrumb (action = :edit) organisation_breadcrumb - add_breadcrumb breadcrumb_label(@referential), referential_path(@referential),:title => breadcrumb_tooltip(@referential) if action == :edit || action == :show || action == :update + if @referential + add_breadcrumb breadcrumb_label(@referential), referential_path(@referential),:title => breadcrumb_tooltip(@referential) if action == :edit || action == :show || action == :update + end end - + def organisation_breadcrumb (action = :index) - add_breadcrumb I18n.t("breadcrumbs.referentials"), referentials_path + add_breadcrumb I18n.t("breadcrumbs.referentials"), referentials_path add_breadcrumb breadcrumb_label(@organisation), organisation_path,:title => breadcrumb_tooltip(@organisation) unless action == :index end def user_breadcrumb (action) - organisation_breadcrumb + organisation_breadcrumb add_breadcrumb I18n.t("breadcrumbs.users"), organisation_path unless action == :index add_breadcrumb breadcrumb_label(@user), organisation_user_path(@user),:title => breadcrumb_tooltip(@user) if action == :edit end @@ -176,14 +177,14 @@ module BreadcrumbHelper if label.blank? label = obj.class.model_name.human+" "+obj.id.to_s end - + if label.length > 20 label[0..16]+"..." else - label + label end end - + def breadcrumb_tooltip(obj) label = breadcrumb_name(obj) if label.blank? @@ -196,12 +197,12 @@ module BreadcrumbHelper def breadcrumb_name(obj) label = "" - if obj.respond_to?('name') + if obj.respond_to?('name') label = obj.name - elsif obj.respond_to?('comment') + elsif obj.respond_to?('comment') label = obj.comment end - label + label end end diff --git a/app/models/neptune_export.rb b/app/models/neptune_export.rb index 67dbc33d1..566117b32 100644 --- a/app/models/neptune_export.rb +++ b/app/models/neptune_export.rb @@ -1,4 +1,4 @@ -# class NeptuneExport < Export +class NeptuneExport < Export # option :start_date # option :end_date @@ -17,4 +17,4 @@ # end # end -# end +end diff --git a/app/models/organisation.rb b/app/models/organisation.rb index 8fafa56a0..239ee59ee 100644 --- a/app/models/organisation.rb +++ b/app/models/organisation.rb @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- class Organisation < ActiveRecord::Base include DataFormatEnumerations - + has_many :users, :dependent => :destroy has_many :referentials, :dependent => :destroy has_many :rule_parameter_sets, :dependent => :destroy diff --git a/app/models/referential.rb b/app/models/referential.rb index 97331c1c3..83cbc53fa 100644 --- a/app/models/referential.rb +++ b/app/models/referential.rb @@ -29,6 +29,8 @@ class Referential < ActiveRecord::Base belongs_to :organisation validates_presence_of :organisation + attr_accessible :data_format, :name, :prefix, :projection_type, :time_zone, :upper_corner, :lower_corner, :slug, :organisation + def slug_excluded_values if ! slug.nil? if slug.start_with? "pg_" @@ -149,11 +151,6 @@ class Referential < ActiveRecord::Base Apartment::Tenant.drop slug end - after_create :add_rule_parameter_set - def add_rule_parameter_set - RuleParameterSet.default_for_all_modes( self).save - end - def upper_corner envelope.upper_corner end @@ -209,6 +206,10 @@ Rails.application.config.after_initialize do @referential ||= Referential.where(:slug => Apartment::Tenant.current_tenant).first! end + def hub_restricted? + referential.data_format == "hub" + end + # override prefix for good prefix in objectid generation def prefix self.referential.prefix @@ -216,6 +217,18 @@ Rails.application.config.after_initialize do end + # Hub constraints + Chouette::Route; class Chouette::Route; include NinoxeExtension::Hub::RouteRestrictions; end + Chouette::JourneyPattern; class Chouette::JourneyPattern; include NinoxeExtension::Hub::JourneyPatternRestrictions; end + Chouette::VehicleJourney; class Chouette::VehicleJourney; include NinoxeExtension::Hub::VehicleJourneyRestrictions; end + Chouette::TimeTable; class Chouette::TimeTable; include NinoxeExtension::Hub::TimeTableRestrictions; end + Chouette::ConnectionLink; class Chouette::ConnectionLink; include NinoxeExtension::Hub::ConnectionLinkRestrictions; end + Chouette::StopArea; class Chouette::StopArea; include NinoxeExtension::Hub::StopAreaRestrictions; end + Chouette::Line; class Chouette::Line; include NinoxeExtension::Hub::LineRestrictions; end + Chouette::GroupOfLine; class Chouette::GroupOfLine; include NinoxeExtension::Hub::GroupOfLineRestrictions; end + Chouette::Company; class Chouette::Company; include NinoxeExtension::Hub::CompanyRestrictions; end + Chouette::Network; class Chouette::Network; include NinoxeExtension::Hub::NetworkRestrictions; end + Chouette::TimeTable class Chouette::TimeTable diff --git a/app/models/rule_parameter_set.rb b/app/models/rule_parameter_set.rb index 3c0d687b1..1901383c5 100644 --- a/app/models/rule_parameter_set.rb +++ b/app/models/rule_parameter_set.rb @@ -15,25 +15,25 @@ class RuleParameterSet < ActiveRecord::Base %w( inter_stop_area_distance_min parent_stop_area_distance_max stop_areas_area inter_access_point_distance_min inter_connection_link_distance_max walk_default_speed_max walk_occasional_traveller_speed_max walk_frequent_traveller_speed_max walk_mobility_restricted_traveller_speed_max - inter_access_link_distance_max inter_stop_duration_max facility_stop_area_distance_max - check_allowed_transport_modes check_lines_in_groups check_line_routes + inter_access_link_distance_max inter_stop_duration_max facility_stop_area_distance_max + check_allowed_transport_modes check_lines_in_groups check_line_routes check_stop_parent check_connection_link_on_physical) end - + def self.validable_objects [Chouette::Network,Chouette::Company,Chouette::GroupOfLine, Chouette::StopArea,Chouette::AccessPoint,Chouette::AccessLink,Chouette::ConnectionLink, Chouette::TimeTable,Chouette::Line,Chouette::Route, Chouette::JourneyPattern,Chouette::VehicleJourney] end - + def self.validable_object_names ["network","company","group_of_line", "stop_area","access_point","access_link","connection_link", "time_table","line","route", "journey_pattern","vehicle_journey"] end - + def self.validable_columns {"network" => ['objectid','name','registration_number'], "company" => ['objectid','name','registration_number'], @@ -48,7 +48,7 @@ class RuleParameterSet < ActiveRecord::Base "journey_pattern" => ['objectid','name','registration_number','published_name'], "vehicle_journey" => ['objectid','published_journey_name','published_journey_identifier','number'] } end - + def self.column_attribute_prefixes %w( unique pattern min_size max_size ) end @@ -63,14 +63,14 @@ class RuleParameterSet < ActiveRecord::Base mode_attribute_prefixes.include?( $1) && self.class.all_modes.include?( $2) end - + def self.column_attribute?( method_name ) pattern = /(\w+)_column_(\w+)_object_(\w+)/ return false unless method_name.match( pattern) return false unless validable_object_names.include?($3) column_attribute_prefixes.include?( $1) && validable_columns[$3].include?( $2) end - + def self.mode_of_mode_attribute( method_name ) method_name.match( /(\w+)_mode_(\w+)/) $2 @@ -109,7 +109,7 @@ class RuleParameterSet < ActiveRecord::Base ((self.parameters ||= {})["mode_#{mode}"] ||= {})[attribute_name] = prefix end end - + def self.column_parameter(obj,column,prefix) name = "#{prefix}_column_#{column}_object_#{obj}" #attr_accessible name @@ -123,7 +123,7 @@ class RuleParameterSet < ActiveRecord::Base attribute_name, column, obj = prefix, column, obj (((self.parameters ||= {})[obj] ||= {})[column]||= {})[attribute_name] = key end - + end def self.object_parameter(clazz) @@ -135,11 +135,11 @@ class RuleParameterSet < ActiveRecord::Base column_attribute_prefixes.each do |prefix| column_parameter name,column,prefix end - + end end - + def self.parameter(name) name = name.to_s #attr_accessible name @@ -169,7 +169,7 @@ class RuleParameterSet < ActiveRecord::Base :check_lines_in_groups => false, :check_line_routes => false, :check_stop_parent => false, - :check_connection_link_on_physical => false + :check_connection_link_on_physical => false } if mode && self.mode_default_params[ mode.to_sym] base.merge!( self.mode_default_params[ mode.to_sym]) @@ -319,13 +319,13 @@ class RuleParameterSet < ActiveRecord::Base :name => "valeurs par defaut" }.merge( mode_attributes)) end - + def allowed(mode) return true unless self.check_allowed_transport_modes # puts "#{mode} = "+self.send("allowed_transport_mode_#{mode}").to_s return self.send("allowed_transport_mode_#{mode}") == "1" end - + def selected(object) # puts "#{mode} = "+self.send("allowed_transport_mode_#{mode}").to_s return self.send("check_#{object}") == "1" @@ -336,7 +336,7 @@ class RuleParameterSet < ActiveRecord::Base return self.send("unique_column_#{column}_object_#{object}") == "1" || self.send("pattern_column_#{column}_object_#{object}") != "0" || !self.send("min_size_column_#{column}_object_#{object}").empty? || - !self.send("max_size_column_#{column}_object_#{object}").empty? + !self.send("max_size_column_#{column}_object_#{object}").empty? end @@ -345,15 +345,15 @@ class RuleParameterSet < ActiveRecord::Base mode_parameter "#{prefix}_mode_#{mode}".to_sym end end - + general_attributes.each do |attribute| parameter attribute.to_sym unless attribute == "stop_areas_area" || attribute == "check_allowed_transport_modes" validates attribute.to_sym, :numericality => true, :allow_nil => true, :allow_blank => true end end - - + + validable_objects.each do |obj| object_parameter obj end diff --git a/app/models/stop_area_copy.rb b/app/models/stop_area_copy.rb index 928b66a52..3401b5fde 100644 --- a/app/models/stop_area_copy.rb +++ b/app/models/stop_area_copy.rb @@ -6,13 +6,13 @@ class StopAreaCopy extend ActiveModel::Naming attr_accessor :source_id, :hierarchy, :area_type, :source, :copy - + validates_presence_of :source_id, :hierarchy, :area_type - + validates :hierarchy, inclusion: { in: %w(child parent) } - - def initialize(attributes = {}) + + def initialize(attributes = {}) attributes.each { |name, value| send("#{name}=", value) } if attributes if self.area_type.blank? && self.source != nil self.source_id = self.source.id @@ -31,7 +31,7 @@ class StopAreaCopy end end end - + def persisted? false end @@ -87,5 +87,4 @@ class StopAreaCopy end end - end diff --git a/app/models/vehicle_journey_export.rb b/app/models/vehicle_journey_export.rb index 4c2c62fa8..3a1676ff3 100644 --- a/app/models/vehicle_journey_export.rb +++ b/app/models/vehicle_journey_export.rb @@ -38,9 +38,17 @@ class VehicleJourneyExport (vj.time_tables.collect{ |t| t.id }) end + def footnotes (vj) + (vj.footnotes.collect{ |f| f.id }) + end + def time_tables_array (vehicle_journeys.collect{ |vj| time_tables(vj).to_s[1..-2] } ) end + + def footnotes_array + (vehicle_journeys.collect{ |vj| footnotes(vj).to_s[1..-2] } ) + end def vehicle_journey_at_stops_array (vehicle_journeys.collect{ |vj| time_by_stops vj } ) @@ -86,6 +94,7 @@ class VehicleJourneyExport csv << ["", label("mobility")] + mobility_restricted_suitability_array csv << ["", label("flexible_service")] + flexible_service_array csv << ["", label("time_table_ids")] + time_tables_array + csv << ["", label("footnotes_ids")] + footnotes_array csv << [label("stop_id"), label("stop_name")] + empty_array vjas_array = vehicle_journey_at_stops_array route.stop_points.each_with_index do |stop_point, index| @@ -155,12 +164,33 @@ class VehicleJourneyExport end end end + + def ftn_data(ftn) + [].tap do |array| + # id;code;label + array << ftn.id.to_s + array << ftn.code + array << ftn.label + end + end + + def footnotes_to_csv(options = {}) + footnotes = route.line.footnotes + CSV.generate(options) do |csv| + csv << label("ftn_columns").split(";") + footnotes.each do |ftn| + csv << ftn_data(ftn) + end + end + + end def to_zip(temp_file,options = {}) ::Zip::OutputStream.open(temp_file) { |zos| } ::Zip::File.open(temp_file.path, ::Zip::File::CREATE) do |zipfile| zipfile.get_output_stream(label("vj_filename")+route.id.to_s+".csv") { |f| f.puts to_csv(options) } zipfile.get_output_stream(label("tt_filename")+".csv") { |f| f.puts time_tables_to_csv(options) } + zipfile.get_output_stream(label("ftn_filename")+".csv") { |f| f.puts footnotes_to_csv(options) } end end diff --git a/app/models/vehicle_journey_import.rb b/app/models/vehicle_journey_import.rb index f710eeab7..855fa2abe 100644 --- a/app/models/vehicle_journey_import.rb +++ b/app/models/vehicle_journey_import.rb @@ -83,7 +83,14 @@ class VehicleJourneyImport vj.time_tables.clear return unless tm_ids.present? ids = tm_ids.split(",").map(&:to_i) - vj.time_tables << Chouette::TimeTable.find(ids) + vj.time_tables << Chouette::TimeTable.where(:id => ids) + end + + def update_footnotes(vj,ftn_ids) + vj.footnotes.clear + return unless ftn_ids.present? + ids = ftn_ids.split(",").map(&:to_i) + vj.footnotes << Chouette::Footnote.where(:id => ids, :line_id => vj.route.line.id) end def load_imported_vehicle_journeys @@ -100,13 +107,14 @@ class VehicleJourneyImport mobility_row = 4 flexible_service_row = 5 time_tables_row = 6 + footnotes_row = 7 # rows in column (first = 0) - first_stop_row_index = 7 + first_stop_row_index = 8 stop_point_ids = first_column[first_stop_row_index..spreadsheet.last_row].map(&:to_i) # blank lines at end of file will produce id = 0 ; ignore them - last_stop_row_index = stop_point_ids.length + 6 + last_stop_row_index = stop_point_ids.length + 7 while stop_point_ids.last == 0 stop_point_ids = stop_point_ids[0..-2] last_stop_row_index -= 1 @@ -153,6 +161,8 @@ class VehicleJourneyImport # time_tables update_time_tables(vehicle_journey,spreadsheet.row(time_tables_row)[i-1]) + update_footnotes(vehicle_journey,spreadsheet.row(footnotes_row)[i-1]) + # journey_pattern vehicle_journey.journey_pattern = journey_pattern vehicle_journey.vehicle_journey_at_stops.clear diff --git a/app/views/companies/_form.erb b/app/views/companies/_form.erb index f23edbef9..ee3f9db25 100644 --- a/app/views/companies/_form.erb +++ b/app/views/companies/_form.erb @@ -1,6 +1,6 @@ <%= semantic_form_for [@referential, @company] do |form| %> <%= form.inputs do %> - <%= form.input :name %> + <%= form.input :name, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.company.name") } %> <%= form.input :short_name %> <%= form.input :organizational_unit %> <%= form.input :operating_department_name %> @@ -10,8 +10,8 @@ <%= form.input :email, :as => :email %> <%= form.input :time_zone, :include_blank => true %> <%= form.input :url %> - <%= form.input :registration_number, :input_html => { :title => t("formtastic.titles.company.registration_number")} %> - <%= form.input :objectid, :required => !@company.new_record?, :input_html => { :title => t("formtastic.titles.company.objectid")} %> + <%= form.input :registration_number, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.company.registration_number")} %> + <%= form.input :objectid, :required => !@company.new_record?, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.company.objectid")} %> <% end %> <%= form.actions do %> diff --git a/app/views/compliance_check_results/index.html.erb b/app/views/compliance_check_results/index.html.erb index 3abd9cc65..da139fc93 100644 --- a/app/views/compliance_check_results/index.html.erb +++ b/app/views/compliance_check_results/index.html.erb @@ -17,7 +17,7 @@ <td><%= status_icon( compliance_check_result.status, compliance_check_result.severity ) %> </td> <td><%= t compliance_check_result.severity, :scope => "compliance_check_result.severities" %></td> <td> - <button data-content='<%= ComplianceCheckResult.human_attribute_name(compliance_check_result.rule_code) %>' data-title='<%= t("activerecord.attributes.compliance_check_result.detail") %>' rel="popover" data-toggle="popover" class="notice btn btn-info btn-xs" ><i class="fa fa-info"></i></button> + <button data-content='<%= ComplianceCheckResult.human_attribute_name(compliance_check_result.rule_code) %>' data-title='<%= t("activerecord.attributes.compliance_check_result.title") %>' rel="popover" data-toggle="popover" class="notice btn btn-info btn-xs" ><i class="fa fa-info"></i></button> <%= link_to compliance_check_result.rule_code, test_definition(compliance_check_result.rule_code), :title => ComplianceCheckResult.human_attribute_name(compliance_check_result.rule_code), :target => "validation" %></td> <% if @compliance_check_results && @compliance_check_results.first.status == "nok" %> <td class="td_error"> diff --git a/app/views/compliance_check_tasks/detailed_errors_index.csv.erb b/app/views/compliance_check_tasks/detailed_errors_index.csv.erb index 339210f92..3e526e29e 100644 --- a/app/views/compliance_check_tasks/detailed_errors_index.csv.erb +++ b/app/views/compliance_check_tasks/detailed_errors_index.csv.erb @@ -1,2 +1,2 @@ -<%= ComplianceCheckResult.human_attribute_name(:severity) %>;<%= ComplianceCheckResult.human_attribute_name(:rule_code) %>;<%= ComplianceCheckResult.human_attribute_name(:object) %>;<%= ComplianceCheckResult.human_attribute_name(:resource) %>;<%= ComplianceCheckResult.human_attribute_name(:detail) %>; -<% @compliance_check_task.compliance_check_results.each do |r| %><% if r.detail.present? %><% r.detail["detail"].first(10).each do |error| %><% case r.severity %><% when "warning" %><%= I18n.t "compliance_check_result.severities.warning" %><% when "error" %><%= I18n.t "compliance_check_result.severities.error" %><% end %>;<%= r.rule_code %>;<% if error["messageArgs"] %><%= error["messageArgs"]["objectId"] %><% end %>;<% if error["location"]["url"].present? %><%= "http://#{request.host}:#{request.port}#{request.fullpath.sub(/(compliance_check_tasks.*)/, '')}" + error["location"]["url"] %><% elsif error["location"]["filename"].present? %><%= error["objectId"] + " - " %><%= File.basename(error["location"]["filename"]) +" - " %><%= I18n.t "compliance_check_results.index.column" %>: <%= error["location"]["columnNumber"] %>, <%= I18n.t "compliance_check_results.index.line" %>: <%= error["location"]["lineNumber"] %><% end %>;<% if error["messageArgs"] %><%= ComplianceCheckResult.human_attribute_name(r.rule_code) + " " + I18n.t("compliance_check_result.details." + error["messageKey"], error["messageArgs"].symbolize_keys ) %><% else %> <<%= ComplianceCheckResult.human_attribute_name(r.rule_code) + " " + I18n.t("compliance_check_result.details." + error["messageKey"] ) %><% end %><%= "\n" %><% end %><% end %><% end %>
\ No newline at end of file +<%= ComplianceCheckResult.human_attribute_name(:severity) %>;<%= ComplianceCheckResult.human_attribute_name(:rule_code) %>;<%= ComplianceCheckResult.human_attribute_name(:object) %>;<%= ComplianceCheckResult.human_attribute_name(:resource) %>;<%= ComplianceCheckResult.human_attribute_name(:title) %>;<%= ComplianceCheckResult.human_attribute_name(:detail) %> +<% @compliance_check_task.compliance_check_results.each do |r| %><% if r.detail.present? %><% r.detail["detail"].first(10).each do |error| %><% case r.severity %><% when "warning" %><%= I18n.t "compliance_check_result.severities.warning_txt" %><% when "error" %><%= I18n.t "compliance_check_result.severities.error_txt" %><% end %>;<%= r.rule_code %>;<% if error["messageArgs"] %><%= error["messageArgs"]["objectId"] %><% end %>;<% if error["location"]["url"].present? %><%= "http://#{request.host}:#{request.port}#{request.fullpath.sub(/(compliance_check_tasks.*)/, '')}" + error["location"]["url"] %><% elsif error["location"]["filename"].present? %><%= error["objectId"] + " - " %><%= File.basename(error["location"]["filename"]) +" - " %><%= I18n.t "compliance_check_results.index.column" %>: <%= error["location"]["columnNumber"] %>,<%= I18n.t "compliance_check_results.index.line" %>: <%= error["location"]["lineNumber"] %><% end %>;<%= ComplianceCheckResult.human_attribute_name(r.rule_code) %>;<% if error["messageArgs"] %><%= I18n.t("compliance_check_result.details." + error["messageKey"], error["messageArgs"].symbolize_keys ) %><% else %><%= I18n.t("compliance_check_result.details." + error["messageKey"] ) %><% end %><%= "\n" %><% end %><% end %><% end %>
\ No newline at end of file diff --git a/app/views/compliance_check_tasks/index.html.erb b/app/views/compliance_check_tasks/index.html.erb index fe05b3cdc..6cddaeff7 100644 --- a/app/views/compliance_check_tasks/index.html.erb +++ b/app/views/compliance_check_tasks/index.html.erb @@ -6,6 +6,6 @@ <% content_for :sidebar do %> <ul class="actions"> <li><%= link_to t('compliance_check_tasks.actions.new'), new_referential_compliance_check_task_path(), :class => "add" %></li> - <li><%= link_to t('rule_parameter_sets.actions.index'), referential_rule_parameter_sets_path(@referential), :class => "link" %></li> + <li><%= link_to t('rule_parameter_sets.actions.index'), organisation_rule_parameter_sets_path, :class => "link" %></li> </ul> <% end %> diff --git a/app/views/compliance_check_tasks/summary_errors_index.csv.erb b/app/views/compliance_check_tasks/summary_errors_index.csv.erb index e51ad28c2..354a3a620 100644 --- a/app/views/compliance_check_tasks/summary_errors_index.csv.erb +++ b/app/views/compliance_check_tasks/summary_errors_index.csv.erb @@ -1,3 +1,3 @@ -<%= ComplianceCheckResult.human_attribute_name(:severity) %>;<%= ComplianceCheckResult.human_attribute_name(:status) %>;<%= ComplianceCheckResult.human_attribute_name(:rule_code) %>;<%= ComplianceCheckResult.human_attribute_name(:detail) %>;<%= ComplianceCheckResult.human_attribute_name(:url) %>;<%= ComplianceCheckResult.human_attribute_name(:violation_count) %>;<%= ComplianceCheckResult.human_attribute_name(:objects) %> -<% @compliance_check_task.compliance_check_results.each do |r| %><% case r.severity %><% when "warning" %><%= I18n.t "compliance_check_result.severities.warning" %><% when "error" %><%= I18n.t "compliance_check_result.severities.error" %><% end %>;<%= r.status %>;<%= r.rule_code %>;<%= ComplianceCheckResult.human_attribute_name(r.rule_code) %>;<%= Rails.application.config.validation_spec + I18n.locale.to_s + "/" + r.rule_code + ".html" %>;<%= r.violation_count %><% if r.violation_count > 0 %><% if r.detail.present? %>;<% r.detail["detail"].first(10).each do |error| %><% if error["messageArgs"] %><%= error["messageArgs"]["objectId"] + " " %><% else %><%= " " %><% end %><% end %><% end %><% end %> +<%= ComplianceCheckResult.human_attribute_name(:severity) %>;<%= ComplianceCheckResult.human_attribute_name(:status) %>;<%= ComplianceCheckResult.human_attribute_name(:rule_code) %>;<%= ComplianceCheckResult.human_attribute_name(:title) %>;<%= ComplianceCheckResult.human_attribute_name(:url) %>;<%= ComplianceCheckResult.human_attribute_name(:violation_count_txt) %>;<%= ComplianceCheckResult.human_attribute_name(:objects) %> +<% @compliance_check_task.compliance_check_results.each do |r| %><% case r.severity %><% when "warning" %><%= I18n.t "compliance_check_result.severities.warning_txt" %><% when "error" %><%= I18n.t "compliance_check_result.severities.error_txt" %><% end %>;<%= r.status %>;<%= r.rule_code %>;<%= ComplianceCheckResult.human_attribute_name(r.rule_code) %>;<%= Rails.application.config.validation_spec + I18n.locale.to_s + "/" + r.rule_code + ".html" %>;<%= r.violation_count %><% if r.violation_count > 0 %><% if r.detail.present? %>;<% r.detail["detail"].first(10).each do |error| %><% if error["messageArgs"] %><%= error["messageArgs"]["objectId"] + " " %><% else %><%= " " %><% end %><% end %><% end %><% end %> <% end %>
\ No newline at end of file diff --git a/app/views/connection_links/_form.erb b/app/views/connection_links/_form.erb index 54ac7088e..0620dcc94 100644 --- a/app/views/connection_links/_form.erb +++ b/app/views/connection_links/_form.erb @@ -4,7 +4,7 @@ <%= form.input :name %> <%= form.input :connection_link_type, :as => :select, :collection => Chouette::ConnectionLink.connection_link_types, :include_blank => false, :member_label => Proc.new { |type| t("connection_link_types.label.#{type}") } %> <%= form.input :comment %> - <%= form.input :link_distance %> + <%= form.input :link_distance, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.connection_link.link_distance") } %> <%= form.input :mobility_restricted_suitability,:as => :boolean %> <%= form.input :stairs_availability,:as => :boolean %> <%= form.input :lift_availability,:as => :boolean %> diff --git a/app/views/exports/_fields_neptune_export.erb b/app/views/exports/_fields_neptune_export.erb index d4debb6f2..20fa9085c 100644 --- a/app/views/exports/_fields_neptune_export.erb +++ b/app/views/exports/_fields_neptune_export.erb @@ -1,2 +1,3 @@ <%= form.input :start_date, :as => :date_picker, :input_html => { :title => t("formtastic.titles.export.start_date")} %> <%= form.input :end_date, :as => :date_picker, :input_html => { :title => t("formtastic.titles.export.end_date")} %> + <%= form.input :extensions , :as => :boolean%> diff --git a/app/views/footnotes/_footnote_fields.html.erb b/app/views/footnotes/_footnote_fields.html.erb new file mode 100644 index 000000000..652b6d6af --- /dev/null +++ b/app/views/footnotes/_footnote_fields.html.erb @@ -0,0 +1,6 @@ +<%= f.inputs :class => 'nested-fields footnote' do %> + <%= f.input :code, :wrapper_html => { :class => 'col-md-3' } %> + <%= f.input :label, :wrapper_html => { :class => 'col-md-7' } %> + <%= link_to_remove_association t('actions.destroy'), f, :class => 'col-md-2 remove' %> +<% end %> + diff --git a/app/views/group_of_lines/_form.erb b/app/views/group_of_lines/_form.erb index 9482248b6..d9c033a37 100644 --- a/app/views/group_of_lines/_form.erb +++ b/app/views/group_of_lines/_form.erb @@ -1,9 +1,9 @@ <%= semantic_form_for [@referential, @group_of_line] do |form| %> <%= form.inputs do %> - <%= form.input :name %> - <%= form.input :registration_number %> + <%= form.input :name, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.group_of_lines.name") } %> + <%= form.input :registration_number, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.group_of_lines.registration_number") } %> <%= form.input :comment %> - <%= form.input :objectid, :required => !@group_of_line.new_record?, :input_html => { :title => t("formtastic.titles.group_of_line.objectid")} %> + <%= form.input :objectid, :required => !@group_of_line.new_record?, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.group_of_lines.objectid") } %> <% end %> <%= form.inputs do %> diff --git a/app/views/group_of_lines/_group_of_line.erb b/app/views/group_of_lines/_group_of_line.erb index d3a254ba9..98a1e03d2 100644 --- a/app/views/group_of_lines/_group_of_line.erb +++ b/app/views/group_of_lines/_group_of_line.erb @@ -4,7 +4,7 @@ <span class="pull-right"> <%= link_to edit_referential_group_of_line_path(@referential, group_of_line), :class => "btn btn-default btn-sm" do %> <span class="fa fa-pencil"></span> - <% end %> + <% end if edit %> <%= link_to('<span class="fa fa-trash-o"></span>'.html_safe, referential_group_of_line_path(@referential, group_of_line), :method => :delete, :data => {:confirm => t('group_of_lines.actions.destroy_confirm')}, :class => "btn btn-danger btn-sm") if delete %> </span> <h5> diff --git a/app/views/group_of_lines/_lines_detail.html.erb b/app/views/group_of_lines/_lines_detail.html.erb index 210ecd4b5..a6d8c6a01 100644 --- a/app/views/group_of_lines/_lines_detail.html.erb +++ b/app/views/group_of_lines/_lines_detail.html.erb @@ -1,3 +1,3 @@ <div class="lines paginated_content"> - <%= paginated_content @lines, "lines/line" %> + <%= paginated_content @lines, "lines/line", :delete => false %> </div> diff --git a/app/views/help/parametersets.textile b/app/views/help/parametersets.textile index 733f0bb75..6070d86b1 100644 --- a/app/views/help/parametersets.textile +++ b/app/views/help/parametersets.textile @@ -39,17 +39,45 @@ vitesse maximale admise dans les correspondances et les liaisons arrêt - accès * un voyageur habituel : voyageur qui connaît bien le réseau
* un voyageur à mobilité réduite : voyageur qui a des difficultés de déplacement
+p. *Activation de contrôles supplémentaires* (ceux-ci sont alors déclarés bloquants)
+
+* contraite d'appartenance d'une ligne à un unique groupe de lignes.
+* limitation du nombre de séquences d'arrêts d'une ligne à au plus 1 A/R)
+* appartenance obligatoire des arrêts physiques à un arrêt commercial
+* limiter les correspondances aux seuls arrêts physiques
+* limiter les modes de transports à un sous-ensemble des modes gérés par Chouette (si ce contrôle est activé, une case à cocher est ajouter par mode de transport pour l'autoriser)
h3. Paramètres par mode de transport.
p. les paramètres suivants sont à définir pour chaque mode de transport disponible dans le réseau à tester.
+* Autoriser ce mode (si le contrôle sur les modes de transports est actif)
* Distance minimum entre 2 arrêts (en mètres) : distance minimale de parcours d'un véhicule entre 2 arrêts.
* Distance maximum entre 2 arrêts (en mètres) : distance maximale de parcours d'un véhicule entre 2 arrêts.
* Vitesse minimum (en kilomètres/heure) : vitesse minimale attendue entre 2 arrêts d'une course
* Vitesse maximum (en kilomètres/heure) : vitesse maximale attendue entre 2 arrêts d'une course
* Écart maximum de durée de trajet entre 2 arrêts successifs pour les différentes courses (en secondes) : la différence de temps de trajet entre 2 arrêts successifs de 2 courses d'une même mission ne doit pas dépasser ce seuil =:
+h3. Contrôles sur les attributs du modèle
+
+p. les paramètres suivants sont disponible pour fixer des limitations sur différents champs du modèle par rapport à leur spécification dans Chouette; ces contrôles s'applique sur l'ensemble des données fournies à la validation.
+
+p. pour activer un point de contrôle, il faut cocher le type d'objet, puis renseigner les limitations sur les attributs désirés.
+
+p. les limitations sont les suivantes :
+
+* Unicité : contrôle de l'unicité de la valeur dans le lot de données contrôlées.
+* Caractères autorisés : restriction possible des valeurs à :
+** uniquement des chiffres, (restriction imposée pour un champ numérique)
+** uniquement des lettres (pas d'espace)
+** uniquement des lettres majuscules (pas d'espace)
+** uniquement des lettres minuscules (pas d'espace)
+* obligation d'un nombre minimal de caractères ou valeur minimale pour un champ numérique ou contraint à des chiffres
+** en mettant 1 dans ce champs pour un texte, ceci le rend obligatoire
+* restriction à une longueur maximale de caractères ou valeur maximale pour un champ numérique ou contraint à des chiffres
+
+p. L'attribut *Identifiant Neptune* est un cas particulier, les limitations s'appliquent à la troisième composante de ce champ, soit la partie identifiant technique.
+
h3. Remarques
p. Les distances sont calculées _à vol d'oiseau_ et les vitesses sont déterminées par rapport à ces distances.
diff --git a/app/views/help/validations.textile b/app/views/help/validations.textile index 68a1b4775..1513ed0e0 100644 --- a/app/views/help/validations.textile +++ b/app/views/help/validations.textile @@ -104,4 +104,6 @@ p. En cas d'erreur, la localisation est fournie dans la colonne 'Détail': * pour les tests des phases 1 et 2, par l'emplacement (nom du fichier, ligne et colonne) de l'objet en erreur, * pour les tests de la phase 3, par un lien vers la page de consultation de l'objet en base qui est en erreur. -p(border_image). !validation_location.png!
\ No newline at end of file +p(border_image). !validation_location.png! + +p. Un bouton à droite permet d'exporter l'ensemble du rapport de validation au format CSV pour usage externe. diff --git a/app/views/journey_patterns/_form.html.erb b/app/views/journey_patterns/_form.html.erb index 361f7f380..f57556577 100644 --- a/app/views/journey_patterns/_form.html.erb +++ b/app/views/journey_patterns/_form.html.erb @@ -1,11 +1,11 @@ <%= semantic_form_for [@referential, @line, @route, @journey_pattern] do |form| %> <%= form.inputs do %> - <%= form.input :name %> + <%= form.input :name, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.journey_pattern.name") } %> <%= form.input :published_name %> - <%= form.input :registration_number %> + <%= form.input :registration_number, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.journey_pattern.registration_number") } %> <%= form.input :comment %> <%= form.input :stop_point_ids, :label => stop_point_ids_label(@journey_pattern), :as => :check_boxes, :collection => @route.stop_points.map { |s| [s.stop_area.name, s.id.to_s]}, :input_html => (@journey_pattern.new_record? ? { :checked => 'checked' }:{}) %> - <%= form.input :objectid, :required => !@journey_pattern.new_record?, :input_html => { :title => t("formtastic.titles.journey_pattern.objectid")} %> + <%= form.input :objectid, :required => !@journey_pattern.new_record?, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.journey_pattern.objectid") } %> <% end %> <%= form.actions do %> diff --git a/app/views/journey_patterns/_journey_pattern.html.erb b/app/views/journey_patterns/_journey_pattern.html.erb index 1bc34b2e4..5794f8d69 100644 --- a/app/views/journey_patterns/_journey_pattern.html.erb +++ b/app/views/journey_patterns/_journey_pattern.html.erb @@ -7,9 +7,9 @@ <% end %> </span> <h5> - <%= link_to([@referential, @line, @route, journey_pattern], :class => "preview", :title => "#{Chouette::JourneyPattern.model_name.human.capitalize} #{journey_pattern.name}") do %> + <%= link_to([@referential, @line, @route, journey_pattern], :class => "preview", :title => "#{Chouette::JourneyPattern.model_name.human.capitalize} #{journey_name(journey_pattern)}") do %> <span class="name"> - <%= truncate(journey_pattern.name, :length => 20) %> + <%= truncate(journey_name(journey_pattern), :length => 20) %> </span> <% end %> </h5> diff --git a/app/views/lines/_form.erb b/app/views/lines/_form.erb index 0e393ac53..eb31f8dc1 100644 --- a/app/views/lines/_form.erb +++ b/app/views/lines/_form.erb @@ -1,36 +1,48 @@ <!-- <%= @line.errors.inspect %> --> <%= semantic_form_for [@referential, @line] do |form| %> - <%= form.inputs do %> - <%= form.input :network, :as => :select, :collection => Chouette::Network.all, :include_blank => false %> + <%= form.inputs do %> + <%= form.input :network, :as => :select, :collection => Chouette::Network.all, :include_blank => false %> <%= form.input :company, :as => :select, :collection => Chouette::Company.all, :include_blank => false%> - <%= form.input :name %> + <%= form.input :name, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.line.name") } %> <%= form.input :published_name %> - <%= form.input :registration_number, :input_html => { :title => t("formtastic.titles.line.registration_number")} %> - <%= form.input :number %> + <%= form.input :registration_number, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.line.registration_number")} %> + <%= form.input :number, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.line.number") } %> <%= form.input :transport_mode, :as => :select, :collection => Chouette::Line.transport_modes, :include_blank => false, :member_label => Proc.new { |mode| t("transport_modes.label.#{mode}") } %> <%= form.input :color, :as => :string %> <%= form.input :text_color %> <%= form.input :url %> <%= form.input :mobility_restricted_suitability, :as => :select, :collection => [[@line.human_attribute_name("accessible"), true], [@line.human_attribute_name("not_accessible"), false]], :include_blank => true %> <%= form.input :flexible_service, :as => :select, :collection => [[@line.human_attribute_name("on_demaond_fs"), true], [@line.human_attribute_name("regular_fs"), false]], :include_blank => true %> - <%= form.input :comment %> - <%= form.input :objectid, :required => !@line.new_record?, :input_html => { :title => t("formtastic.titles.line.objectid")} %> - <% end %> - - <%= form.inputs do %> + <%= form.input :comment %> + <%= form.input :objectid, :required => !@line.new_record?, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.line.objectid")} %> <%= form.input :group_of_line_tokens, :label => t('.group_of_lines'), :as => :text, :input_html => { :"data-pre" => ( @line.group_of_lines.map { |group_of_line| { :id => group_of_line.id, :name => group_of_line.name } } ).to_json } %> + + <div class="footnotes_block"> + <h3><%= t("footnotes.index.title") %></h3> + <div id="footnotes"> + <%= form.semantic_fields_for :footnotes do |f| %> + <%= render "footnotes/footnote_fields", :f => f %> + <% end %> + </div> + <div class="add_footnote"> + <%= link_to_add_association t("footnotes.actions.add_footnote"), form, :footnotes , + :partial => "footnotes/footnote_fields", + :"data-association-insertion-method" => "append", + :"data-association-insertion-node" => "div#footnotes", :class => "add" %> + </div> + </div> <% end %> <%= form.actions do %> - <%= form.action :submit, :as => :button %> + <%= form.action :submit, :as => :button %> <%= form.action :cancel, :as => :link %> <% end %> <% end %> <script> $(function() { - $( "#line_group_of_line_tokens" ).tokenInput('<%= name_filter_referential_group_of_lines_path(@referential, :format => :json) %>', { - crossDomain: false, + $( "#line_group_of_line_tokens" ).tokenInput('<%= name_filter_referential_group_of_lines_path(@referential, :format => :json) %>', { + crossDomain: false, prePopulate: $('#group_of_line_tokens').data('pre'), minChars: 3, preventDuplicates: true, diff --git a/app/views/lines/_line.erb b/app/views/lines/_line.erb index 5962cd64f..69c7978ab 100644 --- a/app/views/lines/_line.erb +++ b/app/views/lines/_line.erb @@ -4,10 +4,10 @@ <span class="pull-right"> <%= link_to edit_referential_line_path(@referential, line), :class => "btn btn-default btn-sm" do %> <span class="fa fa-pencil"></span> - <% end %> + <% end if edit %> <%= link_to referential_line_path(@referential, line), :method => :delete, :data => {:confirm => t('lines.actions.destroy_confirm')}, :class => "btn btn-danger btn-sm" do %> <span class="fa fa-trash-o"></span> - <% end %> + <% end if delete %> </span> <h5> <%= check_box_tag "ids[]", line.id, false, :class => "multiple_selection", :style => "display: none;" %> diff --git a/app/views/lines/show.html.erb b/app/views/lines/show.html.erb index 5983aaca0..3654840fd 100644 --- a/app/views/lines/show.html.erb +++ b/app/views/lines/show.html.erb @@ -7,8 +7,8 @@ <%= @map.to_html %> <div class="summary"> -<% text_color = @line.text_color.blank? ? "black" : "##{@line.text_color}" %> -<% bg_color = @line.color.blank? ? "white" : "#"+@line.color %> + <% text_color = @line.text_color.blank? ? "black" : "##{@line.text_color}" %> + <% bg_color = @line.color.blank? ? "white" : "#"+@line.color %> <% if colors?(@line) %> <p> <label><%= t('lines.index.color') %>: </label> @@ -86,12 +86,24 @@ (@line.vehicle_journeys.where("flexible_service = ?", true).count + @line.vehicle_journeys.where("flexible_service = ?", false).count) %> </p> - + <p> + <label><%= @line.human_attribute_name("footnotes") %>: </label> + <ul> + <% @line.footnotes.each do |footnote| %> + <li><%= footnote.code %> : <%= footnote.label %></li> + <% end %> + </ul> + </p> <p> <label><%= @line.human_attribute_name("comment") %>: </label> <%= @line.comment %> </p> </div> + + <div class="row"> + <div id="mobility_restricted_suitability" class="col-md-6"></div> + <div id="flexible_service" class="col-md-6"></div> + </div> </div> <p class="after_map" /> diff --git a/app/views/networks/_form.erb b/app/views/networks/_form.erb index bb87d9e46..cb9575664 100644 --- a/app/views/networks/_form.erb +++ b/app/views/networks/_form.erb @@ -1,13 +1,13 @@ <%= semantic_form_for [@referential, @network] do |form| %> <%= form.inputs do %> - <%= form.input :name %> - <%= form.input :registration_number, :input_html => { :title => t("formtastic.titles.network.registration_number")} %> + <%= form.input :name, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.network.name")} %> + <%= form.input :registration_number, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.network.registration_number")} %> <%= form.input :comment %> <%= form.input :version_date, :as => :date_picker %> <%= form.input :description %> <%= form.input :source_name %> <%= form.input :source_identifier %> - <%= form.input :objectid, :required => !@network.new_record?, :input_html => { :title => t("formtastic.titles.network.objectid")} %> + <%= form.input :objectid, :required => !@network.new_record?, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.network.objectid")} %> <% end %> <%= form.actions do %> diff --git a/app/views/organisations/edit.html.erb b/app/views/organisations/edit.html.erb index ef3cc1530..83ac7c031 100644 --- a/app/views/organisations/edit.html.erb +++ b/app/views/organisations/edit.html.erb @@ -1,8 +1,9 @@ <%= title_tag t(".title") %> <%= semantic_form_for @organisation, :url => organisation_path do |form| %> - <%= form.inputs do %> - <%= form.input :name %> + <%= form.inputs do %> + <%= form.input :name %> + <%= form.input :data_format, :label => true %> <% end %> <%= form.actions do %> diff --git a/app/views/organisations/show.html.erb b/app/views/organisations/show.html.erb index 753229e60..f6c497173 100644 --- a/app/views/organisations/show.html.erb +++ b/app/views/organisations/show.html.erb @@ -2,17 +2,55 @@ <div class="summary"> <p> +<label><%= Organisation.human_attribute_name("data_format_restrictions_by_default") %>: </label> +<%= @organisation.data_format %> </p> </div> -<div class="users paginated_content"> - <%= paginated_content(@organisation.users, "users/user") %> +<div class="panel-group" id="accordion"> + <div class="panel panel-default"> + <div class="panel-heading"> + <h4 class="panel-title"> + <a data-toggle="collapse" data-parent="#accordion" href="#users"> + <%= t('.users') %> + </a> + </h4> + </div> + <div id="users" class="panel-collapse collapse"> + <div class="panel-body"> + <div class="users paginated_content"> + <%= paginated_content(@organisation.users, "users/user") %> + </div> + </div> + </div> + </div> +</div> + + +<div class="panel-group" id="accordion"> + <div class="panel panel-default"> + <div class="panel-heading"> + <h4 class="panel-title"> + <a data-toggle="collapse" data-parent="#accordion" href="#rule_parameter_sets"> + <%= t('.rule_parameter_sets') %> + </a> + </h4> + </div> + <div id="rule_parameter_sets" class="panel-collapse collapse"> + <div class="panel-body"> + <div class="rule_parameter_sets paginated_content"> + <%= paginated_content(@organisation.rule_parameter_sets, "rule_parameter_sets/rule_parameter_set") %> + </div> + </div> + </div> + </div> </div> <% content_for :sidebar do %> <ul class="actions"> <li><%= link_to t('organisations.actions.edit'), edit_organisation_path, :class => "edit" %></li> - <li><%= link_to t('users.actions.new'), new_user_invitation_path, :class => "add" %></li> + <li><%= link_to t('users.actions.new'), new_organisation_user_path, :class => "add" %></li> + <li><%= link_to t('rule_parameter_sets.actions.new'), new_organisation_rule_parameter_set_path, :class => "add" %></li> </ul> <% end %> diff --git a/app/views/referentials/_form.erb b/app/views/referentials/_form.erb index 814195dde..7d33d8009 100644 --- a/app/views/referentials/_form.erb +++ b/app/views/referentials/_form.erb @@ -14,6 +14,7 @@ <%= form.input :time_zone %> <%= form.input :upper_corner, :input_html => { :title => t("formtastic.titles.referential.upper_corner")} %> <%= form.input :lower_corner, :input_html => { :title => t("formtastic.titles.referential.lower_corner")} %> + <%= form.input :data_format, :label => true %> <% end %> <%= form.actions do %> diff --git a/app/views/referentials/show.html.erb b/app/views/referentials/show.html.erb index d8e209c7f..f04721f8d 100644 --- a/app/views/referentials/show.html.erb +++ b/app/views/referentials/show.html.erb @@ -20,6 +20,10 @@ <%= @referential.time_zone %> </p> <p> + <label><%= Referential.human_attribute_name("data_format_restrictions") %>: </label> + <%= @referential.data_format %> + </p> + <p> <label><%= Referential.human_attribute_name("validity_period") %>: </label> <% if Chouette::TimeTable.start_validity_period.nil? %> <%= Referential.human_attribute_name("no_validity_period") %> @@ -30,10 +34,10 @@ <%= l Chouette::TimeTable.end_validity_period %> <% end %> </p> - + <table width="100%"> <tr> - <td valign="top" width="50%"> + <td valign="top" width="50%"> <%= render "counts" %> </td> <td valign="top" > @@ -43,12 +47,12 @@ </table> <% if @referential.api_keys.present? %> - <h3 class="api_keys"><%= t('.api_keys') %></h3> + <h3 class="api_keys"><%= t('.api_keys') %></h3> <div class="api_keys paginated_content"> <%= paginated_content(@referential.api_keys, "api_keys/api_key") %> </div> <% end %> -</div> +</div> <% content_for :sidebar do %> <ul class="actions"> diff --git a/app/views/routes/_form.html.erb b/app/views/routes/_form.html.erb index b6c4a8c24..2aa9dd8b7 100644 --- a/app/views/routes/_form.html.erb +++ b/app/views/routes/_form.html.erb @@ -7,7 +7,7 @@ <%= form.input :opposite_route, :as => :select, :collection => @line.routes.select { |r| r.id != @route.id } %> <%= form.input :direction_code, :as => :select, :collection => Chouette::Route.directions, :include_blank => false, :member_label => Proc.new { |mode| t("directions.label.#{mode}") } %> <%= form.input :wayback_code, :as => :select, :collection => Chouette::Route.waybacks, :include_blank => false, :member_label => Proc.new { |mode| t("waybacks.label.#{mode}") } %> - <%= form.input :objectid, :required => !@route.new_record?, :input_html => { :title => t("formtastic.titles.route.objectid")}%> + <%= form.input :objectid, :required => !@route.new_record?, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.route.objectid")} %> <% end %> <div id="stop_points"> <%= form.semantic_fields_for :stop_points, :include_id => false, :label => "TOTO" do |p| %> diff --git a/app/views/routes/show.html.erb b/app/views/routes/show.html.erb index e1f59cde9..d8c8e2498 100644 --- a/app/views/routes/show.html.erb +++ b/app/views/routes/show.html.erb @@ -62,7 +62,7 @@ <div id="stop_points" class="panel-collapse collapse"> <div class="panel-body"> <div class="stop_points paginated_content"> - <%= paginated_content( @stop_points, "stop_points/stop_point") %> + <%= paginated_content( @route.stop_points, "stop_points/stop_point") %> </div> </div> </div> diff --git a/app/views/rule_parameter_sets/_form.html.erb b/app/views/rule_parameter_sets/_form.html.erb index abe4b0c96..a2d1c2bc1 100644 --- a/app/views/rule_parameter_sets/_form.html.erb +++ b/app/views/rule_parameter_sets/_form.html.erb @@ -1,4 +1,4 @@ -<%= semantic_form_for [@referential, @rule_parameter_set] do |form| %> +<%= semantic_form_for [ :organisation, @rule_parameter_set] do |form| %> <%= form.inputs do %> <%= form.input :name %> <%= form.input :inter_stop_area_distance_min, :as => :number %> @@ -14,13 +14,13 @@ <%= form.input :inter_access_link_distance_max, :as => :number %> <%= form.input :inter_stop_duration_max, :as => :number %> <%= form.input :facility_stop_area_distance_max, :as => :number %> - + <%= form.input :check_lines_in_groups, :as => :boolean %> <%= form.input :check_line_routes, :as => :boolean %> <%= form.input :check_stop_parent, :as => :boolean %> <%= form.input :check_connection_link_on_physical, :as => :boolean %> <%= form.input :check_allowed_transport_modes, :as => :boolean %> - + <table class="table table-striped table-condensed"> <thead> <tr> @@ -43,7 +43,7 @@ <% end %> </tbody> </table> - + <%= t("rule_parameter_sets.labels.columns_restrictions") %> <table class="table table-bordered table-condensed"> <% RuleParameterSet.validable_objects.each do |obj| %> diff --git a/app/views/rule_parameter_sets/_rule_parameter_set.html.erb b/app/views/rule_parameter_sets/_rule_parameter_set.html.erb index 3b9af4751..257b8e145 100644 --- a/app/views/rule_parameter_sets/_rule_parameter_set.html.erb +++ b/app/views/rule_parameter_sets/_rule_parameter_set.html.erb @@ -1,23 +1,23 @@ <div id="index_item" class="panel panel-default rule_parameter_set"> <div class="panel-heading"> <div class="panel-title clearfix"> - <span class="pull-right"> - <%= link_to edit_referential_rule_parameter_set_path(@referential, rule_parameter_set), :class => "btn btn-default btn-sm" do %> + <span class="pull-right"> + <%= link_to edit_organisation_rule_parameter_set_path( rule_parameter_set), :class => "btn btn-default btn-sm" do %> <span class="fa fa-pencil"></span> <% end %> - <% if @referential.rule_parameter_sets.size > 1 %> - <%= link_to referential_rule_parameter_set_path(@referential, rule_parameter_set), :method => :delete, :data => {:confirm => t('rule_parameter_sets.actions.destroy_confirm')}, :class => "btn btn-danger btn-sm" do %> + <% if rule_parameter_set.organisation.rule_parameter_sets.size > 1 %> + <%= link_to organisation_rule_parameter_set_path( rule_parameter_set), :method => :delete, :data => {:confirm => t('rule_parameter_sets.actions.destroy_confirm')}, :class => "btn btn-danger btn-sm" do %> <span class="fa fa-trash-o"></span> <% end %> <% end %> </span> <h5> - <%= link_to([@referential, rule_parameter_set], :class => "preview", :title => "#{RuleParameterSet.model_name.human.capitalize} #{rule_parameter_set.name}") do %> + <%= link_to( organisation_rule_parameter_set_path( rule_parameter_set), :class => "preview", :title => "#{RuleParameterSet.model_name.human.capitalize} #{rule_parameter_set.name}") do %> <span class="name"> - <%= truncate(rule_parameter_set.name, :length => 20) %> + <%= truncate(rule_parameter_set.name, :length => 20) %> </span> <% end %> </h5> - </div> + </div> </div> </div> diff --git a/app/views/rule_parameter_sets/index.html.erb b/app/views/rule_parameter_sets/index.html.erb index a92840529..0d091829a 100644 --- a/app/views/rule_parameter_sets/index.html.erb +++ b/app/views/rule_parameter_sets/index.html.erb @@ -4,6 +4,6 @@ <% content_for :sidebar do %> <ul class="actions"> - <li><%= link_to t('rule_parameter_sets.actions.new'), new_referential_rule_parameter_set_path(@referential), :class => "add" %></li> + <li><%= link_to t('rule_parameter_sets.actions.new'), new_organisation_rule_parameter_set_path, :class => "add" %></li> </ul> <% end %> diff --git a/app/views/rule_parameter_sets/show.html.erb b/app/views/rule_parameter_sets/show.html.erb index e86aa47ac..c00f92a40 100644 --- a/app/views/rule_parameter_sets/show.html.erb +++ b/app/views/rule_parameter_sets/show.html.erb @@ -68,7 +68,7 @@ <label><%= t(".inter_stop_duration_max") %>: </label> <%= @rule_parameter_set.inter_stop_duration_max %> </p> - + <p> <label><%= RuleParameterSet.human_attribute_name("check_lines_in_groups") %>: </label> <%= boolean_value(@rule_parameter_set.check_lines_in_groups)%> @@ -113,7 +113,7 @@ <tr> <td><%= t("transport_modes.label.#{mode}") %></td> <% RuleParameterSet.mode_attribute_prefixes.each do |prefix| %> - + <% unless prefix == "allowed_transport" %> <td><%= @rule_parameter_set.send "#{prefix}_mode_#{mode}" %></td> <% end %> @@ -162,11 +162,11 @@ <% content_for :sidebar do %> <ul class="actions"> - <li><%= link_to t('rule_parameter_sets.actions.new'), new_referential_rule_parameter_set_path(@referential), :class => "add" %></li> + <li><%= link_to t('rule_parameter_sets.actions.new'), new_organisation_rule_parameter_set_path, :class => "add" %></li> <% if @rule_parameter_set.persisted? %> - <li><%= link_to t('rule_parameter_sets.actions.edit'), edit_referential_rule_parameter_set_path(@referential, @rule_parameter_set), :class => "edit" %></li> - <% if @referential.rule_parameter_sets.size > 1 %> - <li><%= link_to t('rule_parameter_sets.actions.destroy'), referential_rule_parameter_set_path(@referential, @rule_parameter_set), :method => :delete, :data => {:confirm => t('rule_parameter_sets.actions.destroy_confirm')}, :class => "remove" %></li> + <li><%= link_to t('rule_parameter_sets.actions.edit'), edit_organisation_rule_parameter_set_path( @rule_parameter_set), :class => "edit" %></li> + <% if current_organisation.rule_parameter_sets.size > 1 %> + <li><%= link_to t('rule_parameter_sets.actions.destroy'), organisation_rule_parameter_set_path( @rule_parameter_set), :method => :delete, :data => {:confirm => t('rule_parameter_sets.actions.destroy_confirm')}, :class => "remove" %></li> <% end %> <% end %> </ul> diff --git a/app/views/stop_areas/_form.html.erb b/app/views/stop_areas/_form.html.erb index 9fd549e18..e34253828 100644 --- a/app/views/stop_areas/_form.html.erb +++ b/app/views/stop_areas/_form.html.erb @@ -2,23 +2,23 @@ <div class="row"> <div class="col-md-6"> <%= form.inputs do %> - <%= form.input :id, :as => :hidden %> - <%= form.input :name %> - <%= form.input :stop_area_type, :as => :select, :input_html => { :disabled => !@stop_area.new_record? }, :collection => Chouette::StopArea.stop_area_types, :include_blank => false, :member_label => Proc.new { |stop_area_type| t("area_types.label.#{stop_area_type}") } %> - <div class="location_info"> - <h3><%= t("stop_areas.stop_area.localisation") %></h3> - <div id="prefetch"> + <%= form.input :id, :as => :hidden %> + <%= form.input :name, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.stop_area.name")} %> + <%= form.input :stop_area_type, :as => :select, :input_html => { :disabled => !@stop_area.new_record? }, :collection => Chouette::StopArea.stop_area_types, :include_blank => false, :member_label => Proc.new { |stop_area_type| t("area_types.label.#{stop_area_type}") } %> + <div class="location_info"> + <h3><%= t("stop_areas.stop_area.localisation") %></h3> + <div id="prefetch"> <label><%= t('.geolocalize') %></label> <input class="typeahead form-control input-lg" maxlength="255" type="text" placeholder="<%= t('.address') %>" /> </div> <% unless @referential.projection_type_label.empty? %> - <%= form.input :projection_xy, :label => t("projection_xy", :projection => @referential.projection_type_label), :input_html => { :title => t("formtastic.titles.stop_area.projection_xy")} %> + <%= form.input :projection_xy, :label => t("projection_xy", :projection => @referential.projection_type_label), :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.stop_area.projection_xy")} %> <% end %> - <%= form.input :coordinates, :input_html => { :title => t("formtastic.titles.stop_area.coordinates")} %> + <%= form.input :coordinates, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.stop_area.coordinates")} %> <%= form.input :street_name %> <%= form.input :country_code %> - <%= form.input :zip_code %> - <%= form.input :city_name %> + <%= form.input :zip_code, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.stop_area.zip_code")} %> + <%= form.input :city_name, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.stop_area.city_name")} %> <% end %> </div> <div class="col-md-6"> @@ -30,11 +30,11 @@ <div class="stop_areas.stop_area.general_info"> <h3><%= t("stop_area.general") %></h3> <%= form.inputs do %> - <%= form.input :objectid, :required => !@stop_area.new_record?, :input_html => { :title => t("formtastic.titles.stop_area.objectid")} %> - <%= form.input :registration_number, :input_html => { :title => t("formtastic.titles.stop_area.registration_number")} %> + <%= form.input :objectid, :required => !@stop_area.new_record?, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.stop_area.objectid")} %> + <%= form.input :registration_number, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.stop_area.registration_number")} %> <%= form.input :fare_code, :as => :number %> - <%= form.input :nearest_topic_name %> - <%= form.input :comment, :as => :text, :input_html => { :rows => 5 } %> + <%= form.input :nearest_topic_name, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.stop_area.nearest_topic_name")} %> + <%= form.input :comment, :as => :text, :input_html => { :rows => 5, :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.stop_area.comment") } %> <%= form.input :time_zone, :include_blank => true %> <%= form.input :url %> <% end %> diff --git a/app/views/time_tables/_form.erb b/app/views/time_tables/_form.erb index 7dceab747..8cd614fa6 100644 --- a/app/views/time_tables/_form.erb +++ b/app/views/time_tables/_form.erb @@ -1,11 +1,11 @@ <%= semantic_form_for [@referential, @time_table] do |form| %> <%= form.inputs do %> - <%= form.input :comment %> + <%= form.input :comment, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.time_table.comment")} %> <%= form.input :version %> <%= form.input :tag_search, :as => :tags, :input_html => { :id => "tag_search",:placeholder => t("formtastic.placeholders.time_table.tag_search") } %> <%= form.input :tag_list, :as => :hidden, :input_html => { :id => "tag_list" } %> - <%= form.input :objectid, :required => !@time_table.new_record?, :input_html => { :title => t("formtastic.titles.time_table.objectid")} %> + <%= form.input :objectid, :required => !@time_table.new_record?, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.time_table.objectid")} %> <% end %> <h3 class="time_table_periods"><%= @time_table.human_attribute_name("periods") %></h3> diff --git a/app/views/vehicle_journeys/_form.html.erb b/app/views/vehicle_journeys/_form.html.erb index 5322f3eb4..3c175148f 100644 --- a/app/views/vehicle_journeys/_form.html.erb +++ b/app/views/vehicle_journeys/_form.html.erb @@ -11,8 +11,9 @@ <%= form.input :status_value %> <%= form.input :facility %> <%= form.input :vehicle_type_identifier%> - <%= form.input :objectid, :required => !@vehicle_journey.new_record?, :input_html => { :title => t("formtastic.titles.vehicle_journey.objectid")} %> + <%= form.input :objectid, :required => !@vehicle_journey.new_record?, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.vehicle_journey.objectid")} %> <%= form.input :time_table_tokens, :label => t('.time_tables'), :as => :search_time_table, :json => referential_autocomplete_time_tables_path(@referential, :format => :json), :hint_text => t('search_hint'), :no_result_text => t('no_result_text'),:searching_text => t('searching_term'), :input_html => { :"data-pre" => Rabl::Renderer.new( 'autocomplete_time_tables/index', @vehicle_journey.time_tables, :view_path => 'app/views', :format => :json, :scope => :self ).render } %> + <%= form.input :footnote_ids, :as => :check_boxes, :collection => @line.footnotes.map { |f| [ "#{f.code}: #{f.label}", f.id.to_s]} %> <li class="input"> <%= form.label @vehicle_journey.human_attribute_name(:vehicle_journey_at_stop_ids), :class => "label" %> </li> @@ -50,7 +51,7 @@ :collection => @vehicle_journey.vehicle_journey_at_stops, :as => :vehicle_journey_at_stop, :locals => { :vehicle_journey_at_stops_size => @vehicle_journey.vehicle_journey_at_stops.size } %> </tbody> - </table> + </table> <% end %> diff --git a/app/views/vehicle_journeys/show.html.erb b/app/views/vehicle_journeys/show.html.erb index 667ca570c..1e7c99a37 100644 --- a/app/views/vehicle_journeys/show.html.erb +++ b/app/views/vehicle_journeys/show.html.erb @@ -68,6 +68,14 @@ <label><%= @vehicle_journey.human_attribute_name("vehicle_type_identifier") %>: </label> <%= @vehicle_journey.vehicle_type_identifier %> </p> + <p> + <label><%= @vehicle_journey.human_attribute_name("footnote_ids") %>: </label> + <ul> + <% @vehicle_journey.footnotes.each do |footnote| %> + <li><%= footnote.code %> : <%= footnote.label %></li> + <% end %> + </ul> + </p> </div> </div> <h3><%= @vehicle_journey.human_attribute_name(:vehicle_journey_at_stop_ids) %></h3> diff --git a/config/environments/development.rb b/config/environments/development.rb index 66244c886..8c7cdf6f4 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -34,6 +34,15 @@ Rails.application.configure do # Raises error for missing translations # config.action_view.raise_on_missing_translations = true + #config.active_record.auto_explain_threshold_in_seconds = (RUBY_PLATFORM == "java" ? nil : 0.5) + + config.action_mailer.default_url_options = { :host => 'localhost:3000' } + + config.action_mailer.delivery_method = :sendmail + # change to true to allow email to be sent during development + config.action_mailer.perform_deliveries = true + config.action_mailer.raise_delivery_errors = true + config.action_mailer.default :charset => "utf-8" # replace this with your production tracker code GA.tracker = "UA-AAAAAAAA" @@ -63,9 +72,7 @@ Rails.application.configure do # link to validation specification pages config.validation_spec = "http://www.chouette.mobi/neptune-validation/v20/" - config.action_mailer.default_url_options = { :host => 'localhost:3000' } - - # Configure the e-mail address which will be shown in Devise::Maile + # Configure the e-mail address which will be shown in Devise::Mailer config.mailer_sender = "appli@chouette.mobi" config.action_mailer.delivery_method = :sendmail diff --git a/config/locales/companies.yml b/config/locales/companies.yml index a9b2512a2..9ffbdc0d5 100644 --- a/config/locales/companies.yml +++ b/config/locales/companies.yml @@ -14,7 +14,6 @@ en: index: title: "Companies" name: "Search by name" - activerecord: models: company: @@ -41,8 +40,29 @@ en: formtastic: titles: company: + name: "Only alphanumerical or underscore characters." registration_number: "only alphanumerical or underscore characters " objectid: "[prefix]:Company:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character" + neptune: + company: + name: "Only alphanumerical or underscore characters." + registration_number: "only alphanumerical or underscore characters " + objectid: "[prefix]:Company:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character" + netex: + company: + name: "Only alphanumerical or underscore characters." + registration_number: "only alphanumerical or underscore characters " + objectid: "[prefix]:Company:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character" + gtfs: + company: + name: "Only alphanumerical or underscore characters." + registration_number: "only alphanumerical or underscore characters " + objectid: "[prefix]:Company:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character" + hub: + company: + name: "Only alphanumerical or underscore characters. Maximum length = 75." + registration_number: "Positif integer, unique key, of no more than 8 digits." + objectid: "[prefix]:Company:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character. Maximum length of the unique key = 3." fr: companies: @@ -60,7 +80,6 @@ fr: index: title: "Transporteurs" name: "Recherche par nom" - activerecord: models: company: @@ -87,6 +106,28 @@ fr: formtastic: titles: company: + name: "Caractères autorisés : alphanumériques et 'souligné'." registration_number: "caractères autorisés : alphanumériques et 'souligné'" objectid: "[prefixe]:Company:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'" + neptune: + company: + name: "Caractères autorisés : alphanumériques et 'souligné'." + registration_number: "caractères autorisés : alphanumériques et 'souligné'" + objectid: "[prefixe]:Company:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'" + netex: + company: + name: "Caractères autorisés : alphanumériques et 'souligné'." + registration_number: "caractères autorisés : alphanumériques et 'souligné'" + objectid: "[prefixe]:Company:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'" + gtfs: + company: + name: "Caractères autorisés : alphanumériques et 'souligné'." + registration_number: "caractères autorisés : alphanumériques et 'souligné'" + objectid: "[prefixe]:Company:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'" + hub: + company: + name: "Caractères autorisés : alphanumériques et 'souligné'. Longueur maximale = 75." + registration_number: "Entier positif, clé unique, d'un maximum de 8 chiffres." + objectid: "[prefixe]:Company:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'. Longueur maximale de la clé unique = 3." + diff --git a/config/locales/compliance_check_results.yml b/config/locales/compliance_check_results.yml index dd8c5ed5d..0e0177337 100644 --- a/config/locales/compliance_check_results.yml +++ b/config/locales/compliance_check_results.yml @@ -2,15 +2,17 @@ en: compliance_check_results: file: zip_name_prefix: "compliance_check_results" - summary_errors_file_prefix: "summary_errors_index.csv" - detailed_errors_file_prefix: "detailed_errors_index.csv" + summary_errors_file_prefix: "summary_of_tests.csv" + detailed_errors_file_prefix: "detail_of_errors.csv" index: line: "Li" column: "Col" compliance_check_result: severities: - error: "Obligatory Tests" - warning: "Optionnal Tests" + error: "Required" + warning: "Optional" + error_txt: "Required" + warning_txt: "Optional" statuses: nok: "Error" na: "Unavailable" @@ -128,7 +130,7 @@ en: detail_3_route_7: "La séquence d'arrêt %{objectId} n'a pas de mission" detail_3_route_8: "La séquence d'arrêt %{objectId} a %{count} arrêts non utilisés par des missions : %{names}" detail_3_route_9: "La séquence d'arrêt %{objectId} n'a pas de mission desservant l'ensemble de ses arrêts" - detail_3_journeypattern_1: "La mission %{objectId} utilise les mêmes arrêts que la mission %{journeyPatternId}; nombre d'arrêts = %{count}" + detail_3_journeypattern_1: "La mission %{objectId} utilise les mêmes arrêts que la mission %{journeyPatternId} - nombre d'arrêts = %{count}" detail_3_vehiclejourney_1: "Arrêt n° %{stopRank} (%{stopName}) : durée d'arrêt mesurée %{diffTime} > %{maxDiffTime}" detail_3_vehiclejourney_2_1: "La course %{objectId} a des horaires décroissants entre les arrêts n° %{firstStopRank} (%{firstStopName}) et n° %{lastStopRank} (%{lastStopName})" detail_3_vehiclejourney_2_2: "La course %{objectId} a une vitesse %{speed} < %{speedLimit} km/h entre les arrêts n° %{firstStopRank} (%{firstStopName}) et n° %{lastStopRank} (%{lastStopName})" @@ -159,6 +161,8 @@ en: detail_4_stoparea_1_pattern: "L'attribut %{column} de l'arrêt %{objectId} (%{value}) n'est pas au bon format " detail_4_stoparea_1_unique: "L'attribut %{column} de l'arrêt %{objectId} a une valeur partagée avec l'arrêt %{alternateId}" detail_4_stoparea_2: "L'arrêt physique %{name} (%{objectId}) n'a pas de parent" + detail_4_stoparea_3_1: "La commune %{cityName} de l'arrêt %{name} (%{objectId}) a le même code Insee %{countryCode} que la commune %{alternateCityName} de l'arrêt %{alternateStopareaName} (%{alternateStopareaId})" + detail_4_stoparea_3_2: "La commune %{cityName} a un code Insee %{countryCode} pour l'arrêt %{name} (%{objectId}) différent de celui %{alternateCountryCode} de l'arrêt %{alternateStopareaName} (%{alternateStopareaId})" detail_4_accesspoint_1_min_size: "L'attribut %{column} du point d'accès %{objectId} (%{value}) n'est pas renseigné ou plus petit que %{minimum}" detail_4_accesspoint_1_max_size: "L'attribut %{column} du point d'accès %{objectId} (%{value}) est plus grand que %{maximum}" detail_4_accesspoint_1_pattern: "L'attribut %{column} du point d'accès %{objectId} (%{value}) n'est pas au bon format " @@ -198,8 +202,7 @@ en: detail_4_vehiclejourney_1_pattern: "L'attribut %{column} de la course %{objectId} (%{value}) n'est pas au bon format " detail_4_vehiclejourney_1_unique: "L'attribut %{column} de la course %{objectId} a une valeur partagée avec la course %{alternateId}" detail_4_vehiclejourney_2: "La course %{objectId} a un mode de transport interdit %{transportMode}" - - activerecord: + activerecord: models: compliance_check_result: zero: "Validation" @@ -317,6 +320,7 @@ en: 4-GroupOfLine-1: "Vérification de contraintes sur les attributs des groupes de lignes" 4-StopArea-1: "Vérification de contraintes sur les attributs des arrêts" 4-StopArea-2: "Vérification de l'existance d'un arrêt commercial pour les arrêts physiques" + 4-StopArea-3: "Vérification de la cohérence entre les noms de communes et leur code INSEE" 4-AccessPoint-1: "Vérification de contraintes sur les attributs des accès" 4-AccessLink-1: "Vérification de contraintes sur les attributs des liens d'accès" 4-ConnectionLink-1: "Vérification de contraintes sur les attributs des correspondances" @@ -336,9 +340,11 @@ en: rule_target: "Object" rule_number: "Step" rule_code: "Code" - violation_count: "Number of violations" + violation_count: "errors" + violation_count_txt: "Number of errors" objects: "Objects in violations" detail: "Detail" + title: "Test title" object: "Error object" resource: "Resources of the error object" url: "URL" @@ -347,15 +353,17 @@ fr: compliance_check_results: file: zip_name_prefix: "resultats_de_validation" - summary_errors_file_prefix: "sommaire_des_erreurs.csv" - detailed_errors_file_prefix: "détails_des_erreurs.csv" + summary_errors_file_prefix: "sommaire_des_tests.csv" + detailed_errors_file_prefix: "details_des_erreurs.csv" index: line: "Li" column: "Col" compliance_check_result: severities: - error: "Tests Obligatoires" - warning: "Tests Optionnels" + error: "Obligatoires" + warning: "Optionnels" + error_txt: "Obligatoire" + warning_txt: "Optionnel" statuses: nok: "Erreur" na: "Absent" @@ -471,7 +479,7 @@ fr: detail_3_route_7: "La séquence d'arrêt %{objectId} n'a pas de mission" detail_3_route_8: "La séquence d'arrêt %{objectId} a %{count} arrêts non utilisés par des missions : %{names}" detail_3_route_9: "La séquence d'arrêt %{objectId} n'a pas de mission desservant l'ensemble de ses arrêts" - detail_3_journeypattern_1: "La mission %{objectId} utilise les mêmes arrêts que la mission %{journeyPatternId}; nombre d'arrêts = %{count}" + detail_3_journeypattern_1: "La mission %{objectId} utilise les mêmes arrêts que la mission %{journeyPatternId} - nombre d'arrêts = %{count}" detail_3_vehiclejourney_1: "Arrêt n° %{stopRank} (%{stopName}) : durée d'arrêt mesurée %{diffTime} > %{maxDiffTime}" detail_3_vehiclejourney_2_1: "La course %{objectId} a des horaires décroissants entre les arrêts n° %{firstStopRank} (%{firstStopName}) et n° %{lastStopRank} (%{lastStopName})" detail_3_vehiclejourney_2_2: "La course %{objectId} a une vitesse %{speed} < %{speedLimit} km/h entre les arrêts n° %{firstStopRank} (%{firstStopName}) et n° %{lastStopRank} (%{lastStopName})" @@ -639,6 +647,10 @@ fr: 3-Route-3: "Vérification de la distance entre deux arrêts successifs de la séquence" 3-Route-4: "Vérification de double définition de séquences" 3-Route-5: "Vérification de séquences sans séquence opposée" + 3-Route-6: "Vérification de la présence d'arrêts dans la séquence" + 3-Route-7: "Vérification de la présence de missions" + 3-Route-8: "Vérification de l'utilisation des arrêts par les missions" + 3-Route-9: "Vérification de l’existence d’une mission passant par tous les arrêts de la séquence" 3-JourneyPattern-1: "Vérification de l'utilisation des arrêts par les missions" 3-JourneyPattern-2: "Vérification de l’existence d’une mission passant par tous les arrêts de la séquence" 3-JourneyPattern-3: "Vérification de double définition de missions" @@ -672,9 +684,11 @@ fr: rule_target: "Objet" rule_number: "Etape" rule_code: "Code" - violation_count: "Nombre de violations" - objects: "Objets en violations" + violation_count: "erreurs" + violation_count_txt: "Nombre d'erreurs" + objects: "Objets en erreur" detail: "Détail" + title: "Titre du test" object: "Objet en erreur" resource: "Ressource de l'objet en erreur" url: "URL" diff --git a/config/locales/compliance_check_tasks.yml b/config/locales/compliance_check_tasks.yml index d56574c1d..ddbbdb5e6 100644 --- a/config/locales/compliance_check_tasks.yml +++ b/config/locales/compliance_check_tasks.yml @@ -12,7 +12,7 @@ en: failed: "[ Failed ]" pending: "[ In the treatment queue ]" processing: "[ In progress... ]" - export: "Export" + export: "Download test report" export_csv: "CSV format" new: title: "Create a new validation" @@ -81,7 +81,7 @@ fr: failed: "[ Echoué ]" pending: "[ En file d'attente ]" processing: "[ En progression... ]" - export: "Export" + export: "Télécharger les résultats" export_csv: "Format CSV" new: title: "Démarrer une nouvelle validation" diff --git a/config/locales/connection_links.yml b/config/locales/connection_links.yml index 815a913f8..790e2973f 100644 --- a/config/locales/connection_links.yml +++ b/config/locales/connection_links.yml @@ -61,6 +61,23 @@ en: titles: connection_link: objectid: "[prefix]:ConnectionLink:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character" + link_distance: "" + neptune: + connection_link: + objectid: "[prefix]:ConnectionLink:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character" + link_distance: "" + netex: + connection_link: + objectid: "[prefix]:ConnectionLink:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character" + link_distance: "" + gtfs: + connection_link: + objectid: "[prefix]:ConnectionLink:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character" + link_distance: "" + hub: + connection_link: + objectid: "[prefix]:ConnectionLink:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character" + link_distance: "At most 10000.0 meters." fr: connection_links: @@ -125,4 +142,21 @@ fr: titles: connection_link: objectid: "[prefixe]:ConnectionLink:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'" + link_distance: "" + neptune: + connection_link: + objectid: "[prefixe]:ConnectionLink:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'" + link_distance: "" + netex: + connection_link: + objectid: "[prefixe]:ConnectionLink:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'" + link_distance: "" + gtfs: + connection_link: + objectid: "[prefixe]:ConnectionLink:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'" + link_distance: "" + hub: + connection_link: + objectid: "[prefixe]:ConnectionLink:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'" + link_distance: "Au plus 10000.0 mètres." diff --git a/config/locales/exports.yml b/config/locales/exports.yml index 26d215879..daa48afe3 100644 --- a/config/locales/exports.yml +++ b/config/locales/exports.yml @@ -316,6 +316,7 @@ en: start_date: "Start of period" end_date: "End of period" object_id_prefix: "objectId prefix to be ignored" + extensions: "add extra fields in comments" export_log_message: created_at: "Date" position: "N." @@ -446,6 +447,7 @@ fr: start_date: "Début de période" end_date: "Fin de période" object_id_prefix: "Préfixe d'identifiant Neptune à ignorer" + extensions: "ajout de champs supplémentaires dans les commentaires" export_log_message: created_at: "Date" position: "No" diff --git a/config/locales/footnotes.en.yml b/config/locales/footnotes.en.yml new file mode 100644 index 000000000..98be688c5 --- /dev/null +++ b/config/locales/footnotes.en.yml @@ -0,0 +1,13 @@ +en: + footnotes: + actions: + add_footnote: "add footnote" + index: + title: "Footnotes" + activerecord: + models: + footnote: "footnote" + attributes: + footnote: + code: "number" + label: "line text" diff --git a/config/locales/footnotes.fr.yml b/config/locales/footnotes.fr.yml new file mode 100644 index 000000000..f1a9b2cf5 --- /dev/null +++ b/config/locales/footnotes.fr.yml @@ -0,0 +1,13 @@ +fr: + footnotes: + actions: + add_footnote: "ajouter une note en bas de page" + index: + title: "Notes en bas de page" + activerecord: + models: + footnote: "note en bas de page" + attributes: + footnote: + code: "numéro" + label: "ligne de texte" diff --git a/config/locales/group_of_lines.yml b/config/locales/group_of_lines.yml index a573b2247..d84c62682 100644 --- a/config/locales/group_of_lines.yml +++ b/config/locales/group_of_lines.yml @@ -36,7 +36,29 @@ en: formtastic: titles: group_of_line: + name: "Only alphanumerical or underscore characters." + registration_number: "Positif integer." objectid: "[prefix]:GroupOfLine:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character" + neptune: + group_of_line: + name: "Only alphanumerical or underscore characters." + registration_number: "Positif integer." + objectid: "[prefix]:GroupOfLine:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character" + netex: + group_of_line: + name: "Only alphanumerical or underscore characters." + registration_number: "Positif integer." + objectid: "[prefix]:GroupOfLine:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character" + gtfs: + group_of_line: + name: "Only alphanumerical or underscore characters." + registration_number: "Positif integer." + objectid: "[prefix]:GroupOfLine:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character" + hub: + group_of_lines: + name: "Only alphanumerical or underscore characters. Maximum length = 75." + registration_number: "Positif integer, unique key, of no more than 8 digits." + objectid: "[prefix]:GroupOfLine:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character. Maximum length of the unique key = 6." fr: group_of_lines: @@ -76,5 +98,27 @@ fr: formtastic: titles: group_of_line: + name: "Caractères autorisés : alphanumériques et 'souligné'." + registration_number: "Entier positif." objectid: "[prefixe]:GroupOfLine:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'" + neptune: + group_of_line: + name: "Caractères autorisés : alphanumériques et 'souligné'." + registration_number: "Entier positif." + objectid: "[prefixe]:GroupOfLine:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'" + netex: + group_of_line: + name: "Caractères autorisés : alphanumériques et 'souligné'." + registration_number: "Entier positif." + objectid: "[prefixe]:GroupOfLine:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'" + gtfs: + group_of_line: + name: "Caractères autorisés : alphanumériques et 'souligné'." + registration_number: "Entier positif." + objectid: "[prefixe]:GroupOfLine:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'" + hub: + group_of_lines: + name: "Caractères autorisés : alphanumériques et 'souligné'. Longueur maximale = 75." + registration_number: "Entier positif, clé unique, d'un maximum de 8 chiffres." + objectid: "[prefixe]:GroupOfLine:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'. Longueur maximale de la clé unique = 6." diff --git a/config/locales/hub.en.yml b/config/locales/hub.en.yml new file mode 100644 index 000000000..74f6ad9ec --- /dev/null +++ b/config/locales/hub.en.yml @@ -0,0 +1,5 @@ +en: + hub: + routes: + wayback_code_exclusive: "Waybak already used for another route" + max_by_line: "HUB format allows a maximum of 2 routes for a line" diff --git a/config/locales/hub.fr.yml b/config/locales/hub.fr.yml new file mode 100644 index 000000000..2ff5b7365 --- /dev/null +++ b/config/locales/hub.fr.yml @@ -0,0 +1,5 @@ +fr: + hub: + routes: + wayback_code_exclusive: "Une autre séquence existe déjà dans le même sens (Aller ou Retour)" + max_by_line: "Le format HUB n'autorise que 2 séquences d'arrêts au plus pour une ligne" diff --git a/config/locales/journey_patterns.yml b/config/locales/journey_patterns.yml index 2bf072df0..8d76778ef 100644 --- a/config/locales/journey_patterns.yml +++ b/config/locales/journey_patterns.yml @@ -42,7 +42,29 @@ en: formtastic: titles: journey_pattern: + name: "Only alphanumerical or underscore characters." + registration_number: "Positif integer." objectid: "[prefix]:JourneyPattern:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character" + neptune: + journey_pattern: + name: "Only alphanumerical or underscore characters." + registration_number: "Positif integer." + objectid: "[prefix]:JourneyPattern:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character" + netex: + journey_pattern: + name: "Only alphanumerical or underscore characters." + registration_number: "Positif integer." + objectid: "[prefix]:JourneyPattern:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character" + gtfs: + journey_pattern: + name: "Only alphanumerical or underscore characters." + registration_number: "Positif integer." + objectid: "[prefix]:JourneyPattern:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character" + hub: + journey_pattern: + name: "Only alphanumerical or underscore characters. Maximum length = 75." + registration_number: "Positif integer, unique key, of no more than 8 digits." + objectid: "[prefix]:JourneyPattern:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character. Maximum length of the unique key = 30." fr: journey_patterns: @@ -88,4 +110,26 @@ fr: formtastic: titles: journey_pattern: + name: "Caractères autorisés : alphanumériques et 'souligné'." + registration_number: "Entier positif." objectid: "[prefixe]:JourneyPattern:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'" + neptune: + journey_pattern: + name: "Caractères autorisés : alphanumériques et 'souligné'." + registration_number: "Entier positif." + objectid: "[prefixe]:JourneyPattern:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'" + netex: + journey_pattern: + name: "Caractères autorisés : alphanumériques et 'souligné'." + registration_number: "Entier positif." + objectid: "[prefixe]:JourneyPattern:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'" + gtfs: + journey_pattern: + name: "Caractères autorisés : alphanumériques et 'souligné'." + registration_number: "Entier positif." + objectid: "[prefixe]:JourneyPattern:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'" + hub: + journey_pattern: + name: "Caractères autorisés : alphanumériques et 'souligné'. Longueur maximale = 75." + registration_number: "Entier positif, clé unique, d'un maximum de 8 chiffres." + objectid: "[prefixe]:JourneyPattern:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'. Longueur maximale de la clé unique = 30." diff --git a/config/locales/lines.yml b/config/locales/lines.yml index 98d93bcd2..331c09d1c 100644 --- a/config/locales/lines.yml +++ b/config/locales/lines.yml @@ -82,11 +82,38 @@ en: object_version: "Version" creation_time: "Created on" creator_id: "Created by" + footnotes: "Footnotes" formtastic: titles: line: + name: "Only alphanumerical or underscore characters." registration_number: "only alphanumerical or underscore characters" objectid: "[prefix]:Line:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character" + number: "" + neptune: + line: + name: "Only alphanumerical or underscore characters." + registration_number: "only alphanumerical or underscore characters" + objectid: "[prefix]:Line:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character" + number: "" + netex: + line: + name: "Only alphanumerical or underscore characters." + registration_number: "only alphanumerical or underscore characters" + objectid: "[prefix]:Line:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character" + number: "" + gtfs: + line: + name: "Only alphanumerical or underscore characters." + registration_number: "only alphanumerical or underscore characters" + objectid: "[prefix]:Line:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character" + number: "" + hub: + line: + name: "Only alphanumerical or underscore characters. Maximum length = 75." + registration_number: "Positif integer, unique key, of no more than 8 digits." + objectid: "[prefix]:Line:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character. Maximum length of the unique key = 14." + number: "Only alphanumerical or underscore characters. Maximum length = 6." fr: lines: @@ -172,8 +199,35 @@ fr: object_version: "Version" creation_time: "Créé le" creator_id: "Créé par" + footnotes: "Notes de bas de page" formtastic: titles: line: + name: "Caractères autorisés : alphanumériques et 'souligné'." registration_number: "caractères autorisés : alphanumériques et 'souligné'" objectid: "[prefixe]:Line:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'" + number: "" + neptune: + line: + name: "Caractères autorisés : alphanumériques et 'souligné'." + registration_number: "caractères autorisés : alphanumériques et 'souligné'" + objectid: "[prefixe]:Line:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'" + number: "" + netex: + line: + name: "Caractères autorisés : alphanumériques et 'souligné'." + registration_number: "caractères autorisés : alphanumériques et 'souligné'" + objectid: "[prefixe]:Line:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'" + number: "" + gtfs: + line: + name: "Caractères autorisés : alphanumériques et 'souligné'." + registration_number: "caractères autorisés : alphanumériques et 'souligné'" + objectid: "[prefixe]:Line:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'" + number: "" + hub: + line: + name: "Caractères autorisés : alphanumériques et 'souligné'. Longueur maximale = 75." + registration_number: "Entier positif, clé unique, d'un maximum de 8 chiffres." + objectid: "[prefixe]:Line:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'. Longueur maximale de la clé unique = 14." + number: "Caractères autorisés : alphanumériques et 'souligné'. Longueur maximale = 6." diff --git a/config/locales/networks.yml b/config/locales/networks.yml index 30cd399b9..127d2b920 100644 --- a/config/locales/networks.yml +++ b/config/locales/networks.yml @@ -14,7 +14,6 @@ en: index: title: "Networks" name: "Search by name" - activerecord: models: network: @@ -38,8 +37,29 @@ en: formtastic: titles: network: + name: "Only alphanumerical or underscore characters." registration_number: "only alphanumerical or underscore characters" objectid: "[prefix]:GroupOfLine:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character" + neptune: + network: + name: "Only alphanumerical or underscore characters." + registration_number: "only alphanumerical or underscore characters" + objectid: "[prefix]:GroupOfLine:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character" + netex: + network: + name: "Only alphanumerical or underscore characters." + registration_number: "only alphanumerical or underscore characters" + objectid: "[prefix]:GroupOfLine:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character" + gtfs: + network: + name: "Only alphanumerical or underscore characters." + registration_number: "only alphanumerical or underscore characters" + objectid: "[prefix]:GroupOfLine:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character" + hub: + network: + name: "Only alphanumerical or underscore characters. Maximum length = 75." + registration_number: "Positif integer, unique key, of no more than 8 digits." + objectid: "[prefix]:GroupOfLine:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character. Maximum length of the unique key = 3." fr: networks: @@ -80,6 +100,27 @@ fr: formtastic: titles: network: + name: "Caractères autorisés : alphanumériques et 'souligné'." registration_number: "caractères autorisés : alphanumériques et 'souligné'" objectid: "[prefixe]:GroupOfLine:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'" + neptune: + network: + name: "Caractères autorisés : alphanumériques et 'souligné'." + registration_number: "caractères autorisés : alphanumériques et 'souligné'" + objectid: "[prefixe]:GroupOfLine:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'" + netex: + network: + name: "Caractères autorisés : alphanumériques et 'souligné'." + registration_number: "caractères autorisés : alphanumériques et 'souligné'" + objectid: "[prefixe]:GroupOfLine:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'" + gtfs: + network: + name: "Caractères autorisés : alphanumériques et 'souligné'." + registration_number: "caractères autorisés : alphanumériques et 'souligné'" + objectid: "[prefixe]:GroupOfLine:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'" + hub: + network: + name: "Caractères autorisés : alphanumériques et 'souligné'. Longueur maximale = 75." + registration_number: "Entier positif, clé unique, d'un maximum de 8 chiffres." + objectid: "[prefixe]:GroupOfLine:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'. Longueur maximale de la clé unique = 3." diff --git a/config/locales/organisations.yml b/config/locales/organisations.yml index e6b86d29d..d328db897 100644 --- a/config/locales/organisations.yml +++ b/config/locales/organisations.yml @@ -6,11 +6,16 @@ en: title: "Update your organisation" key_registered: "Key registered" key_not_registered: "No key registered" - activerecord: + show: + users: "Users" + rule_parameter_sets: "Rule parameter sets" + activerecord: attributes: organisation: name: "Name" - geoportail_key: "IGN Geoportail Key" + data_format_restrictions_by_default: "Data format constraint by default" + data_format: "Data format" + geoportail_key: "IGN Geoportail Key" fr: organisations: @@ -20,8 +25,13 @@ fr: title: "Modifier votre organisation" key_registered: "Clé enregistrée" key_not_registered: "Pas de clé" - activerecord: + show: + users: "Utilisateurs" + rule_parameter_sets: "Jeux de paramètres" + activerecord: attributes: organisation: name: "Nom" - geoportail_key: "Clé de l'API du Geoportail IGN" + data_format_restrictions_by_default: "Appliquer les contraintes format des données par defaut" + data_format: "Format de données" + geoportail_key: "Clé de l'API du Geoportail IGN" diff --git a/config/locales/referentials.yml b/config/locales/referentials.yml index 0d3a63498..1dad5a3c2 100644 --- a/config/locales/referentials.yml +++ b/config/locales/referentials.yml @@ -10,7 +10,7 @@ en: title: "Data space" clean_up: "Clean up" api_keys: "Authentification keys for an API REST access" - counts: + counts: objects: "Data space elements" count: "count" validity_out: @@ -30,7 +30,7 @@ en: user_excluded: "%{user} is a reserved value" activerecord: models: - referential: + referential: zero: "Data space" one: "Data space" other: "Data spaces" @@ -66,6 +66,8 @@ en: export_tasks: "Exports" compliance_check_tasks: "Validations" rule_parameter_sets: "Rule parameters sets" + data_format_restrictions: "Data format constraint" + data_format: "Data format" formtastic: titles: referential: @@ -86,8 +88,8 @@ fr: title: "Espace de données" clean_up: "Purge des données obsolètes" api_keys: "Clés d'authentification pour un accès à l'API REST" - counts: - objects: "Eléments" + counts: + objects: "Eléments" count: "Qté" validity_out: validity_out_time_tables: "Calendriers échus" @@ -106,7 +108,7 @@ fr: user_excluded: "%{user} est une valeur réservée" activerecord: models: - referential: + referential: zero: "Espace de Données" one: "Espace de Données" other: "Espaces de Données" @@ -117,7 +119,7 @@ fr: prefix: "Préfixe des identifiants Neptune" projection_type: "Système de référence spatiale (SRID) optionnel" time_zone: "Fuseau horaire" - upper_corner: "Point haut/droite de l'emprise par défaut" + upper_corner: "Point haut/droite de l'emprise par défaut" lower_corner: "Point bas/gauche de l'emprise par défaut" resources: "Import Neptune" validity_period: "Période de validité" @@ -142,10 +144,12 @@ fr: export_tasks: "Exports" compliance_check_tasks: "Validations" rule_parameter_sets: "Jeux de paramètres" + data_format_restrictions: "Appliquer les contraintes format des données" + data_format: "Format de données" formtastic: titles: referential: - slug: "caractères autorisés : alphanumériques minuscules et 'souligné' et doit commencer par une lettre" + slug: "caractères autorisés : alphanumériques minuscules et 'souligné' et doit commencer par une lettre" prefix: "caractères autorisés : alphanumériques et 'souligné'" upper_corner: "latitude,longitude dans le référentiel WGS84, le séparateur de décimales est 'point'" lower_corner: "latitude,longitude dans le référentiel WGS84, le séparateur de décimales est 'point'" diff --git a/config/locales/routes.yml b/config/locales/routes.yml index 45b82076c..62b57734c 100644 --- a/config/locales/routes.yml +++ b/config/locales/routes.yml @@ -38,7 +38,6 @@ en: negative: "backward" opposite: "Opposite route" no_opposite: "No opposite route" - activerecord: models: route: @@ -69,6 +68,18 @@ en: titles: route: objectid: "[prefix]:Route:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character" + neptune: + route: + objectid: "[prefix]:Route:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character" + netex: + route: + objectid: "[prefix]:Route:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character" + gtfs: + route: + objectid: "[prefix]:Route:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character" + hub: + route: + objectid: "[prefix]:Route:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character. Maximum length of the unique key = 8." fr: routes: @@ -140,5 +151,17 @@ fr: titles: route: objectid: "[prefixe]:Route:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'" + neptune: + route: + objectid: "[prefixe]:Route:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'" + netex: + route: + objectid: "[prefixe]:Route:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'" + gtfs: + route: + objectid: "[prefixe]:Route:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'" + hub: + route: + objectid: "[prefixe]:Route:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'. Longueur maximale de la clé unique = 8." diff --git a/config/locales/rule_parameter_sets.yml b/config/locales/rule_parameter_sets.yml index c1f1edceb..1205eb785 100644 --- a/config/locales/rule_parameter_sets.yml +++ b/config/locales/rule_parameter_sets.yml @@ -8,6 +8,8 @@ en: destroy_confirm: "Are you sure you want destroy this rule parameter set ?" new: title: "Add a new parameter set" + destroy: + last_rps_protected: "Delete refused. Last rule parameter set in current referential can't be destroyed." edit: title: "Update parameter set %{rule_parameter_set}" form: @@ -66,7 +68,7 @@ en: check_lines_in_groups: "check if each line belongs scrictly to one group of line" check_line_routes: "check if each line have 1 route or 2 routes coupled" check_stop_parent: "check if all physical stop areas are owned by a commercial stop point" - check_connection_link_on_physical: "check if connection links connect only physical stops" + check_connection_link_on_physical: "check if connection links connect only physical stops" check_allowed_transport_modes: "Check transport modes" allowed_transport: "Allowed" attribute: "attribute" @@ -89,6 +91,8 @@ fr: add_mode_parameter_set: "Ajouter les paramètres spécifiques à un mode" edit: title: "Modifier le jeu de paramètres %{rule_parameter_set}" + destroy: + last_rps_protected: "Suppresion impossible. L'espace de données doit compter au minimum un jeu de paramètres." show: title: "Jeu de paramètres %{rule_parameter_set}" max_distance: "Distance maximum entre : " diff --git a/config/locales/stop_areas.yml b/config/locales/stop_areas.yml index bb08b8ace..227a3dbb6 100644 --- a/config/locales/stop_areas.yml +++ b/config/locales/stop_areas.yml @@ -111,10 +111,59 @@ en: formtastic: titles: stop_area: + name: "Only alphanumerical or underscore characters." registration_number: "only alphanumerical or underscore characters" objectid: "[prefix]:StopArea:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character" + nearest_topic_name: "" + city_name: "" + zip_code: "" + comment: "" coordinates: "latitude,longitude in WGS84 referential, dot for decimal separator" projection_xy: "x,y in secondary referential, dot for decimal separator" + neptune: + stop_area: + name: "Only alphanumerical or underscore characters." + registration_number: "only alphanumerical or underscore characters" + objectid: "[prefix]:StopArea:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character" + nearest_topic_name: "" + city_name: "" + zip_code: "" + comment: "" + coordinates: "latitude,longitude in WGS84 referential, dot for decimal separator" + projection_xy: "x,y in secondary referential, dot for decimal separator" + netex: + stop_area: + name: "Only alphanumerical or underscore characters." + registration_number: "only alphanumerical or underscore characters" + objectid: "[prefix]:StopArea:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character" + nearest_topic_name: "" + city_name: "" + zip_code: "" + comment: "" + coordinates: "latitude,longitude in WGS84 referential, dot for decimal separator" + projection_xy: "x,y in secondary referential, dot for decimal separator" + gtfs: + stop_area: + name: "Only alphanumerical or underscore characters." + registration_number: "only alphanumerical or underscore characters" + objectid: "[prefix]:StopArea:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character" + nearest_topic_name: "" + city_name: "" + zip_code: "" + comment: "" + coordinates: "latitude,longitude in WGS84 referential, dot for decimal separator" + projection_xy: "x,y in secondary referential, dot for decimal separator" + hub: + stop_area: + name: "Only alphanumerical or underscore characters. Maximum length = 75." + registration_number: "Positif integer, unique key, of no more than 8 digits. Mandatory for physical stops." + objectid: "[prefix]:StopArea:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character. Maximum length of the unique key = 12." + nearest_topic_name: "Only alphanumerical or underscore characters. Maximum length = 255 for logical stops and 60 for physical stops." + city_name: "Only alphanumerical or underscore characters. Mandatory for physical stops. Maximum length = 75." + zip_code: "Positif integer 5 digits. Mandatory for physical stops." + comment: "Only alphanumerical or underscore characters. Maximum length = 255." + coordinates: "Coordinates are mandatory." + projection_xy: "x,y in secondary referential, dot for decimal separator" fr: stop_areas: @@ -231,9 +280,58 @@ fr: formtastic: titles: stop_area: + name: "Caractères autorisés : alphanumériques et 'souligné'." registration_number: "caractères autorisés : alphanumériques et 'souligné'" objectid: "[prefixe]:StopArea:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'" + nearest_topic_name: "" + city_name: "" + zip_code: "" + comment: "" coordinates: "latitude,longitude dans le référentiel WGS84, le séparateur de décimales est 'point'" projection_xy: "x,y dans le référentiel secondaire, le séparateur de décimales est 'point'" + neptune: + stop_area: + name: "Caractères autorisés : alphanumériques et 'souligné'." + registration_number: "caractères autorisés : alphanumériques et 'souligné'" + objectid: "[prefixe]:StopArea:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'" + nearest_topic_name: "" + city_name: "" + zip_code: "" + comment: "" + coordinates: "latitude,longitude dans le référentiel WGS84, le séparateur de décimales est 'point'" + projection_xy: "x,y dans le référentiel secondaire, le séparateur de décimales est 'point'" + netex: + stop_area: + name: "Caractères autorisés : alphanumériques et 'souligné'." + registration_number: "caractères autorisés : alphanumériques et 'souligné'" + objectid: "[prefixe]:StopArea:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'" + nearest_topic_name: "" + city_name: "" + zip_code: "" + comment: "" + coordinates: "latitude,longitude dans le référentiel WGS84, le séparateur de décimales est 'point'" + projection_xy: "x,y dans le référentiel secondaire, le séparateur de décimales est 'point'" + gtfs: + stop_area: + name: "Caractères autorisés : alphanumériques et 'souligné'." + registration_number: "caractères autorisés : alphanumériques et 'souligné'" + objectid: "[prefixe]:StopArea:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'" + nearest_topic_name: "" + city_name: "" + zip_code: "" + comment: "" + coordinates: "latitude,longitude dans le référentiel WGS84, le séparateur de décimales est 'point'" + projection_xy: "x,y dans le référentiel secondaire, le séparateur de décimales est 'point'" + hub: + stop_area: + name: "Caractères autorisés : alphanumériques et 'souligné'. Longueur maximale = 75." + registration_number: "Entier positif, clé unique, d'un maximum de 8 chiffres. Obligatoire pour les arrêts physiques." + objectid: "[prefixe]:StopArea:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'. Longueur maximale de la clé unique = 12." + nearest_topic_name: "Caractères autorisés : alphanumériques et 'souligné'. Longueur maximale = 255 pour les arrêts logiques et 60 pour les arrêts physiques." + city_name: "Caractères autorisés : alphanumériques et 'souligné'. Obligatoire pour les arrêts physiques. Longueur maximale = 80." + zip_code: "Entier positif de 8 chiffres. Obligatoire pour les arrêts physiques." + comment: "Caractères autorisés : alphanumériques et 'souligné'. Longueur maximale = 255." + coordinates: "Les coordonnées sont obligatoires." + projection_xy: "x,y dans le référentiel secondaire, le séparateur de décimales est 'point'" diff --git a/config/locales/time_tables.yml b/config/locales/time_tables.yml index dd9845138..b0d469297 100644 --- a/config/locales/time_tables.yml +++ b/config/locales/time_tables.yml @@ -84,7 +84,24 @@ en: formtastic: titles: time_table: + comment: "Only alphanumerical or underscore characters." objectid: "[prefix]:Timetable:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character" + neptune: + time_table: + comment: "Only alphanumerical or underscore characters." + objectid: "[prefix]:Timetable:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character" + netex: + time_table: + comment: "Only alphanumerical or underscore characters." + objectid: "[prefix]:Timetable:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character" + gtfs: + time_table: + comment: "Only alphanumerical or underscore characters." + objectid: "[prefix]:Timetable:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character" + hub: + time_table: + comment: "Only alphanumerical or underscore characters. Maximum length = 75." + objectid: "[prefix]:Timetable:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character. Maximum length of the unique key = 6." placeholders: time_table: tag_search: "ex: Public hollidays,School holidays" @@ -179,7 +196,24 @@ fr: formtastic: titles: time_table: + comment: "Caractères autorisés : alphanumériques et 'souligné'." objectid: "[prefixe]:Timetable:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'" + neptune: + time_table: + comment: "Caractères autorisés : alphanumériques et 'souligné'." + objectid: "[prefixe]:Timetable:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'" + netex: + time_table: + comment: "Caractères autorisés : alphanumériques et 'souligné'." + objectid: "[prefixe]:Timetable:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'" + gtfs: + time_table: + comment: "Caractères autorisés : alphanumériques et 'souligné'." + objectid: "[prefixe]:Timetable:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'" + hub: + time_table: + comment: "Caractères autorisés : alphanumériques et 'souligné'. Longueur maximale = 75." + objectid: "[prefixe]:Timetable:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'. Longueur maximale de la clé unique = 6." placeholders: time_table: tag_search: "ex: Jours fériés,Vacances scolaires" diff --git a/config/locales/vehicle_journey_exports.yml b/config/locales/vehicle_journey_exports.en.yml index f8169c544..93a782026 100644 --- a/config/locales/vehicle_journey_exports.yml +++ b/config/locales/vehicle_journey_exports.en.yml @@ -10,6 +10,7 @@ en: flexible_service: "on demand (Y(es)|N(o)|empty for unknown)" published_journey_name: "published name" mobility: "wheel_chairs (Y(es)|N(o)|empty for unknown)" + footnotes_ids: "footnotes" stop_id: "stop id" stop_name: "stop name" b_true: "Yes" @@ -22,31 +23,7 @@ en: friday: "Fr" saturday: "Sa" sunday: "Su" + ftn_columns: "ref;number;line text" vj_filename: "vehicle_journeys_" tt_filename: "time_tables" -fr: - vehicle_journey_exports: - new: - title: "Exporter les horaires existants" - basename: "courses" - label: - vehicle_journey_id: "id course (vide si nouvelle)" - number: "numéro" - time_table_ids: "calendriers" - flexible_service: "TAD (O(ui)|N(on)|vide si inconnu)" - published_journey_name: "nom public" - mobility: "PMR (O(ui)|N(on)|vide si inconnu)" - stop_id: "id arrêt" - stop_name: "nom arrêt" - b_true: "Oui" - b_false: "Non" - tt_columns: "code;nom;étiquettes;début;fin;types de jour;périodes;jours particuliers;jours exclus" - monday: "Lu" - tuesday: "Ma" - wednesday: "Me" - thursday: "Je" - friday: "Ve" - saturday: "Sa" - sunday: "Di" - vj_filename: "courses_" - tt_filename: "calendriers" + ftn_filename: "notes" diff --git a/config/locales/vehicle_journey_exports.fr.yml b/config/locales/vehicle_journey_exports.fr.yml new file mode 100644 index 000000000..15eca70f3 --- /dev/null +++ b/config/locales/vehicle_journey_exports.fr.yml @@ -0,0 +1,30 @@ +fr: + vehicle_journey_exports: + new: + title: "Exporter les horaires existants" + basename: "courses" + label: + vehicle_journey_id: "id course (vide si nouvelle)" + number: "numéro" + time_table_ids: "calendriers" + flexible_service: "TAD (O(ui)|N(on)|vide si inconnu)" + published_journey_name: "nom public" + mobility: "PMR (O(ui)|N(on)|vide si inconnu)" + footnotes_ids: "notes de bas de page" + stop_id: "id arrêt" + stop_name: "nom arrêt" + b_true: "Oui" + b_false: "Non" + tt_columns: "code;nom;étiquettes;début;fin;types de jour;périodes;jours particuliers;jours exclus" + monday: "Lu" + tuesday: "Ma" + wednesday: "Me" + thursday: "Je" + friday: "Ve" + saturday: "Sa" + sunday: "Di" + ftn_columns: "clé;numéro;ligne de texte" + vj_filename: "courses_" + tt_filename: "calendriers" + ftn_filename: "notes" + diff --git a/config/locales/vehicle_journeys.yml b/config/locales/vehicle_journeys.yml index ba60fee9b..9b872b222 100644 --- a/config/locales/vehicle_journeys.yml +++ b/config/locales/vehicle_journeys.yml @@ -90,6 +90,7 @@ en: object_version: "Version" creation_time: "Created on" creator_id: "Created by" + footnote_ids: "Footnotes" errors: models: vehicle_journey: @@ -98,6 +99,18 @@ en: titles: vehicle_journey: objectid: "[prefix]:VehicleJourney:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character" + neptune: + vehicle_journey: + objectid: "[prefix]:VehicleJourney:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character" + netex: + vehicle_journey: + objectid: "[prefix]:VehicleJourney:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character" + gtfs: + vehicle_journey: + objectid: "[prefix]:VehicleJourney:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character" + hub: + vehicle_journey: + objectid: "[prefix]:VehicleJourney:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character. Maximum length of the unique key = 8." fr: vehicle_journeys: @@ -191,6 +204,7 @@ fr: object_version: "Version" creation_time: "Créé le" creator_id: "Créé par" + footnote_ids: "Notes de bas de page" errors: models: vehicle_journey: @@ -199,4 +213,16 @@ fr: titles: vehicle_journey: objectid: "[prefixe]:VehicleJourney:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'" + neptune: + vehicle_journey: + objectid: "[prefixe]:VehicleJourney:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'" + netex: + vehicle_journey: + objectid: "[prefixe]:VehicleJourney:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'" + gtfs: + vehicle_journey: + objectid: "[prefixe]:VehicleJourney:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'" + hub: + vehicle_journey: + objectid: "[prefixe]:VehicleJourney:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'. Longueur maximale de la clé unique = 8." diff --git a/config/routes.rb b/config/routes.rb index 82dd4248f..88975b6e5 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -37,6 +37,7 @@ ChouetteIhm::Application.routes.draw do resource :organisation, :only => [:show, :edit, :update] do resources :users + resources :rule_parameter_sets end resources :referentials do @@ -46,25 +47,23 @@ ChouetteIhm::Application.routes.draw do resources :autocomplete_time_tables resources :group_of_lines do collection do - get :name_filter + get 'name_filter' end end - + + resources :networks + + match 'lines' => 'lines#destroy_all', :via => :delete resources :lines do delete :index, on: :collection, action: :delete_all collection do - get :name_filter + get 'name_filter' end resources :routes do member do get 'edit_boarding_alighting' put 'save_boarding_alighting' end - end - end - - resources :lines, :networks, :group_of_lines do - resources :routes do resources :journey_patterns do member do get 'new_vehicle_journey' diff --git a/db/migrate/20120823053740_create_organisation.rb b/db/migrate/20120823053740_create_organisation.rb index 202dba082..3419df4db 100644 --- a/db/migrate/20120823053740_create_organisation.rb +++ b/db/migrate/20120823053740_create_organisation.rb @@ -10,12 +10,13 @@ class CreateOrganisation < ActiveRecord::Migration change_table :users do |u| u.belongs_to :organisation end - Referential.reset_column_information - User.reset_column_information - organisation = Organisation.first_or_create(:name => "Chouette") - Referential.update_all :organisation_id => organisation.id - User.update_all :organisation_id => organisation.id + # Referential.reset_column_information + # User.reset_column_information + + # organisation = Organisation.first_or_create(:name => "Chouette") + # Referential.update_all :organisation_id => organisation.id + # User.update_all :organisation_id => organisation.id end def down diff --git a/db/migrate/20140107084816_insert_rule_parameter_sets.rb b/db/migrate/20140107084816_insert_rule_parameter_sets.rb deleted file mode 100644 index fd951c765..000000000 --- a/db/migrate/20140107084816_insert_rule_parameter_sets.rb +++ /dev/null @@ -1,10 +0,0 @@ -class InsertRuleParameterSets < ActiveRecord::Migration - def up - Referential.all.each do |referential| - RuleParameterSet.default_for_all_modes( referential).save if referential.rule_parameter_sets.empty? - end - end - - def down - end -end diff --git a/db/migrate/20150218175300_set_organisation_id_to_rps.rb b/db/migrate/20150218175300_set_organisation_id_to_rps.rb index f7028449d..06180988c 100644 --- a/db/migrate/20150218175300_set_organisation_id_to_rps.rb +++ b/db/migrate/20150218175300_set_organisation_id_to_rps.rb @@ -1,19 +1,19 @@ class SetOrganisationIdToRps < ActiveRecord::Migration - #class RuleParameterSet < ActiveRecord::Base - #attr_accessor :referential_id - #attr_accessor :organisation_id - #attr_accessor :name - #end - #def up - #RuleParameterSet.all.each_with_index do |rps, index| - # rps.update_attributes :organisation_id => Referential.find( rps.referential_id).organisation_id, - # :name => "#{rps.name} #{index}" - #end - #end + # class RuleParameterSet < ActiveRecord::Base + # attr_accessor :referential_id + # attr_accessor :organisation_id + # attr_accessor :name + # end + # def up + # RuleParameterSet.all.each_with_index do |rps, index| + # rps.update_attributes :organisation_id => Referential.find( rps.referential_id).organisation_id, + # :name => "{rps.name} {index}" + # end + # end - #def down - #RuleParameterSet.all.each_with_index do |rps, index| - # rps.update_attributes :organisation_id => nil - #end - #end + # def down + # RuleParameterSet.all.each_with_index do |rps, index| + # rps.update_attributes :organisation_id => nil + # end + # end end diff --git a/db/schema.rb b/db/schema.rb index b7feb13be..4bb4654cc 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,11 @@ # # It's strongly recommended that you check this file into your version control system. +<<<<<<< HEAD ActiveRecord::Schema.define(version: 20150304090743) do +======= +ActiveRecord::Schema.define(:version => 20150219205300) do +>>>>>>> V2_5 # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -195,6 +199,7 @@ ActiveRecord::Schema.define(version: 20150304090743) do t.integer "choice_code" end +<<<<<<< HEAD create_table "footnotes", force: true do |t| t.integer "line_id", limit: 8 t.string "code" @@ -210,6 +215,23 @@ ActiveRecord::Schema.define(version: 20150304090743) do create_table "group_of_lines", force: true do |t| t.string "objectid", null: false +======= + create_table "footnotes", :force => true do |t| + t.integer "line_id", :limit => 8 + t.string "code" + t.string "label" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "footnotes_vehicle_journeys", :id => false, :force => true do |t| + t.integer "vehicle_journey_id", :limit => 8 + t.integer "footnote_id", :limit => 8 + end + + create_table "group_of_lines", :force => true do |t| + t.string "objectid", :null => false +>>>>>>> V2_5 t.integer "object_version" t.datetime "creation_time" t.string "creator_id" @@ -323,9 +345,15 @@ ActiveRecord::Schema.define(version: 20150304090743) do create_table "organisations", force: true do |t| t.string "name" +<<<<<<< HEAD t.datetime "created_at", null: false t.datetime "updated_at", null: false t.string "data_format" +======= + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.boolean "hub_restrictions_by_default" +>>>>>>> V2_5 end create_table "pt_links", force: true do |t| @@ -356,7 +384,11 @@ ActiveRecord::Schema.define(version: 20150304090743) do t.text "geographical_bounds" t.integer "user_id", limit: 8 t.string "user_name" +<<<<<<< HEAD t.string "data_format" +======= + t.boolean "hub_restrictions" +>>>>>>> V2_5 end create_table "routes", force: true do |t| @@ -381,12 +413,21 @@ ActiveRecord::Schema.define(version: 20150304090743) do t.integer "line_id", limit: 8 end +<<<<<<< HEAD create_table "rule_parameter_sets", force: true do |t| t.text "parameters" t.string "name" t.datetime "created_at", null: false t.datetime "updated_at", null: false t.integer "organisation_id", limit: 8 +======= + create_table "rule_parameter_sets", :force => true do |t| + t.text "parameters" + t.string "name" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "organisation_id", :limit => 8 +>>>>>>> V2_5 end create_table "stop_areas", force: true do |t| diff --git a/lib/ninoxe_extension/hub/company_restrictions.rb b/lib/ninoxe_extension/hub/company_restrictions.rb new file mode 100644 index 000000000..780e0e4d9 --- /dev/null +++ b/lib/ninoxe_extension/hub/company_restrictions.rb @@ -0,0 +1,20 @@ +module NinoxeExtension::Hub + module CompanyRestrictions + extend ActiveSupport::Concern + + included do + include ObjectidRestrictions + + with_options if: :hub_restricted? do |g| + # HUB-7 + g.validates_format_of :objectid, :with => %r{^\w+:\w+:[\w]{1,3}$} + # HUB-8 + g.validates_format_of :name, :with => %r{^[\w]{1,75}$} + # HUB-9 + g.validates_format_of :registration_number, :with => %r{^[\d]{1,8}$} + g.validates_uniqueness_of :registration_number + end + end + end +end + diff --git a/lib/ninoxe_extension/hub/connection_link_restrictions.rb b/lib/ninoxe_extension/hub/connection_link_restrictions.rb new file mode 100644 index 000000000..bf433379b --- /dev/null +++ b/lib/ninoxe_extension/hub/connection_link_restrictions.rb @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +module NinoxeExtension::Hub + module ConnectionLinkRestrictions + extend ActiveSupport::Concern + + included do + include ObjectidRestrictions + + with_options if: :hub_restricted? do |jp| + # HUB-34 + jp.validates :link_distance, :numericality => { :max => 10000.0 } + end + end + end +end + diff --git a/lib/ninoxe_extension/hub/group_of_line_restrictions.rb b/lib/ninoxe_extension/hub/group_of_line_restrictions.rb new file mode 100644 index 000000000..13688376f --- /dev/null +++ b/lib/ninoxe_extension/hub/group_of_line_restrictions.rb @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +module NinoxeExtension::Hub + module GroupOfLineRestrictions + extend ActiveSupport::Concern + + included do + include ObjectidRestrictions + + with_options if: :hub_restricted? do |g| + # HUB-11 + g.validates_format_of :objectid, :with => %r{^\w+:\w+:[\w]{1,6}$} + # HUB-12 + g.validates_format_of :name, :with => %r{^[\w]{1,75}$} + # HUB-13 + g.validates_format_of :registration_number, :with => %r{^[\d]{1,8}$} + g.validates_uniqueness_of :registration_number + end + end + end +end + diff --git a/lib/ninoxe_extension/hub/journey_pattern_restrictions.rb b/lib/ninoxe_extension/hub/journey_pattern_restrictions.rb new file mode 100644 index 000000000..2726c563a --- /dev/null +++ b/lib/ninoxe_extension/hub/journey_pattern_restrictions.rb @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +module NinoxeExtension::Hub + module JourneyPatternRestrictions + extend ActiveSupport::Concern + + included do + include ObjectidRestrictions + + with_options if: :hub_restricted? do |jp| + # HUB-39 + jp.validates_format_of :objectid, :with => %r{^\w+:\w+:[\w]{1,30}$} + # HUB-40 + jp.validates :registration_number, :numericality => { :less_than => 10 ** 8 } + # HUB-41 + jp.validates_format_of :name, :with => %r{^[\w]{0,75}$} + end + end + end +end + diff --git a/lib/ninoxe_extension/hub/line_restrictions.rb b/lib/ninoxe_extension/hub/line_restrictions.rb new file mode 100644 index 000000000..119ab07b6 --- /dev/null +++ b/lib/ninoxe_extension/hub/line_restrictions.rb @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +module NinoxeExtension::Hub + module LineRestrictions + extend ActiveSupport::Concern + + + included do + include ObjectidRestrictions + + with_options if: :hub_restricted? do |l| + # HUB-15 + l.validates_format_of :objectid, :with => %r{^\w+:\w+:[\w]{1,14}$} + # HUB-16 + l.validates_format_of :number, :with => %r{^[\w]{1,6}$} + # HUB-17 + l.validates_format_of :name, :with => %r{^[\w]{0,75}$} + # HUB-21 + l.validates :registration_number, :numericality => { :less_than => 10 ** 8 } + # HUB-22 + l.validates_uniqueness_of :name, :allow_blank => true + end + end + end +end + diff --git a/lib/ninoxe_extension/hub/network_restrictions.rb b/lib/ninoxe_extension/hub/network_restrictions.rb new file mode 100644 index 000000000..b2e8d4be5 --- /dev/null +++ b/lib/ninoxe_extension/hub/network_restrictions.rb @@ -0,0 +1,20 @@ +module NinoxeExtension::Hub + module NetworkRestrictions + extend ActiveSupport::Concern + + included do + include ObjectidRestrictions + + with_options if: :hub_restricted? do |g| + # HUB-3 + g.validates_format_of :objectid, :with => %r{^\w+:\w+:[\w]{1,3}$} + # HUB-4 + g.validates_format_of :name, :with => %r{^[\w]{1,75}$} + # HUB-5 + g.validates_format_of :registration_number, :with => %r{^[\d]{1,8}$} + g.validates_uniqueness_of :registration_number + end + end + end +end + diff --git a/lib/ninoxe_extension/hub/objectid_restrictions.rb b/lib/ninoxe_extension/hub/objectid_restrictions.rb new file mode 100644 index 000000000..675994359 --- /dev/null +++ b/lib/ninoxe_extension/hub/objectid_restrictions.rb @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +module NinoxeExtension::Hub::ObjectidRestrictions + extend ActiveSupport::Concern + + included do + # HUB 1 + validate :third_part_objectid_uniqueness + + def third_part_objectid + self.objectid.match(/:(\w+)$/)[1] + end + def third_part_objectid_uniqueness + return unless hub_restricted? + + return true unless third_part_objectid + likes = Chouette::Line.where( "objectid LIKE ?", "%:#{self.third_part_objectid}" ) + likes.size.zero? || ( likes.size==1 && likes.first.id==self.id) + end + + end +end + diff --git a/lib/ninoxe_extension/hub/route_restrictions.rb b/lib/ninoxe_extension/hub/route_restrictions.rb new file mode 100644 index 000000000..a5f4c8019 --- /dev/null +++ b/lib/ninoxe_extension/hub/route_restrictions.rb @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +module NinoxeExtension::Hub + module RouteRestrictions + extend ActiveSupport::Concern + + included do + include ObjectidRestrictions + validate :max_instance_limitation, :wayback_code_limitation + + # HUB-37 + def wayback_code_limitation + return unless hub_restricted? + errors.add( :wayback_code, I18n.t('hub.routes.wayback_code_exclusive')) if line.routes.reject {|r| r.id==id}.map(&:wayback_code).include?( wayback_code) + end + + # HUB-37 + def max_instance_limitation + return unless hub_restricted? + errors.add( :flash, I18n.t('hub.routes.max_by_line')) + end + + # HUB-38 + with_options if: :hub_restricted? do |route| + route.validates_format_of :objectid, :with => %r{^\w+:\w+:[\w]{1,8}$} + end + end + end +end + diff --git a/lib/ninoxe_extension/hub/stop_area_restrictions.rb b/lib/ninoxe_extension/hub/stop_area_restrictions.rb new file mode 100644 index 000000000..f09510cc4 --- /dev/null +++ b/lib/ninoxe_extension/hub/stop_area_restrictions.rb @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +module NinoxeExtension::Hub + module StopAreaRestrictions + extend ActiveSupport::Concern + + included do + #include ObjectidRestrictions + def physical? + self.area_type=="BoardingPosition" || self.area_type=="Quay" + end + def commercial? + self.area_type=="CommercialStopPoint" + end + def self.physical_hub_restricted? + Proc.new { |s| s.hub_restricted? && s.commercial?} + end + def self.commercial_hub_restricted? + Proc.new { |s| s.hub_restricted? && s.physical?} + end + def self.commercial_and_physical_hub_restricted? + physical_hub_restricted? || commercial_hub_restricted? + end + + + with_options if: commercial_and_physical_hub_restricted? do |sa| + # HUB-23 + sa.validates_format_of :objectid, :with => %r{^\w+:\w+:[\w]{1,12}$} + sa.validates_format_of :name, :with => %r{^[\w]{1,75}$} + end + with_options if: commercial_hub_restricted? do |sa| + # HUB-24 + validates_format_of :nearest_topic_name, :with => %r{^[\w]{0,255}$} + end + + with_options if: physical_hub_restricted? do |sa| + # HUB-25 + sa.validates_format_of :nearest_topic_name, :with => %r{^[\w]{0,60}$} + # HUB-28 + sa.validates_presence_of :longitude + sa.validates_presence_of :latitude + # HUB-29 + sa.validates_format_of :city_name, :with => %r{^[\w]{1,80}$} + # HUB-30 + sa.validates_format_of :zip_code, :with => %r{^[\d]{5}$} + # HUB-31 + sa.validates_format_of :comment, :with => %r{^[\w]{0,255}$} + # HUB-32 + sa.validates_format_of :registration_number, :with => %r{^[\w]{1,8}$}, :allow_blank => true, :allow_nil => true + end + end + end +end + diff --git a/lib/ninoxe_extension/hub/time_table_restrictions.rb b/lib/ninoxe_extension/hub/time_table_restrictions.rb new file mode 100644 index 000000000..6f2984dda --- /dev/null +++ b/lib/ninoxe_extension/hub/time_table_restrictions.rb @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +module NinoxeExtension::Hub + module TimeTableRestrictions + extend ActiveSupport::Concern + + included do + include ObjectidRestrictions + + with_options if: :hub_restricted? do |jp| + # HUB-44 + jp.validates_format_of :objectid, :with => %r{^\w+:\w+:[\w]{1,6}$} + # HUB-45 + jp.validates_format_of :comment, :with => %r{^[\w]{0,75}$} + end + end + end +end + diff --git a/lib/ninoxe_extension/hub/vehicle_journey_restrictions.rb b/lib/ninoxe_extension/hub/vehicle_journey_restrictions.rb new file mode 100644 index 000000000..81a023dca --- /dev/null +++ b/lib/ninoxe_extension/hub/vehicle_journey_restrictions.rb @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +module NinoxeExtension::Hub + module VehicleJourneyRestrictions + extend ActiveSupport::Concern + + included do + include ObjectidRestrictions + + # HUB-42 + with_options if: :hub_restricted? do |jp| + jp.validates_format_of :objectid, :with => %r{^\w+:\w+:[\w]{1,8}$} + end + end + end +end + diff --git a/lib/tasks/stats.rake b/lib/tasks/stats.rake index 4907bb4eb..4f2739664 100644 --- a/lib/tasks/stats.rake +++ b/lib/tasks/stats.rake @@ -19,6 +19,9 @@ namespace :stats do 1.upto(12) do |i| stats << class_for_stat.all.select {|o| o.created_at.month==i && o.created_at.year==2014}.count end + 1.upto(12) do |i| + stats << class_for_stat.all.select {|o| o.created_at.month==i && o.created_at.year==2015}.count + end s.puts stats.join(",") end end diff --git a/spec/controllers/rule_parameter_sets_controller_spec.rb b/spec/controllers/rule_parameter_sets_controller_spec.rb index 8615183c1..b2cdd0849 100644 --- a/spec/controllers/rule_parameter_sets_controller_spec.rb +++ b/spec/controllers/rule_parameter_sets_controller_spec.rb @@ -4,31 +4,33 @@ describe RuleParameterSetsController, :type => :controller do login_user let(:mode){"air"} - shared_examples_for "referential dependant" do - it "assigns referential as @referential" do - expect(assigns[:referential]).to eq(referential) + shared_examples_for "organisation dependant" do + it "assigns rule_parameter_set.organisation as current organisation" do + expect(assigns[:organisation]).to eq(organisation) end end describe "GET /index" do before(:each) do - get :index, - :referential_id => referential.id + get :index + end + it "should assign rule_parameter_sets to organisation rule_parameter_sets" do + assigns[:rule_parameter_sets].size.should == organisation.rule_parameter_sets.size + assigns[:rule_parameter_sets].each do |rps| + rps.organisation_id.should == organisation.id + end end - it_behaves_like "referential dependant" end describe "GET /new" do before(:each) do - get :new, - :referential_id => referential.id + get :new end - it_behaves_like "referential dependant" + it_behaves_like "organisation dependant" it "should assign rule_parameter_set with default params" do RuleParameterSet.default_params.each do |k,v| expect(assigns[:rule_parameter_set].send( k )).to eq(v) end - expect(assigns[:rule_parameter_set].referential_id).to eq(referential.id) end end end diff --git a/spec/factories.rb b/spec/factories.rb index 645807b28..64beb806a 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -70,6 +70,6 @@ FactoryGirl.define do referential { Referential.find_by_slug("first") } end - factory :time_table_combination + factory :time_table_combination end diff --git a/spec/features/vehicle_journey_imports_spec.rb b/spec/features/vehicle_journey_imports_spec.rb index 9ba38398c..f18d9baf0 100644 --- a/spec/features/vehicle_journey_imports_spec.rb +++ b/spec/features/vehicle_journey_imports_spec.rb @@ -30,10 +30,10 @@ describe "VehicleJourneyImports", :type => :feature do row2 << cell end csv << row2 - elsif counter < 7 + elsif counter < 8 csv << row else - csv << ( row[0] = route.stop_points[counter - 7].id; row) + csv << ( row[0] = route.stop_points[counter - 8].id; row) end counter += 1 end diff --git a/spec/fixtures/vehicle_journey_imports_valid.csv b/spec/fixtures/vehicle_journey_imports_valid.csv index 3126ffe2b..85a505ab6 100644 --- a/spec/fixtures/vehicle_journey_imports_valid.csv +++ b/spec/fixtures/vehicle_journey_imports_valid.csv @@ -4,6 +4,7 @@ ;PMR (O(ui)|N(on)|vide si inconnu);Oui;;; ;TAD (O(ui)|N(on)|vide si inconnu);Oui;;; ;calendriers;;;; +;notes de bas de page;;;; id arrêt;nom arrêt;;;; 1;Arrêt 1;9:00:00;;11:10:00;12:10:00 2;Arrêt 2;9:05:00;10:05:00;11:15:00;12:15:00 diff --git a/spec/fixtures/vehicle_journey_imports_with_vj_invalid.csv b/spec/fixtures/vehicle_journey_imports_with_vj_invalid.csv index 7aa59009e..beec85c4c 100644 --- a/spec/fixtures/vehicle_journey_imports_with_vj_invalid.csv +++ b/spec/fixtures/vehicle_journey_imports_with_vj_invalid.csv @@ -4,6 +4,7 @@ ;PMR (O(ui)|N(on)|vide si inconnu);Oui;; ;TAD (O(ui)|N(on)|vide si inconnu);Oui;; ;calendriers;;; +;notes de bas de page;;; id arrêt;nom arrêt;;; 1;Arrêt 1;9:00:00;10:05:00;11:10:00 2;Arrêt 2;11:05:00;;11:15:00 diff --git a/spec/fixtures/vehicle_journey_imports_with_vjas_bad_order.csv b/spec/fixtures/vehicle_journey_imports_with_vjas_bad_order.csv index df6b1acff..c1bb85881 100644 --- a/spec/fixtures/vehicle_journey_imports_with_vjas_bad_order.csv +++ b/spec/fixtures/vehicle_journey_imports_with_vjas_bad_order.csv @@ -4,6 +4,7 @@ ;PMR (O(ui)|N(on)|vide si inconnu);Oui;; ;TAD (O(ui)|N(on)|vide si inconnu);Oui;; ;calendriers;;; +;notes de bas de page;;; id arrêt;nom arrêt;;; 1;Arrêt 1;9:05:00;10:05:00;11:10:00 2;Arrêt 2;11:05:00;;11:15:00 diff --git a/spec/fixtures/vehicle_journey_imports_with_vjas_invalid.csv b/spec/fixtures/vehicle_journey_imports_with_vjas_invalid.csv index bcb07a177..95799e9d9 100644 --- a/spec/fixtures/vehicle_journey_imports_with_vjas_invalid.csv +++ b/spec/fixtures/vehicle_journey_imports_with_vjas_invalid.csv @@ -4,6 +4,7 @@ ;PMR (O(ui)|N(on)|vide si inconnu);Oui;; ;TAD (O(ui)|N(on)|vide si inconnu);Oui;; ;calendriers;;;; +;notes de bas de page;;;; id arrêt;nom arrêt;;; 1;Arrêt 1;invalid time;10:05:00;11:10:00 2;Arrêt 2;9:05:00;;11:15:00 diff --git a/spec/models/line_spec.rb b/spec/models/line_spec.rb new file mode 100644 index 000000000..191101109 --- /dev/null +++ b/spec/models/line_spec.rb @@ -0,0 +1,58 @@ +require 'spec_helper' + +describe "sdflkjskdjf" do + + subject { Factory(:line) } + + def set_large_object_id( line) + line.update_attributes :objectid => "AA:Line:123456789012345" + end + + describe "validation objectid unique constraint" do + let(:referential){subject.referential} + let(:objectid_a){ "A:Line:1234" } + let(:objectid_b){ "B:Line:1234" } + let!(:second_line){ Factory( :line, :objectid => objectid_a, :registration_number => "123456") } + context "when referential works with HUB" do + before( :each) do + referential.update_attributes :data_format => "hub" + subject.update_attributes :objectid => objectid_a + end + it "should have objectid with a third part shorter than 14 char" do + subject.update_attributes :objectid => objectid_b + subject.should_not be_valid + end + end + context "when referential doesn't works with HUB" do + before( :each) do + referential.update_attributes :data_format => "hub" + end + #it "should have objectid with a third part shorter than 14 char" do + # subject.update_attributes :objectid => objectid_b, :registration_number => '324' + # subject.should be_valid + #end + end + end + describe "validation objectid size" do + let(:referential){subject.referential} + context "when referential works with HUB" do + before( :each) do + referential.update_attributes :data_format => "hub" + end + it "should have objectid with a third part shorter than 14 char" do + set_large_object_id( subject) + subject.should_not be_valid + end + end + context "when referential doesn't works with HUB" do + before( :each) do + referential.update_attributes :data_format => "hub" + end + #it "should have objectid with a third part shorter than 14 char" do + # set_large_object_id( subject) + # subject.should be_valid + #end + end + end +end + diff --git a/spec/models/organisation_spec.rb b/spec/models/organisation_spec.rb new file mode 100644 index 000000000..ffac3374b --- /dev/null +++ b/spec/models/organisation_spec.rb @@ -0,0 +1,12 @@ +require 'spec_helper' + +describe Organisation do + + it { should validate_presence_of(:name) } + it { should validate_uniqueness_of(:name) } + + it "create a rule_parameter_set" do + organisation = Factory.create(:organisation) + organisation.rule_parameter_sets.size.should == 1 + end +end diff --git a/spec/models/stop_area_copy_spec.rb b/spec/models/stop_area_copy_spec.rb index ad5bc41d8..ca532dcf7 100644 --- a/spec/models/stop_area_copy_spec.rb +++ b/spec/models/stop_area_copy_spec.rb @@ -8,18 +8,21 @@ describe StopAreaCopy, :type => :model do describe ".save" do it "should create a child for source" do - source = Chouette::StopArea.new( :area_type => "CommercialStopPoint", :name => "test1" ) + source = Factory(:stop_area, :area_type => "CommercialStopPoint", :name => "test1", + :registration_number => "123456", :city_name => "dummy", :zip_code => "12345") source.save subject.source_id = source.id subject.hierarchy = "child" subject.area_type = "Quay" subject.save + source.reload expect(source.children.length).to eq(1) expect(source.children[0].name).to eq("test1") end it "should create a parent for source" do - source = Chouette::StopArea.new( :area_type => "CommercialStopPoint", :name => "test2" ) + source = Factory(:stop_area, :area_type => "CommercialStopPoint", :name => "test2", + :registration_number => "123456", :city_name => "dummy", :zip_code => "12345") source.save subject.source_id = source.id subject.hierarchy = "parent" @@ -29,7 +32,7 @@ describe StopAreaCopy, :type => :model do expect(source.parent).not_to be_nil expect(source.parent.name).to eq('test2') end - + end end diff --git a/spec/models/vehicle_journey_export_spec.rb b/spec/models/vehicle_journey_export_spec.rb index 49c3d2fc6..6252a73f9 100644 --- a/spec/models/vehicle_journey_export_spec.rb +++ b/spec/models/vehicle_journey_export_spec.rb @@ -3,8 +3,9 @@ require 'spec_helper' describe VehicleJourneyExport, :type => :model do - let!(:route) { create(:route) } - let!(:other_route) { create(:route) } + let!(:line) { create(:line) } + let!(:route) { create(:route, :line => line) } + let!(:other_route) { create(:route, :line => line) } let!(:journey_pattern) { create(:journey_pattern, :route => route) } let!(:other_journey_pattern) { create(:journey_pattern_even, :route => route) } diff --git a/spec/models/vehicle_journey_import_spec.rb b/spec/models/vehicle_journey_import_spec.rb index 9d9a8e15e..c4d452f84 100644 --- a/spec/models/vehicle_journey_import_spec.rb +++ b/spec/models/vehicle_journey_import_spec.rb @@ -17,10 +17,10 @@ describe VehicleJourneyImport, :type => :model do row2 << cell end csv << row2 - elsif counter < 7 + elsif counter < 8 csv << row else - csv << ( row[0] = route.stop_points[counter - 7].id; row) + csv << ( row[0] = route.stop_points[counter - 8].id; row) end counter += 1 end diff --git a/spec/routing/companies_spec.rb b/spec/routing/companies_spec.rb new file mode 100644 index 000000000..25f86325b --- /dev/null +++ b/spec/routing/companies_spec.rb @@ -0,0 +1,25 @@ +require 'spec_helper' + +describe CompaniesController do + describe "routing" do + it "not recognize #routes" do + get( "/referentials/1/companies/2/routes").should_not route_to( + :controller => "companies", :action => "routes", + :referential_id => "1", :id => "2" + ) + end + it "not recognize #lines" do + get( "/referentials/1/companies/2/lines").should_not route_to( + :controller => "companies", :action => "lines", + :referential_id => "1", :id => "2" + ) + end + it "recognize and generate #show" do + get( "/referentials/1/companies/2").should route_to( + :controller => "companies", :action => "show", + :referential_id => "1", :id => "2" + ) + end + end +end + diff --git a/spec/routing/group_of_lines_spec.rb b/spec/routing/group_of_lines_spec.rb new file mode 100644 index 000000000..ee5596cf7 --- /dev/null +++ b/spec/routing/group_of_lines_spec.rb @@ -0,0 +1,25 @@ +require 'spec_helper' + +describe GroupOfLinesController do + describe "routing" do + it "not recognize #routes" do + get( "/referentials/1/group_of_lines/2/routes").should_not route_to( + :controller => "group_of_lines", :action => "routes", + :referential_id => "1", :id => "2" + ) + end + it "not recognize #lines" do + get( "/referentials/1/group_of_lines/2/lines").should_not route_to( + :controller => "group_of_lines", :action => "lines", + :referential_id => "1", :id => "2" + ) + end + it "recognize and generate #show" do + get( "/referentials/1/group_of_lines/2").should route_to( + :controller => "group_of_lines", :action => "show", + :referential_id => "1", :id => "2" + ) + end + end +end + diff --git a/spec/routing/networks_spec.rb b/spec/routing/networks_spec.rb new file mode 100644 index 000000000..c0544980d --- /dev/null +++ b/spec/routing/networks_spec.rb @@ -0,0 +1,25 @@ +require 'spec_helper' + +describe NetworksController do + describe "routing" do + it "not recognize #routes" do + get( "/referentials/1/networks/2/routes").should_not route_to( + :controller => "networks", :action => "routes", + :referential_id => "1", :id => "2" + ) + end + it "not recognize #lines" do + get( "/referentials/1/networks/2/lines").should_not route_to( + :controller => "networks", :action => "lines", + :referential_id => "1", :id => "2" + ) + end + it "recognize and generate #show" do + get( "/referentials/1/networks/2").should route_to( + :controller => "networks", :action => "show", + :referential_id => "1", :id => "2" + ) + end + end +end + diff --git a/spec/routing/time_tables_spec.rb b/spec/routing/time_tables_spec.rb new file mode 100644 index 000000000..45e426f4c --- /dev/null +++ b/spec/routing/time_tables_spec.rb @@ -0,0 +1,31 @@ +require 'spec_helper' + +describe TimeTablesController do + describe "routing" do + it "not recognize #routes" do + get( "/referentials/1/time_tables/2/routes").should_not route_to( + :controller => "time_tables", :action => "routes", + :referential_id => "1", :id => "2" + ) + end + it "not recognize #lines" do + get( "/referentials/1/time_tables/2/lines").should_not route_to( + :controller => "time_tables", :action => "lines", + :referential_id => "1", :id => "2" + ) + end + it "not recognize #time_table_periods" do + get( "/referentials/1/time_tables/2/time_table_periods").should_not route_to( + "time_table_periods#index", + :referential_id => "1", :time_table_id => "2" + ) + end + it "recognize and generate #show" do + get( "/referentials/1/time_tables/2").should route_to( + :controller => "time_tables", :action => "show", + :referential_id => "1", :id => "2" + ) + end + end +end + diff --git a/spec/support/referential.rb b/spec/support/referential.rb index b2a8cf279..d77a05f41 100644 --- a/spec/support/referential.rb +++ b/spec/support/referential.rb @@ -12,12 +12,18 @@ module ReferentialHelper end module ClassMethods - + def assign_referential before(:each) do assign :referential, referential end end + def assign_organisation + before(:each) do + assign :organisation, referential.organisation + end + end + end diff --git a/spec/views/routes/show.html.erb_spec.rb b/spec/views/routes/show.html.erb_spec.rb index 090624fbf..1984a0d25 100644 --- a/spec/views/routes/show.html.erb_spec.rb +++ b/spec/views/routes/show.html.erb_spec.rb @@ -5,7 +5,6 @@ describe "/routes/show", :type => :view do 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 } let!(:map) { assign(:map, double(:to_html => '<div id="map"/>'.html_safe)) } it "should render h2 with the route name" do diff --git a/spec/views/rule_parameter_sets/index.html.erb_spec.rb b/spec/views/rule_parameter_sets/index.html.erb_spec.rb index a2ed45665..9e00c3332 100644 --- a/spec/views/rule_parameter_sets/index.html.erb_spec.rb +++ b/spec/views/rule_parameter_sets/index.html.erb_spec.rb @@ -1,21 +1,21 @@ require 'spec_helper' -describe "/rule_parameter_sets/index", :type => :view do +describe "/organisations/show" do - assign_referential - let!(:rule_parameter_sets) { assign :rule_parameter_sets, [ create(:rule_parameter_set), - create(:rule_parameter_set)] } + assign_organisation + + let!(:rule_parameter_sets) { assign :rule_parameter_sets, [ Factory(:rule_parameter_set, :organisation => organisation), it "should render a show link for each rule_parameter_set" do render rule_parameter_sets.each do |rule_parameter_set| - expect(rendered).to have_selector(".rule_parameter_set a[href='#{view.referential_rule_parameter_set_path(referential, rule_parameter_set)}']", :text => rule_parameter_set.name) + rendered.should have_selector(".rule_parameter_sets a[href='#{view.organisation_rule_parameter_set_path( rule_parameter_set)}']", :text => rule_parameter_set.name) end end it "should render a link to create a new rule_parameter_set" do render - expect(view.content_for(:sidebar)).to have_selector(".actions a[href='#{new_referential_rule_parameter_set_path(referential)}']") + view.content_for(:sidebar).should have_selector(".actions a[href='#{new_organisation_rule_parameter_set_path}']") end end diff --git a/spec/views/rule_parameter_sets/new.html.erb_spec.rb b/spec/views/rule_parameter_sets/new.html.erb_spec.rb index eed25b8f6..a0188686a 100644 --- a/spec/views/rule_parameter_sets/new.html.erb_spec.rb +++ b/spec/views/rule_parameter_sets/new.html.erb_spec.rb @@ -2,8 +2,8 @@ require 'spec_helper' describe "/rule_parameter_sets/new", :type => :view do - assign_referential - let!(:rule_parameter_set) { assign :rule_parameter_set, build( :rule_parameter_set, :referential => referential) } + assign_organisation + let!(:rule_parameter_set) { assign :rule_parameter_set, build( :rule_parameter_set, :organisation => organisation) } describe "form" do |
