diff options
| author | Luc Donnet | 2014-08-22 12:48:35 +0200 |
|---|---|---|
| committer | Luc Donnet | 2014-08-22 12:48:35 +0200 |
| commit | 71ce5bca071ad06e22feaab08e32c70336e11958 (patch) | |
| tree | a667badd46b3129f4601635f33329ab9e4020a27 | |
| parent | 330501d4ad75d97d9c649880f1a932b3e5fa2077 (diff) | |
| parent | b827bc2007a820341314da284a83a431803a573f (diff) | |
| download | chouette-core-71ce5bca071ad06e22feaab08e32c70336e11958.tar.bz2 | |
Merge branch 'sismo' of github.com:afimb/chouette2 into sismo
54 files changed, 315 insertions, 173 deletions
diff --git a/app/controllers/time_table_combinations_controller.rb b/app/controllers/time_table_combinations_controller.rb index baaf90fec..32a3dcab9 100644 --- a/app/controllers/time_table_combinations_controller.rb +++ b/app/controllers/time_table_combinations_controller.rb @@ -1,24 +1,39 @@ class TimeTableCombinationsController < ChouetteController - respond_to :js, :only => [:create] + respond_to :js, :only => [:new,:create] belongs_to :referential do belongs_to :time_table, :parent_class => Chouette::TimeTable end + after_filter :clean_flash + + def clean_flash + # only run this in case it's an Ajax request. + return unless request.xhr? + flash.discard + end + + def new + @time_table_combination = TimeTableCombination.new(:source_id => parent.id) + render :action => :new + end + def create @time_table_combination = TimeTableCombination.new( params[:time_table_combination].merge( :source_id => parent.id)) - #@time_table = parent @year = params[:year] ? params[:year].to_i : Date.today.cwyear if @time_table_combination.valid? begin @time_table = @time_table_combination.combine flash[:notice] = t('time_table_combinations.success') render "create_success" - rescue Exception=> e - Rails.logger.error "Error: #{e}" + rescue => e + Rails.logger.error( "TimeTableCombination error, @time_table_combination=#{@time_table_combination.inspect}") + Rails.logger.error( e.inspect) flash[:error] = t('time_table_combinations.failure') render "create_failure" end + else + render "create_failure" end end diff --git a/app/controllers/vehicle_translations_controller.rb b/app/controllers/vehicle_translations_controller.rb index af54001ae..65a0db7fe 100644 --- a/app/controllers/vehicle_translations_controller.rb +++ b/app/controllers/vehicle_translations_controller.rb @@ -1,5 +1,5 @@ class VehicleTranslationsController < ChouetteController - respond_to :html, :only => [:create] + respond_to :js, :only => [:new, :create] belongs_to :referential do belongs_to :line, :parent_class => Chouette::Line do @@ -8,17 +8,36 @@ class VehicleTranslationsController < ChouetteController end end end + after_filter :clean_flash + + def clean_flash + # only run this in case it's an Ajax request. + return unless request.xhr? + + flash.discard + end + + def new + @vehicle_translation = VehicleTranslation.new( :vehicle_journey_id => parent.id, :count => 1, :duration => 1) + render :action => :new + end def create + @vehicle_translation = VehicleTranslation.new( params[:vehicle_translation].merge( :vehicle_journey_id => parent.id)) + begin - translation = VehicleTranslation.new( params[:vehicle_translation].merge( :vehicle_journey_id => parent.id)) - translation.translate - flash[:notice] = t('vehicle_translations.success', :count => translation.count) - rescue + if @vehicle_translation.valid? + @vehicle_translation.translate + flash[:notice] = t('vehicle_translations.success', :count => @vehicle_translation.count) + else + flash[:alert] = @vehicle_translation.errors[ :vehicle_journey_id] unless @vehicle_translation.errors[ :vehicle_journey_id].empty? + end + rescue => e + Rails.logger.error( "VehicleTranslation error, @vehicle_translation=#{@vehicle_translation.inspect}") + Rails.logger.error( e.inspect) flash[:alert] = t('vehicle_translations.failure') end - redirect_to referential_line_route_vehicle_journeys_path(@referential, @line, @route) - + render :action => :new end - + end diff --git a/app/models/vehicle_translation.rb b/app/models/vehicle_translation.rb index 5fc7117eb..0457da0fa 100644 --- a/app/models/vehicle_translation.rb +++ b/app/models/vehicle_translation.rb @@ -1,22 +1,44 @@ class VehicleTranslation - include ActiveModel::Validations - include ActiveModel::Conversion + include ActiveModel::Validations + include ActiveModel::Conversion extend ActiveModel::Naming - - + attr_accessor :vehicle_journey_id, :count, :duration - + attr_accessor :first_stop_arrival_time, :first_stop_departure_time + validates_presence_of :count, :duration + validates_numericality_of :count, greater_than: 0 + validates_numericality_of :duration, greater_than: 0 + validate :starting_time_provided + validate :vehicle_has_stop_times + + def initialize(attributes = {}) + attributes.each do |name, value| + send("#{name}=", value) + end + end - def initialize(attributes = {}) - attributes.each do |name, value| - send("#{name}=", value) - end - end - - def persisted? - false - end + def starting_time_provided + if ( first_stop_arrival_time.blank? && first_stop_departure_time.blank?) + errors.add :first_stop_arrival_time, I18n.t('activemodel.errors.models.vehicle_translation.missing_start_time') + errors.add :first_stop_departure_time, I18n.t('activemodel.errors.models.vehicle_translation.missing_start_time') + #errors.add( :first_stop_departure_time => "un horaire de départ ou d'arrivée au premier arrêt doit être renseigné") + elsif first_stop_departure_time.blank? + errors.add :first_stop_arrival_time, I18n.t('activemodel.errors.models.vehicle_translation.unreadable_time') unless Time.parse( self.first_stop_arrival_time) rescue false + elsif first_stop_arrival_time.blank? + errors.add :first_stop_departure_time, I18n.t('activemodel.errors.models.vehicle_translation.unreadable_time') unless Time.parse( self.first_stop_departure_time) rescue false + end + end + + def vehicle_has_stop_times + if vehicle_journey.vehicle_journey_at_stops.empty? + errors.add :vehicle_journey_id, I18n.t('activemodel.errors.models.vehicle_translation.uncompiliant_vehicle') + end + end + + def persisted? + false + end def translate vehicle = vehicle_journey @@ -37,9 +59,13 @@ class VehicleTranslation end end - + + def first_stop_name + @first_stop_name ||= vehicle_journey.vehicle_journey_at_stops.first.stop_point.stop_area.name + end + def vehicle_journey - Chouette::VehicleJourney.find( vehicle_journey_id) + @vehicle_journey ||= Chouette::VehicleJourney.find( vehicle_journey_id) end def self.from_vehicle( vehicle) diff --git a/app/views/access_links/_form.html.erb b/app/views/access_links/_form.html.erb index 4de6e8e85..b0138c1bd 100644 --- a/app/views/access_links/_form.html.erb +++ b/app/views/access_links/_form.html.erb @@ -10,7 +10,7 @@ <%= form.input :mobility_restricted_suitability,:as => :boolean %> <%= form.input :stairs_availability,:as => :boolean %> <%= form.input :lift_availability,:as => :boolean %> - <%= form.input :objectid, :required => !@access_link.new_record? %> + <%= form.input :objectid, :required => !@access_link.new_record?, :input_html => { :title => t("formtastic.titles.access_link.objectid")} %> <%= form.inputs :name => t('access_links.show.durations') do %> <%= form.input :default_duration, :as => :extended_time_picker, :size => 8, :step => :seconds, :label => @access_link.human_attribute_name("default_duration"), :input_html => { :class => "form-control input-sm timepicker_seconds", :step => 1}, :wrapper_html => { :class => "input-append bootstrap-timepicker" } %> <%= form.input :frequent_traveller_duration, :as => :extended_time_picker, :size => 8, :step => :seconds, :include_seconds => true, :label => @access_link.human_attribute_name("frequent_traveller_duration"), :input_html => { :class => "form-control input-sm timepicker_seconds", :step => 1}, :wrapper_html => { :class => "input-append bootstrap-timepicker" } %> diff --git a/app/views/access_links/show.html.erb b/app/views/access_links/show.html.erb index a318a84c6..79294bb38 100644 --- a/app/views/access_links/show.html.erb +++ b/app/views/access_links/show.html.erb @@ -13,7 +13,7 @@ <%= link_to @access_link.stop_area.name, [@referential, @access_link.stop_area] %> </p> <p> - <label><%= @access_link.human_attribute_name("name") %>: </label> + <label><%= @access_link.human_attribute_name(:name) %>: </label> <%= @access_link.name %> </p> <p> @@ -67,10 +67,6 @@ <label><%= @access_link.human_attribute_name("lift_availability") %>: </label> <%= t((@access_link.lift_availability == true).to_s) %> </p> - <p> - <label><%= @access_link.human_attribute_name("objectid") %>: </label> - <%= @access_link.objectid %> - </p> </div> </div> diff --git a/app/views/companies/_form.erb b/app/views/companies/_form.erb index c4fb90ee1..6f89edbbc 100644 --- a/app/views/companies/_form.erb +++ b/app/views/companies/_form.erb @@ -8,8 +8,8 @@ <%= form.input :phone, :as => :phone %> <%= form.input :fax, :as => :phone %> <%= form.input :email, :as => :email %> - <%= form.input :registration_number %> - <%= form.input :objectid, :required => !@company.new_record? %> + <%= 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")} %> <% end %> <%= form.actions do %> diff --git a/app/views/companies/show.html.erb b/app/views/companies/show.html.erb index 844832ee1..0ac132511 100644 --- a/app/views/companies/show.html.erb +++ b/app/views/companies/show.html.erb @@ -1,10 +1,10 @@ <%= title_tag t('companies.show.title', :company => @company.name) %> -<div class="line_show"> +<div class="company_show"> <div class="summary"> <p> - <label><%= Chouette::Company.human_attribute_name("name") %>: </label> + <label><%= @company.human_attribute_name(:name) %>: </label> <%= @company.name %> </p> <p> @@ -39,15 +39,12 @@ <label><%= Chouette::Company.human_attribute_name("registration_number") %>: </label> <%= @company.registration_number %> </p> - <p> - <label><%= Chouette::Company.human_attribute_name("objectid") %>: </label> - <%= @company.objectid %> - </p> </div> </div> <% content_for :sidebar do %> <ul class="actions"> + <li><%= link_to t('companies.actions.new'), new_referential_company_path(@referential), :class => "add" %></li> <li><%= link_to t('companies.actions.edit'), edit_referential_company_path(@referential, @company), :class => "edit" %></li> <li><%= link_to t('companies.actions.destroy'), referential_company_path(@referential, @company), :method => :delete, :data => {:confirm => t('companies.actions.destroy_confirm')}, :class => "remove" %></li> <br> diff --git a/app/views/connection_links/_form.erb b/app/views/connection_links/_form.erb index 41eef1480..fdc6ce018 100644 --- a/app/views/connection_links/_form.erb +++ b/app/views/connection_links/_form.erb @@ -9,7 +9,7 @@ <%= form.input :stairs_availability,:as => :boolean %> <%= form.input :lift_availability,:as => :boolean %> - <%= form.input :objectid, :required => !@connection_link.new_record? %> + <%= form.input :objectid, :required => !@connection_link.new_record?, :input_html => { :title => t("formtastic.titles.connection_link.objectid")} %> <% end %> <%= form.inputs :name => t('connection_links.show.durations') do %> <%= form.input :default_duration, :as => :extended_time_picker, :size => 8, :step => :seconds, :label => @connection_link.human_attribute_name("default_duration"), :input_html => { :class => "form-control input-sm timepicker_seconds", :step => 1}, :wrapper_html => { :class => "input-append bootstrap-timepicker" } %> diff --git a/app/views/connection_links/show.html.erb b/app/views/connection_links/show.html.erb index a41112621..70547bda1 100644 --- a/app/views/connection_links/show.html.erb +++ b/app/views/connection_links/show.html.erb @@ -21,7 +21,7 @@ <% end %> </p> <p> - <label><%= @connection_link.human_attribute_name("name") %>: </label> + <label><%= @connection_link.human_attribute_name(:name) %>: </label> <%= @connection_link.name %> </p> <p> @@ -75,10 +75,6 @@ <label><%= @connection_link.human_attribute_name("lift_availability") %>: </label> <%= t((@connection_link.lift_availability == true).to_s) %> </p> - <p> - <label><%= @connection_link.human_attribute_name("objectid") %>: </label> - <%= @connection_link.objectid %> - </p> </div> </div> diff --git a/app/views/exports/_fields_gtfs_export.erb b/app/views/exports/_fields_gtfs_export.erb index 89d7bbf37..60ffd21c8 100644 --- a/app/views/exports/_fields_gtfs_export.erb +++ b/app/views/exports/_fields_gtfs_export.erb @@ -1 +1 @@ -<%= form.input :time_zone, :as => :time_zone %> +<%= form.input :time_zone, :as => :time_zone, :input_html => { :title => t("formtastic.titles.export.time_zone")} %> diff --git a/app/views/exports/_fields_hub_export.erb b/app/views/exports/_fields_hub_export.erb index f23d10780..fc7cf7112 100644 --- a/app/views/exports/_fields_hub_export.erb +++ b/app/views/exports/_fields_hub_export.erb @@ -1,2 +1,2 @@ -<%= form.input :start_date, :as => :date_picker %> -<%= form.input :end_date, :as => :date_picker %> +<%= 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")} %> diff --git a/app/views/exports/_fields_neptune_export.erb b/app/views/exports/_fields_neptune_export.erb index 3ed863c20..d4debb6f2 100644 --- a/app/views/exports/_fields_neptune_export.erb +++ b/app/views/exports/_fields_neptune_export.erb @@ -1,2 +1,2 @@ - <%= form.input :start_date, :as => :date_picker %> - <%= form.input :end_date, :as => :date_picker %> + <%= 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")} %> diff --git a/app/views/group_of_lines/_form.erb b/app/views/group_of_lines/_form.erb index b92fa1ea1..3c685964b 100644 --- a/app/views/group_of_lines/_form.erb +++ b/app/views/group_of_lines/_form.erb @@ -2,7 +2,7 @@ <%= form.inputs do %> <%= form.input :name %> <%= form.input :comment %> - <%= form.input :objectid, :required => !@group_of_line.new_record? %> + <%= form.input :objectid, :required => !@group_of_line.new_record?, :input_html => { :title => t("formtastic.titles.group_of_line.objectid")} %> <% end %> <%= form.inputs do %> diff --git a/app/views/group_of_lines/show.html.erb b/app/views/group_of_lines/show.html.erb index 5e77bfe78..e5923d539 100644 --- a/app/views/group_of_lines/show.html.erb +++ b/app/views/group_of_lines/show.html.erb @@ -4,17 +4,13 @@ <%= @map.to_html %> <div class="summary"> <p> - <label><%= @group_of_line.human_attribute_name("name") %>: </label> + <label><%= @group_of_line.human_attribute_name(:name) %>: </label> <%= @group_of_line.name %> </p> <p> <label><%= @group_of_line.human_attribute_name("comment") %>: </label> <%= @group_of_line.comment %> </p> - <p> - <label><%= @group_of_line.human_attribute_name("objectid") %>: </label> - <%= @group_of_line.objectid %> - </p> </div> <p class="after_map" /> @@ -31,6 +27,7 @@ <% content_for :sidebar do %> <ul class="actions"> + <li><%= link_to t('group_of_lines.actions.new'), new_referential_group_of_line_path(@referential), :class => "add" %></li> <li><%= link_to t('group_of_lines.actions.edit'), edit_referential_group_of_line_path(@referential, @group_of_line), :class => "edit" %></li> <li><%= link_to t('group_of_lines.actions.destroy'), referential_group_of_line_path(@referential, @group_of_line), :method => :delete, :data => {:confirm => t('group_of_lines.actions.destroy_confirm')} , :class => "remove" %></li> <br> diff --git a/app/views/help/lines.textile b/app/views/help/lines.textile index 4b35d2b61..518f9dc9a 100644 --- a/app/views/help/lines.textile +++ b/app/views/help/lines.textile @@ -23,6 +23,8 @@ les autres transporteurs de la lignes peuvent être référencés au niveau de c mode de transport principal de la ligne d'autres modes de transports particuliers peuvent être indiqués au niveau de chaque course =: +- Accessibilité PMR := précise si la ligne est équipée PMR +- Transport à la demande := précise si la ligne est en exploitation à la demande ou pas - Commentaire := zone de texte libre sur la ligne - Groupes de lignes := "groupes de lignes":group_of_lines auxquels appartient la ligne diff --git a/app/views/help/routes.textile b/app/views/help/routes.textile index c422be1ad..43a7fc14d 100644 --- a/app/views/help/routes.textile +++ b/app/views/help/routes.textile @@ -17,7 +17,7 @@ h3. Attributs - Direction := orientation principale (points cardinaux, circulaire ou aller/retour) - Indice := numéro de la séquence d'arrêts - Sens := aller ou retour -- Itinéraire associé en sens opposé := référence de l'itinéraire de sens opposé associé +- Séquence d'arrêts associée en sens opposé := référence de la séquence d'arrêts de sens opposé associée p(attr_data). Données de gestion : @@ -36,7 +36,3 @@ il est possible aussi de ne renseigner que l'identifiant technique, auquel cas l - Version := version de l'objet (auto incrémenté à chaque modification) - Créé par := compte utilisateur ayant procédé à la dernière modification -h3. Implémentation - -p. TODO - diff --git a/app/views/help/time_tables.textile b/app/views/help/time_tables.textile index 87e04b37f..28a217a4c 100644 --- a/app/views/help/time_tables.textile +++ b/app/views/help/time_tables.textile @@ -14,6 +14,7 @@ Les calendriers sont caractérisés par : * une liste de quantièmes (jours calendaires dans l'année) * une liste de jours d'application (lundis, mardis, etc.) * une liste de périodes sur lesquelles s'appliquent les jours d'application +* une liste de dates à exclure des périodes. L'utilisateur doit donc faire attention au nommage de ses différents calendriers d'application. @@ -23,15 +24,25 @@ Ainsi, il est possible de construire des calendriers d'application qui sont ensu h3. Attributs -- Commentaire := Description du calendrier -- Version := version du calendrier (différent de la version de l'objet) -- Jours d'application := jours de la semaine effectivement applicables dans le cas où des périodes sont définies dans le calendrier +- Nom := Description du calendrier +- Abréviation := Code abrégé +- Etiquettes := +Marqueurs caractérisant le calendrier (pour simplifier la recherche) +Afin d'être enregistrées, les étiquettes doivent être saisiées séparées par une ',' (virgule) et la touche 'tab' permet d'activer la dernière. +Un assistant propose les étiquettes déjà saisies sur d'autres calendriers. +=: - Périodes d'application := périodes calendaires durant lesquelles le calendrier est applicable -- Dates d'application := +- Jours d'application := jours de la semaine effectivement applicables dans le cas où des périodes sont définies dans le calendrier +- Dates particulières := dates spécifiques pour lesquelles le calendrier est applicable; ces dates peuvent être ajoutées dans ou en dehors des périodes calendaires. Un calendrier peut n'avoir que des dates calendaires, auquel cas les jours d'applications n'ont pas de signification =: +- Dates exclues := +dates spécifiques à retirer des dates définies par les périodes et les jours d'application; +une même date calendaire ne peut pas être à la fois particulière et exclue; +une date exclue hors périodes et jours d'application n'a aucun effet. +=: p(attr_data). Données de gestion : @@ -50,7 +61,25 @@ il est possible aussi de ne renseigner que l'identifiant technique, auquel cas l - Version := version de l'objet (auto incrémenté à chaque modification) - Créé par := compte utilisateur ayant procédé à la dernière modification -h3. Implémentation +h3. Opérations particulières + +Lors de la consultation d'un calendrier, 2 opérations particulières sont disponibles : *Dupliquer* et *Combiner* + +h4. Duplication + +La duplication d'un calendrier consiste à créer un calendrier copie conforme du calendrier consulté à l'exception du nom et de l'identifiant Neptune + +* le nom est précédé de "Copie de" +* l'identifiant Neptune est complété par un numéro secondaire "_n" où n est la valeur minimale non présente dans l'Espace de données. + +Une fois la duplication effectuée, le double est enregistré en base et affiché en mode édition afin de permettre à l'opérateur de l'adapter à ses besoins. + +h4. Combinaisons + +La combinaison de calendriers consiste à modifier le calendrier consulté à l'aide d'un autre; les opérations sont : -p. TODO +- ajouter les dates := les dates et périodes du second calendrier sont ajoutées au premier +- conserver les dates commune := seules les dates et périodes communes aux 2 calendriers sont conservées +- soustraire les dates := les dates communes aux 2 calendriers sont retirées du premier +L'opération est effectuée en base et ne nécessite pas d'action de sauvegarde. diff --git a/app/views/help/vehicle_journeys.textile b/app/views/help/vehicle_journeys.textile index d5186cf57..7deafd73b 100644 --- a/app/views/help/vehicle_journeys.textile +++ b/app/views/help/vehicle_journeys.textile @@ -10,11 +10,16 @@ De plus, la course est rattachée à un nombre variable de "calendriers d'applic h3. Attributs -- Nom := nom de la course +- Numéro := numéro de la course - Nom public := nom public pour les voyageurs +- Identifiant public := identifiant public - Commentaire := zone de texte libre - Mode de transport := mode de transport pour la course; par défaut, c'est le mode de transport de la ligne qui est appliqué -- Particularité := champs libre pouvant préciser des modes de fonctionnement (TAD par exemple) +- Accessibilité PMR := précise si la course est équipée PMR +- Transport à la demande := précise si la course est en exploitation à la demande ou pas +- Etat de trafic := état de trafic +- Equipement := équipement +- Type d'identifiant du véhicule := type d'identifiant du véhicule p(attr_data). Données de gestion : diff --git a/app/views/import_tasks/_fields_gtfs_import.erb b/app/views/import_tasks/_fields_gtfs_import.erb index 460f6cc9b..70ffb207a 100644 --- a/app/views/import_tasks/_fields_gtfs_import.erb +++ b/app/views/import_tasks/_fields_gtfs_import.erb @@ -1,7 +1,7 @@ <%= form.input :object_id_prefix, :input_html => { :value => @referential.prefix } %> -<%= form.input :max_distance_for_commercial , :as => :number , :input_html => { :title => t("formtastic.hints.import_task.max_distance_for_commercial"), :value => 50 } %> -<%= form.input :ignore_last_word , :as => :boolean , :input_html => { :title => t("formtastic.hints.import_task.ignore_last_word"), :value => false }%> -<%= form.input :ignore_end_chars , :as => :number , :input_html => { :title => t("formtastic.hints.import_task.ignore_end_chars"), :value => 0 }%> -<%= form.input :max_distance_for_connection_link , :as => :number , :input_html => { :title => t("formtastic.hints.import_task.max_distance_for_connection_link"), :value => 100 }%> +<%= form.input :max_distance_for_commercial , :as => :number , :input_html => { :title => t("formtastic.titles.import_task.max_distance_for_commercial"), :value => 50 } %> +<%= form.input :ignore_last_word , :as => :boolean , :input_html => { :title => t("formtastic.titles.import_task.ignore_last_word"), :value => false }%> +<%= form.input :ignore_end_chars , :as => :number , :input_html => { :title => t("formtastic.titles.import_task.ignore_end_chars"), :value => 0 }%> +<%= form.input :max_distance_for_connection_link , :as => :number , :input_html => { :title => t("formtastic.titles.import_task.max_distance_for_connection_link"), :value => 100 }%> diff --git a/app/views/journey_patterns/_form.html.erb b/app/views/journey_patterns/_form.html.erb index 771283885..361f7f380 100644 --- a/app/views/journey_patterns/_form.html.erb +++ b/app/views/journey_patterns/_form.html.erb @@ -5,7 +5,7 @@ <%= form.input :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? %> + <%= form.input :objectid, :required => !@journey_pattern.new_record?, :input_html => { :title => t("formtastic.titles.journey_pattern.objectid")} %> <% end %> <%= form.actions do %> diff --git a/app/views/journey_patterns/show.html.erb b/app/views/journey_patterns/show.html.erb index 2ea427380..cb0b75acc 100644 --- a/app/views/journey_patterns/show.html.erb +++ b/app/views/journey_patterns/show.html.erb @@ -28,10 +28,6 @@ <label><%= @journey_pattern.human_attribute_name(:comment) %>: </label> <%= @journey_pattern.comment %> </p> - <p> - <label><%= @journey_pattern.human_attribute_name("objectid") %>: </label> - <%= @journey_pattern.objectid %> - </p> </div> </div> diff --git a/app/views/lines/_form.erb b/app/views/lines/_form.erb index 554de3319..c1f59ed01 100644 --- a/app/views/lines/_form.erb +++ b/app/views/lines/_form.erb @@ -5,13 +5,13 @@ <%= form.input :company, :as => :select, :collection => Chouette::Company.all, :include_blank => false%> <%= form.input :name %> <%= form.input :published_name %> - <%= form.input :registration_number %> + <%= form.input :registration_number, :input_html => { :title => t("formtastic.titles.line.registration_number")} %> <%= form.input :number %> <%= form.input :transport_mode, :as => :select, :collection => Chouette::Line.transport_modes, :include_blank => false, :member_label => Proc.new { |mode| t("transport_modes.label.#{mode}") } %> <%= form.input :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? %> + <%= form.input :objectid, :required => !@line.new_record?, :input_html => { :title => t("formtastic.titles.line.objectid")} %> <% end %> <%= form.inputs do %> diff --git a/app/views/lines/show.html.erb b/app/views/lines/show.html.erb index 2b9961ca2..d1a13aacf 100644 --- a/app/views/lines/show.html.erb +++ b/app/views/lines/show.html.erb @@ -21,7 +21,7 @@ <% end %> </p> <p> - <label><%= @line.human_attribute_name("name") %>: </label> + <label><%= @line.human_attribute_name(:name) %>: </label> <%= @line.name %> </p> <p> @@ -80,10 +80,6 @@ <label><%= @line.human_attribute_name("comment") %>: </label> <%= @line.comment %> </p> - <p> - <label><%= @line.human_attribute_name("objectid") %>: </label> - <%= @line.objectid %> - </p> </div> </div> @@ -102,8 +98,9 @@ <% content_for :sidebar do %> <ul class="actions"> + <li><%= link_to t('lines.actions.new'), new_referential_line_path(@referential), :class => "add" %></li> <li><%= link_to t('lines.actions.edit'), edit_referential_line_path(@referential, @line), :class => "edit" %></li> - <li><%= link_to t('lines.actions.destroy'), referential_line_path(@referential, @line), :method => :delete, :data => {:confirm => t('lines.actions.destroy_confirm')}, :class => "remove" %></li> + <li><%= link_to t('lines.actions.destroy'), referential_line_path(@referential, @line), :method => :delete, :data => {:confirm => t('lines.actions.destroy_confirm')}, :class => "remove" %></li> <li><%= link_to t('routes.actions.new'), new_referential_line_route_path(@referential, @line), :class => "add" %></li> </ul> <%= creation_tag(@line) %> diff --git a/app/views/networks/_form.erb b/app/views/networks/_form.erb index 61b52a6a4..bb87d9e46 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 %> + <%= form.input :registration_number, :input_html => { :title => t("formtastic.titles.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? %> + <%= form.input :objectid, :required => !@network.new_record?, :input_html => { :title => t("formtastic.titles.network.objectid")} %> <% end %> <%= form.actions do %> diff --git a/app/views/networks/show.html.erb b/app/views/networks/show.html.erb index 273a04aed..1999c9869 100644 --- a/app/views/networks/show.html.erb +++ b/app/views/networks/show.html.erb @@ -4,7 +4,7 @@ <%= @map.to_html %> <div class="summary"> <p> - <label><%= Chouette::Network.human_attribute_name("name") %>: </label> + <label><%= @network.human_attribute_name(:name) %>: </label> <%= @network.name %> </p> <p> @@ -33,15 +33,12 @@ <label><%= Chouette::Network.human_attribute_name("source_identifier") %>: </label> <%= @network.source_identifier %> </p> - <p> - <label><%= Chouette::Network.human_attribute_name("objectid") %>: </label> - <%= @network.objectid %> - </p> </div> </div> <% content_for :sidebar do %> <ul class="actions"> + <li><%= link_to t('networks.actions.new'), new_referential_network_path(@referential), :class => "add" %></li> <li><%= link_to t('networks.actions.edit'), edit_referential_network_path(@referential, @network), :class => "edit" %></li> <li><%= link_to t('networks.actions.destroy'), referential_network_path(@referential, @network), :method => :delete, :data => {:confirm => t('networks.actions.destroy_confirm')}, :class => "remove" %></li> <br> diff --git a/app/views/referentials/_clean.html.erb b/app/views/referentials/_clean.html.erb index 5c749867f..995b7644d 100644 --- a/app/views/referentials/_clean.html.erb +++ b/app/views/referentials/_clean.html.erb @@ -1,7 +1,7 @@ <div id="clean_up" > <%= semantic_form_for [@referential, CleanUp.new] do |form| %> <%= form.inputs do %> - <%= form.input :expected_date, :as => :date_picker , :wrapper_html => { :class => 'date', :title => t('hints.clean_up.expected_date') } %> + <%= form.input :expected_date, :as => :date_picker , :wrapper_html => { :class => 'date', :title => t('titles.clean_up.expected_date') } %> <%= form.input :keep_lines, :as => :boolean %> <%= form.input :keep_stops, :as => :boolean %> <%= form.input :keep_companies, :as => :boolean %> diff --git a/app/views/referentials/_form.erb b/app/views/referentials/_form.erb index 60f5cacf3..814195dde 100644 --- a/app/views/referentials/_form.erb +++ b/app/views/referentials/_form.erb @@ -2,18 +2,18 @@ <%= form.inputs do %> <%= form.input :name %> <% if @referential.new_record? %> - <%= form.input :slug%> + <%= form.input :slug, :input_html => { :title => t("formtastic.titles.referential.slug")}%> <% else %> <li class="input"> <label class="label" ><%= @referential.human_attribute_name("slug") %></label> <%= @referential.slug %> </li> <% end %> - <%= form.input :prefix %> + <%= form.input :prefix, :input_html => { :title => t("formtastic.titles.referential.prefix")} %> <%= form.input :projection_type, :as => :select, :collection => Referential.available_srids %> <%= form.input :time_zone %> - <%= form.input :upper_corner %> - <%= form.input :lower_corner %> + <%= 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")} %> <% end %> <%= form.actions do %> diff --git a/app/views/routes/_form.html.erb b/app/views/routes/_form.html.erb index ff4a4403e..004af05e3 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?%> + <%= form.input :objectid, :required => !@route.new_record?, :input_html => { :title => t("formtastic.titles.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 262212477..3a9504775 100644 --- a/app/views/routes/show.html.erb +++ b/app/views/routes/show.html.erb @@ -48,10 +48,6 @@ <%= t(".no_opposite_route") %> <% end %> </p> - <p> - <label><%= @route.human_attribute_name("objectid") %>: </label> - <%= @route.objectid %> - </p> </div> </div> @@ -94,6 +90,7 @@ <% content_for :sidebar do %> <ul class="actions"> + <li><%= link_to t('routes.actions.new'), new_referential_line_route_path(@referential, @line), :class => "add" %></li> <li><%= link_to t('routes.actions.edit'), edit_referential_line_route_path(@referential, @line, @route), :class => "edit" %></li> <li><%= link_to t('routes.actions.destroy'), referential_line_route_path(@referential, @line, @route), :method => :delete, :data => {:confirm => t('routes.actions.destroy_confirm')}, :class => "remove" %></li> <% if @route.stop_points.size >= 2 %> diff --git a/app/views/time_table_combinations/_combine.html.erb b/app/views/time_table_combinations/_combine.html.erb index 85fc5ab26..27b5f056f 100644 --- a/app/views/time_table_combinations/_combine.html.erb +++ b/app/views/time_table_combinations/_combine.html.erb @@ -1,4 +1,4 @@ -<div id="combine_form" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> +<div id="modal_combine" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> diff --git a/app/views/time_table_combinations/new.js.erb b/app/views/time_table_combinations/new.js.erb new file mode 100644 index 000000000..ea98d9aaf --- /dev/null +++ b/app/views/time_table_combinations/new.js.erb @@ -0,0 +1,4 @@ +var combine_form_partial = '<%= j render "time_table_combinations/combine_form" %> '; +$('#new_time_table_combination').replaceWith(combine_form_partial); + + diff --git a/app/views/time_tables/_form.erb b/app/views/time_tables/_form.erb index 71718995d..24e72e676 100644 --- a/app/views/time_tables/_form.erb +++ b/app/views/time_tables/_form.erb @@ -6,7 +6,7 @@ <%= form.input :tag_search, :input_html => { class: "tm-input typeahead", :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? %> + <%= form.input :objectid, :required => !@time_table.new_record?, :input_html => { :title => t("formtastic.titles.time_table.objectid")} %> <% end %> <h3 class="time_table_periods"> diff --git a/app/views/time_tables/_show_time_table.html.erb b/app/views/time_tables/_show_time_table.html.erb index 71fe973c9..5095ac918 100644 --- a/app/views/time_tables/_show_time_table.html.erb +++ b/app/views/time_tables/_show_time_table.html.erb @@ -13,6 +13,10 @@ </div> <div class="summary"> <p> + <label><%= @time_table.human_attribute_name("comment") %>: </label> + <%= @time_table.comment %> + </p> + <p> <label><%= @time_table.human_attribute_name("version") %>: </label> <%= @time_table.version %> </p> diff --git a/app/views/time_tables/show.html.erb b/app/views/time_tables/show.html.erb index e02d96a58..7e9a5aa62 100644 --- a/app/views/time_tables/show.html.erb +++ b/app/views/time_tables/show.html.erb @@ -12,7 +12,7 @@ <li><%= link_to t('time_tables.actions.edit'), edit_referential_time_table_path(@referential, @time_table), :class => "edit" %></li> <li><%= link_to t('time_tables.actions.destroy'), referential_time_table_path(@referential, @time_table), :method => :delete, :data => {:confirm => t('time_tables.actions.destroy_confirm')}, :class => "remove" %></li> <li><font color="green"><i class="fa fa-files-o fa-fw"></i></font><%= link_to t('time_tables.actions.duplicate'), duplicate_referential_time_table_path(@referential, @time_table), :class => "with_fa" %></li> - <li><font color="#D98F3B"><i class="fa fa-cogs fa-fw"></i></font><%= link_to t('time_tables.actions.combine'), '#combine_form', 'data-toggle' => 'modal', :class => "with_fa"%></li> + <li><font color="#D98F3B"><i class="fa fa-cogs fa-fw"></i></font><%= link_to t('time_tables.actions.combine'), new_referential_time_table_time_table_combination_path(@referential, @time_table), {:remote => true, 'data-toggle' => "modal", 'data-target' => '#modal_combine', :class => "with_fa"} %></li> </ul> diff --git a/app/views/vehicle_journeys/_form.html.erb b/app/views/vehicle_journeys/_form.html.erb index e785c70dc..793304397 100644 --- a/app/views/vehicle_journeys/_form.html.erb +++ b/app/views/vehicle_journeys/_form.html.erb @@ -1,6 +1,7 @@ <%= semantic_form_for [@referential, @line, @route, @vehicle_journey] do |form| %> <%= form.inputs do %> <%= form.input :journey_pattern, :as => :select, :collection => @route.journey_patterns, :member_label => Proc.new { |jp| journey_name(jp) } %> + <%= form.input :number %> <%= form.input :published_journey_name %> <%= form.input :published_journey_identifier %> <%= form.input :comment %> @@ -10,7 +11,7 @@ <%= form.input :status_value %> <%= form.input :facility %> <%= form.input :vehicle_type_identifier%> - <%= form.input :objectid, :required => !@vehicle_journey.new_record? %> + <%= form.input :objectid, :required => !@vehicle_journey.new_record?, :input_html => { :title => t("formtastic.titles.vehicle_journey.objectid")} %> <%= form.input :time_table_tokens, :label => t('.time_tables'), :as => :text, :input_html => { :"data-pre" => ( @vehicle_journey.time_tables.map { |time_table| { :id => time_table.id, :name => time_table_description(time_table) } } ).to_json } %> <li class="input"> <%= form.label @vehicle_journey.human_attribute_name(:vehicle_journey_at_stop_ids), :class => "label" %> diff --git a/app/views/vehicle_journeys/show.html.erb b/app/views/vehicle_journeys/show.html.erb index 01f44c7b0..4068757c9 100644 --- a/app/views/vehicle_journeys/show.html.erb +++ b/app/views/vehicle_journeys/show.html.erb @@ -1,5 +1,17 @@ <%= title_tag vehicle_title(@vehicle_journey) %> +<div id="modal_translation" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> + <div class="modal-dialog"> + <div class="modal-content"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button> + <h4 class="modal-title" id="myModalLabel"><%= t('.translation_form') %></h4> + <p id="translate_form"></p> + </div> + </div> + </div> +</div> + <div class="vehicle_journey"> <div class="summary"> <p> @@ -15,6 +27,10 @@ <%= link_to journey_name(@vehicle_journey.journey_pattern), [@referential, @line, @route, @vehicle_journey.journey_pattern] %> </p> <p> + <label><%= @vehicle_journey.human_attribute_name("number") %>: </label> + <%= @vehicle_journey.number %> + </p> + <p> <label><%= @vehicle_journey.human_attribute_name("published_journey_name") %>: </label> <%= @vehicle_journey.published_journey_name %> </p> @@ -60,10 +76,6 @@ <label><%= @vehicle_journey.human_attribute_name("vehicle_type_identifier") %>: </label> <%= @vehicle_journey.vehicle_type_identifier %> </p> - <p> - <label><%= @vehicle_journey.human_attribute_name("objectid") %>: </label> - <%= @vehicle_journey.objectid %> - </p> </div> </div> <h3><%= @vehicle_journey.human_attribute_name(:vehicle_journey_at_stop_ids) %></h3> @@ -93,25 +105,13 @@ <%= paginated_content @vehicle_journey.time_tables, "time_table" %> </div> + <% content_for :sidebar do %> <ul class="actions"> <li><%= link_to t('vehicle_journeys.actions.edit'), edit_referential_line_route_vehicle_journey_path(@referential, @line, @route, @vehicle_journey), :class => "edit" %></li> <li><%= link_to t('vehicle_journeys.actions.destroy'), referential_line_route_vehicle_journey_path(@referential, @line, @route, @vehicle_journey), :method => :delete, :data => {:confirm => t('vehicle_journeys.actions.destroy_confirm')}, :class => "remove" %></li> - </ul> - <% unless @vehicle_journey.vehicle_journey_at_stops.empty? || - @vehicle_journey.vehicle_journey_at_stops.any? { |vjas| vjas.departure_time.nil? } %> - <h4><%= t('.translation_form') %></h4> - <div id="compact_form" > - <%= semantic_form_for [@referential, @line, @route, @vehicle_journey, VehicleTranslation.new] do |form| %> - <%= form.inputs do %> - <%= form.input :duration %> - <%= form.input :count %> - <% end %> - <%= form.actions do %> - <%= form.action :submit, :as => :button, :label => t('.validation') %> - <% end %> - <% end %> - </div> - <%= creation_tag(@vehicle_journey) %> + <% unless @vehicle_journey.vehicle_journey_at_stops.empty? %> + <li><%= link_to t('.translation_form'), new_referential_line_route_vehicle_journey_vehicle_translation_path(@referential, @line, @route, @vehicle_journey), {:remote => true, 'data-toggle' => "modal", 'data-target' => '#modal_translation'} %></li> <% end %> + </ul> <% end %> diff --git a/app/views/vehicle_translations/_translate_form.html.erb b/app/views/vehicle_translations/_translate_form.html.erb new file mode 100644 index 000000000..ea7e15bf0 --- /dev/null +++ b/app/views/vehicle_translations/_translate_form.html.erb @@ -0,0 +1,37 @@ +<div id="translate_form"> + <%= render "shared/flash_messages" %> + <%= semantic_form_for [@referential, @line, @route, @vehicle_journey, @vehicle_translation], remote: true do |form| %> + <div class="modal-body"> + <%= form.inputs do %> + <%= form.input :first_stop_arrival_time, + as: :time_picker, label: t( ".first_stop_arrival_time", stop_name: @vehicle_translation.first_stop_name), + input_html: { class: "form-control input-sm timepicker_basic"}, wrapper_html: { class: "input-append bootstrap-timepicker" } %> + <%= form.input :first_stop_departure_time, + as: :time_picker, label: t( ".first_stop_departure_time", stop_name: @vehicle_translation.first_stop_name), + input_html: { class: "form-control input-sm timepicker_basic"}, wrapper_html: { class: "input-append bootstrap-timepicker" } %> + <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="#collapseOne"> + <%= t('.multiple_cloning_form') %> + </a> + </h4> + </div> + <div id="collapseOne" class="panel-collapse collapse in"> + <div class="panel-body"> + <%= form.input :duration, as: :number %> + <%= form.input :count, as: :number %> + </div> + </div> + </div> + </div> + <% end %> + </div> + <div class="modal-footer"> + <%= form.actions do %> + <%= form.action :submit, as: :button, label: t('.validation') %> + <% end %> + <% end %> + </div> +</div> diff --git a/app/views/vehicle_translations/new.js.erb b/app/views/vehicle_translations/new.js.erb new file mode 100644 index 000000000..0c7869fb6 --- /dev/null +++ b/app/views/vehicle_translations/new.js.erb @@ -0,0 +1,4 @@ +var modal_translation_content = '<%= escape_javascript( render "vehicle_translations/translate_form") %> '; +$('#translate_form').html(modal_translation_content); + + diff --git a/config/locales/access_links.yml b/config/locales/access_links.yml index b714bfad4..0a0aeedbb 100644 --- a/config/locales/access_links.yml +++ b/config/locales/access_links.yml @@ -40,7 +40,7 @@ en: creation_time: "Created on" creatorid: "Created by " formtastic: - hints: + titles: access_link: objectid: "[prefix]:AccessLink:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character" @@ -86,7 +86,7 @@ fr: creation_time: "Créé le" creator_id: "Créé par" formtastic: - hints: + titles: access_link: objectid: "[prefixe]:AccessLink:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'" diff --git a/config/locales/clean_ups.yml b/config/locales/clean_ups.yml index dc03fb4a1..48d22981e 100644 --- a/config/locales/clean_ups.yml +++ b/config/locales/clean_ups.yml @@ -22,7 +22,7 @@ en: keep_companies: "keep companies" keep_networks: "keep networks" keep_group_of_lines: "keep groups of lines" - hints: + titles: clean_up: expected_date: "value included in clean up" fr: @@ -49,7 +49,7 @@ fr: keep_companies: "conserver les transporteurs" keep_networks: "conserver les réseaux" keep_group_of_lines: "conserver les groupes de lignes" - hints: + titles: clean_up: expected_date: "valeur incluse dans la purge" diff --git a/config/locales/companies.yml b/config/locales/companies.yml index f4ffc06ee..09b010cc9 100644 --- a/config/locales/companies.yml +++ b/config/locales/companies.yml @@ -37,7 +37,7 @@ en: creation_time: "Created on" creator_id: "Created by " formtastic: - hints: + titles: company: 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" @@ -81,7 +81,7 @@ fr: creation_time: "Créé le" creator_id: "Créé par" formtastic: - hints: + titles: company: registration_number: "caractères autorisés : alphanumériques et 'souligné'" objectid: "[prefixe]:Company:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'" diff --git a/config/locales/connection_links.yml b/config/locales/connection_links.yml index d1f107526..815a913f8 100644 --- a/config/locales/connection_links.yml +++ b/config/locales/connection_links.yml @@ -58,7 +58,7 @@ en: creation_time: "Created on" creator_id: "Created by" formtastic: - hints: + titles: connection_link: objectid: "[prefix]:ConnectionLink:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character" @@ -122,7 +122,7 @@ fr: creation_time: "Créé le" creator_id: "Créé par" formtastic: - hints: + 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'" diff --git a/config/locales/exports.yml b/config/locales/exports.yml index d1a8e1c62..cf21a4787 100644 --- a/config/locales/exports.yml +++ b/config/locales/exports.yml @@ -98,10 +98,11 @@ en: position: "N." full_message: "Message" formtastic: - hints: - time_zone: "according to TZ encoding (see http://en.wikipedia.org/wiki/Tz_database)" - start_date: "reduce import to vehicle journeys running from this date" - end_date: "reduce import to vehicle journeys running until this date" + titles: + export: + time_zone: "according to TZ encoding (see http://en.wikipedia.org/wiki/Tz_database)" + start_date: "reduce import to vehicle journeys running from this date" + end_date: "reduce import to vehicle journeys running until this date" area_types: quay: "Quays and Boarding Positions" commercial_stop_point: "Commercial Stop Points" @@ -207,10 +208,11 @@ fr: position: "No" full_message: "Message" formtastic: - hints: - time_zone: "selon le codage TZ (http://fr.wikipedia.org/wiki/Tz_database)" - start_date: "limite l'export aux courses circulant à partir de cette date" - end_date: "limite l'export aux courses circulant jusqu'à cette date" + titles: + export: + time_zone: "selon le codage TZ (http://fr.wikipedia.org/wiki/Tz_database)" + start_date: "limite l'export aux courses circulant à partir de cette date" + end_date: "limite l'export aux courses circulant jusqu'à cette date" area_types: quay: "Arrêts" commercial_stop_point: "Arrêts commerciaux" diff --git a/config/locales/group_of_lines.yml b/config/locales/group_of_lines.yml index 06b893667..1f970d4f9 100644 --- a/config/locales/group_of_lines.yml +++ b/config/locales/group_of_lines.yml @@ -33,7 +33,7 @@ en: creation_time: "Created on" creator_id: "Created by" formtastic: - hints: + titles: group_of_line: objectid: "[prefix]:GroupOfLine:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character" @@ -72,7 +72,7 @@ fr: creation_time: "Créé le" creator_id: "Créé par" formtastic: - hints: + titles: group_of_line: objectid: "[prefixe]:GroupOfLine:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'" diff --git a/config/locales/import_tasks.yml b/config/locales/import_tasks.yml index 1d5313607..1dca0a445 100644 --- a/config/locales/import_tasks.yml +++ b/config/locales/import_tasks.yml @@ -82,7 +82,7 @@ en: ignore_last_word: "ignore last word" ignore_end_chars: "ignore last chars" formtastic: - hints: + titles: import_task: max_distance_for_commercial: "Maximal distance to merge homonymous stops in commercial stop in meter" max_distance_for_connection_link: "Maximal distance to link stops by connection link stop in meter" @@ -186,7 +186,7 @@ fr: ignore_last_word: "ignorer le dernier mot" ignore_end_chars: "ignorer les n derniers caractères" formtastic: - hints: + titles: import_task: max_distance_for_commercial: "Distance maximale entre deux arrêts homonymes pour créer les zones d'arrêt (en mètre)" max_distance_for_connection_link: "Distance maximale entre deux arrêts pour créer les correspondances (en mètre)" diff --git a/config/locales/journey_patterns.yml b/config/locales/journey_patterns.yml index 3c781d656..b16985c2c 100644 --- a/config/locales/journey_patterns.yml +++ b/config/locales/journey_patterns.yml @@ -40,7 +40,7 @@ en: creation_time: "Created on" creator_id: "Created by" formtastic: - hints: + titles: journey_pattern: objectid: "[prefix]:JourneyPattern:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character" @@ -86,6 +86,6 @@ fr: creation_time: "Créé le" creator_id: "Créé par" formtastic: - hints: + titles: journey_pattern: 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'" diff --git a/config/locales/lines.yml b/config/locales/lines.yml index cee2d0756..2a35cccc6 100644 --- a/config/locales/lines.yml +++ b/config/locales/lines.yml @@ -76,7 +76,7 @@ en: creation_time: "Created on" creator_id: "Created by" formtastic: - hints: + titles: line: 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" @@ -159,7 +159,7 @@ fr: creation_time: "Créé le" creator_id: "Créé par" formtastic: - hints: + titles: line: registration_number: "caractères autorisés : alphanumériques et 'souligné'" objectid: "[prefixe]:Line:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'" diff --git a/config/locales/networks.yml b/config/locales/networks.yml index a8374c770..30cd399b9 100644 --- a/config/locales/networks.yml +++ b/config/locales/networks.yml @@ -36,7 +36,7 @@ en: creation_time: "Created on" creator_id: "Created by " formtastic: - hints: + titles: network: 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" @@ -78,7 +78,7 @@ fr: creation_time: "Créé le" creator_id: "Créé par" formtastic: - hints: + titles: network: registration_number: "caractères autorisés : alphanumériques et 'souligné'" objectid: "[prefixe]:GroupOfLine:[clé_unique] caractères autorisés : alphanumériques et 'souligné' pour le préfixe, la clé unique accepte en plus le 'moins'" diff --git a/config/locales/referentials.yml b/config/locales/referentials.yml index a324dc481..8353c1e9e 100644 --- a/config/locales/referentials.yml +++ b/config/locales/referentials.yml @@ -66,7 +66,7 @@ en: export_tasks: "Exports" compliance_check_tasks: "Validations" formtastic: - hints: + titles: referential: slug: "only lowercase alphanumerical or underscore characters, first character must be a letter" prefix: "only alphanumerical or underscore characters" @@ -141,7 +141,7 @@ fr: export_tasks: "Exports" compliance_check_tasks: "Validations" formtastic: - hints: + titles: referential: 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é'" diff --git a/config/locales/routes.yml b/config/locales/routes.yml index 623b9d9fc..b68f1802a 100644 --- a/config/locales/routes.yml +++ b/config/locales/routes.yml @@ -59,7 +59,7 @@ en: creation_time: "Created on" creator_id: "Created by" formtastic: - hints: + titles: route: objectid: "[prefix]:Route:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character" @@ -124,7 +124,7 @@ fr: creator_id: "Créé par" no_journey_pattern: "Pas de mission" formtastic: - hints: + 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'" diff --git a/config/locales/time_tables.yml b/config/locales/time_tables.yml index 5742b7e30..0cd04dff5 100644 --- a/config/locales/time_tables.yml +++ b/config/locales/time_tables.yml @@ -76,7 +76,7 @@ en: period_end: "to" tag_search: "Tags" formtastic: - hints: + titles: time_table: objectid: "[prefix]:Timetable:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character" placeholders: @@ -165,7 +165,7 @@ fr: tag_search: "Etiquettes" tag_list: "Etiquettes" formtastic: - hints: + titles: time_table: 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'" placeholders: diff --git a/config/locales/vehicle_journeys.yml b/config/locales/vehicle_journeys.yml index 01a59217a..0e1b5ad34 100644 --- a/config/locales/vehicle_journeys.yml +++ b/config/locales/vehicle_journeys.yml @@ -60,6 +60,7 @@ en: time_tables: "Calendars" time_slot: "Time Slot" company: "Company" + number: "Number" comment: "Comments" status_value: "Status Value" transport_mode_name: "Transport Mode" @@ -86,7 +87,7 @@ en: vehicle_journey: invalid_times: "Invalid times" formtastic: - hints: + titles: vehicle_journey: objectid: "[prefix]:VehicleJourney:[unique_key] : prefix contains only alphanumerical or underscore characters, unique_key accepts also minus character" @@ -151,6 +152,7 @@ fr: time_tables: "Calendriers" time_slot: "Fréquence" company: "Transporteur" + number: "Numéro" comment: "Commentaires" status_value: "Etat de trafic" transport_mode_name: "Mode de transport" @@ -177,7 +179,7 @@ fr: vehicle_journey: invalid_times: "Horaires invalides" formtastic: - hints: + 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'" diff --git a/config/locales/vehicle_translations.yml b/config/locales/vehicle_translations.yml index 3d1e0b702..9c413f2b3 100644 --- a/config/locales/vehicle_translations.yml +++ b/config/locales/vehicle_translations.yml @@ -2,18 +2,39 @@ en: vehicle_translations: success: "%{count} vehicle journeys created by translation" failure: "Fail when creating vehicle journeys by translation" - activemodel: + first_stop_arrival_time: "Arrival time at first stop (%{stop_name})" + first_stop_departure_time: "Arrival time at first stop (%{stop_name})" + translate_form: + multiple_cloning_form: "Repeat cloning based on a time interval" + activemodel: attributes: vehicle_translation: duration: "Duration" count: "Count" + errors: + models: + vehicle_translation: + missing_start_time: "Departure time or arrival time is required." + uncompiliant_vehicle: "Vehicle creation by copy requires that the selected vehicle counts at leat a stop and has departure and arrival times at each stops" + unreadable_time: "Expected time format is hh:mm" fr: vehicle_translations: success: "%{count} course(s) crée(s) par translation" failure: "Echec de la création de courses par tanslation" - activemodel: + first_stop_arrival_time: "Horaire d'arrivée au premier arrêt (%{stop_name})" + first_stop_departure_time: "Horaire de départ au premier arrêt (%{stop_name})" + translate_form: + multiple_cloning_form: "Répéter le clonage à intervalle régulier" + + activemodel: attributes: vehicle_translation: duration: "Durée de l'intervalle (en minutes)" count: "Quantité de courses à ajouter" + errors: + models: + vehicle_translation: + missing_start_time: "L'horaire de départ ou celui d'arrivée est requis" + uncompiliant_vehicle: "Pour cloner une course, celle-ci doit compter au moins un arrêt et avoir des horaires départ arrivée sur tous ses arrêts" + unreadable_time: "Le format d'horaire attendu est hh:mm" diff --git a/spec/models/vehicle_translation_spec.rb b/spec/models/vehicle_translation_spec.rb index 2a9c53371..47be9ff3a 100644 --- a/spec/models/vehicle_translation_spec.rb +++ b/spec/models/vehicle_translation_spec.rb @@ -3,15 +3,17 @@ require 'spec_helper' describe VehicleTranslation do let!(:company){ Factory(:company )} let!(:journey_pattern){Factory(:journey_pattern)} - let!(:vehicle_journey){ Factory(:vehicle_journey, + let!(:vehicle_journey){ Factory(:vehicle_journey, :objectid => "dummy", :journey_pattern => journey_pattern, :route => journey_pattern.route, :company => company, - :transport_mode => Chouette::TransportMode.new("metro"), + :transport_mode => Chouette::TransportMode.new("metro"), :published_journey_name => "dummy" )} - subject {Factory.build(:vehicle_translation, :vehicle_journey_id => vehicle_journey.id)} + subject {Factory.build(:vehicle_translation, + :vehicle_journey_id => vehicle_journey.id, + :first_stop_departure_time => "12:00")} describe "#translate" do it "should add new vehicle" do @@ -29,19 +31,19 @@ describe VehicleTranslation do end it "should add vehicle having same transport_mode" do subject.translate - last_created_vehicle.transport_mode.should == vehicle_journey.transport_mode + last_created_vehicle.transport_mode.should == vehicle_journey.transport_mode end it "should add vehicle having same journey_pattern" do subject.translate - last_created_vehicle.journey_pattern.should == vehicle_journey.journey_pattern + last_created_vehicle.journey_pattern.should == vehicle_journey.journey_pattern end it "should add vehicle having same route" do subject.translate - last_created_vehicle.route.should == vehicle_journey.route + last_created_vehicle.route.should == vehicle_journey.route end it "should add vehicle having same company" do subject.translate - last_created_vehicle.company.should == vehicle_journey.company + last_created_vehicle.company.should == vehicle_journey.company end it "should add vehicle with as many vehicle_journey_at_stops as on basic vehicle" do subject.translate |
