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 /app | |
| parent | 0d5adf2fad5c0ddd8efc1eca9dc6d8e9c48b049d (diff) | |
| parent | a5f66f953120c08951b6338ad0f743c2d0eec86e (diff) | |
| download | chouette-core-05fb2b7aa8ca7d490a8960a096de7d934fffe133.tar.bz2 | |
Solving merge V2_5 pbs
Diffstat (limited to 'app')
48 files changed, 395 insertions, 174 deletions
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> |
