diff options
| -rw-r--r-- | app/controllers/stop_areas_controller.rb | 12 | ||||
| -rw-r--r-- | app/helpers/networks_helper.rb | 7 | ||||
| -rw-r--r-- | app/models/chouette/network.rb | 13 | ||||
| -rw-r--r-- | app/views/lines/_filters.html.slim | 4 | ||||
| -rw-r--r-- | app/views/lines/show.html.slim | 4 | ||||
| -rw-r--r-- | app/views/networks/_form.html.slim | 2 | ||||
| -rw-r--r-- | app/views/stop_areas/_form.html.slim | 62 | ||||
| -rw-r--r-- | config/locales/enumerize.en.yml | 12 | ||||
| -rw-r--r-- | config/locales/enumerize.fr.yml | 11 | ||||
| -rw-r--r-- | config/locales/lines.en.yml | 4 | ||||
| -rw-r--r-- | config/locales/lines.fr.yml | 4 | ||||
| -rw-r--r-- | config/locales/source_types.en.yml | 13 | ||||
| -rw-r--r-- | config/locales/source_types.fr.yml | 13 |
13 files changed, 53 insertions, 108 deletions
diff --git a/app/controllers/stop_areas_controller.rb b/app/controllers/stop_areas_controller.rb index 1d6f88068..0357878ec 100644 --- a/app/controllers/stop_areas_controller.rb +++ b/app/controllers/stop_areas_controller.rb @@ -64,22 +64,22 @@ class StopAreasController < InheritedResources::Base def new authorize resource_class - @map = StopAreaMap.new( Chouette::StopArea.new).with_helpers(self) - @map.editable = true + # @map = StopAreaMap.new( Chouette::StopArea.new).with_helpers(self) + # @map.editable = true new! end def create authorize resource_class - @map = StopAreaMap.new( Chouette::StopArea.new).with_helpers(self) - @map.editable = true + # @map = StopAreaMap.new( Chouette::StopArea.new).with_helpers(self) + # @map.editable = true create! end def show - map.editable = false - @access_points = @stop_area.access_points + # map.editable = false + # @access_points = @stop_area.access_points show! do |format| unless stop_area.position or params[:default] or params[:routing] format.kml { diff --git a/app/helpers/networks_helper.rb b/app/helpers/networks_helper.rb deleted file mode 100644 index b881ce078..000000000 --- a/app/helpers/networks_helper.rb +++ /dev/null @@ -1,7 +0,0 @@ -module NetworksHelper - - def source_type_name_label_pairs - Chouette::Network.source_type_names - .zip_map { |source_type_name| t("source_types.label.#{source_type_name}") } - end -end diff --git a/app/models/chouette/network.rb b/app/models/chouette/network.rb index 3f07ebe0c..f0a79ec13 100644 --- a/app/models/chouette/network.rb +++ b/app/models/chouette/network.rb @@ -3,6 +3,7 @@ module Chouette include NetworkRestrictions include LineReferentialSupport include ObjectidSupport + extend Enumerize # FIXME http://jira.codehaus.org/browse/JRUBY-6358 self.primary_key = "id" @@ -10,6 +11,16 @@ module Chouette attr_accessor :source_type_name + enumerize :source_type_name, in: %w(public_and_private_utilities + road_authorities + transit_operator + public_transport + passenger_transport_coordinating_authority + travel_information_service_provider + travel_agency + individual_subject_of_travel_itinerary + other_information) + validates_format_of :registration_number, :with => %r{\A[0-9A-Za-z_-]+\Z}, :allow_nil => true, :allow_blank => true validates_presence_of :name @@ -47,4 +58,4 @@ module Chouette end -end
\ No newline at end of file +end diff --git a/app/views/lines/_filters.html.slim b/app/views/lines/_filters.html.slim index 58f8f2431..e3674656a 100644 --- a/app/views/lines/_filters.html.slim +++ b/app/views/lines/_filters.html.slim @@ -8,11 +8,11 @@ .ffg-row .form-group.togglable - = f.label Chouette::Line.human_attribute_name(:network), required: false, class: 'control-label' + = f.label Chouette::Line.human_attribute_name(:network_id), required: false, class: 'control-label' = f.input :network_id_eq_any, collection: @line_referential.networks.order(name: :asc), as: :check_boxes, label: false, label_method: lambda{|l| ("<span>" + l.name + "</span>").html_safe}, required: false, wrapper_html: { class: 'checkbox_list'} .form-group.togglable - = f.label Chouette::Line.human_attribute_name(:company), required: false, class: 'control-label' + = f.label Chouette::Line.human_attribute_name(:company_id), required: false, class: 'control-label' = f.input :company_id_eq_any, collection: @line_referential.companies.order(name: :asc), as: :check_boxes, label: false, label_method: lambda{|l| ("<span>" + l.name + "</span>").html_safe}, required: false, wrapper_html: { class: 'checkbox_list'} .form-group.togglable diff --git a/app/views/lines/show.html.slim b/app/views/lines/show.html.slim index ccf237154..4d7b1a195 100644 --- a/app/views/lines/show.html.slim +++ b/app/views/lines/show.html.slim @@ -23,8 +23,8 @@ = definition_list t('metadatas'), { 'ID Codif' => @line.get_objectid.short_id, 'Activé' => (@line.deactivated? ? t('false') : t('true')), - @line.human_attribute_name(:network) => (@line.network.nil? ? t('lines.index.unset') : @line.network.name), - @line.human_attribute_name(:company) => (@line.company.nil? ? t('lines.index.unset') : @line.company.name), + @line.human_attribute_name(:network_id) => (@line.network.nil? ? t('lines.index.unset') : @line.network.name), + @line.human_attribute_name(:company_id) => (@line.company.nil? ? t('lines.index.unset') : @line.company.name), 'Transporteur(s) secondaire(s)' => (@line.secondary_companies.nil? ? t('lines.index.unset') : @line.secondary_companies.collect(&:name).join(', ')), 'Nom court' => @line.number, 'Code public' => (@line.registration_number ? @line.registration_number : '-'), diff --git a/app/views/networks/_form.html.slim b/app/views/networks/_form.html.slim index 6ee2a4512..362584f97 100644 --- a/app/views/networks/_form.html.slim +++ b/app/views/networks/_form.html.slim @@ -7,7 +7,7 @@ = f.input :version_date, :label_html => { :class => 'string optional col-sm-4 col-xs-5 control-label' }, :wrapper => :multi_select_inline = f.input :description = f.input :source_name - = f.input :source_type_name, as: :select, :collection => source_type_name_label_pairs, :include_blank => true + = f.input :source_type_name, as: :select, :collection => Chouette::Network.source_type_name.options, :include_blank => true = f.input :source_identifier .separator diff --git a/app/views/stop_areas/_form.html.slim b/app/views/stop_areas/_form.html.slim index b055113a9..20c7c0468 100644 --- a/app/views/stop_areas/_form.html.slim +++ b/app/views/stop_areas/_form.html.slim @@ -1,68 +1,12 @@ -/= semantic_form_for [@stop_area_referential, @stop_area] do |form| -/ .row -/ .container-fluid -/ - if !manage_itl && @map -/ = @map.to_html -/ -/ = form.inputs do -/ = 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.area_type.options, :include_blank => false -/ -/ .location_info -/ h3 = t("stop_areas.stop_area.localisation") -/ -/ #prefetch -/ label = t('.geolocalize') -/ input.typeahead.form-control.input-lg maxlength="255" type="text" placeholder="#{t('.address')}" -/ -/ - unless @stop_area.projection.blank? or @stop_area.projection_type_label.empty? -/ = form.input :projection_xy, :label => t("activerecord.attributes.stop_area.projection_xy", :projection => @referential.projection_type_label), :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.stop_area.projection_xy")} -/ -/ = 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, required: format_restriction_for_locales(@referential) == '.hub' -/ = form.input :zip_code, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.stop_area.zip_code")} -/ = form.input :city_name, required: format_restriction_for_locales(@referential) == '.hub', :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.stop_area.city_name")} -/ -/ .stop_areas.stop_area.general_info -/ h3 = t("stop_areas.stop_area.general") -/ -/ = form.inputs do -/ = form.input :registration_number, required: format_restriction_for_locales(@referential) == '.hub', :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, :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 -/ -/ .pmr_info -/ h3 = t("stop_areas.stop_area.accessibility") -/ = form.inputs do -/ - if !manage_itl -/ = form.input :mobility_restricted_suitability, as: :select, :collection => [[t("true"), true], [t("false"), false]], :include_blank => true -/ = form.input :stairs_availability, as: :select, :collection => [[t("true"), true], [t("false"), false]], :include_blank => true -/ = form.input :lift_availability, as: :select, :collection => [[t("true"), true], [t("false"), false]], :include_blank => true -/ -/ = form.actions do -/ = form.action :submit, as: :button -/ = form.action :cancel, as: :link - - = simple_form_for [@stop_area_referential, @stop_area], html: {class: 'form-horizontal', id: 'stop_area_form'}, wrapper: :horizontal_form do |f| .row .col-lg-12 - - if !manage_itl && @map + /- if !manage_itl && @map + - if !manage_itl /= @map.to_html = f.input :id, as: :hidden = f.input :name, :input_html => {:title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.stop_area.name")} - = f.input :area_type, as: :select, :input_html => {:disabled => !@stop_area.new_record?}, :collection => Chouette::StopArea.area_type.values, :include_blank => false - = f.input :registration_number, required: format_restriction_for_locales(@referential) == '.hub', :input_html => {:title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.stop_area.registration_number")} - = f.input :fare_code - = f.input :nearest_topic_name, :input_html => {:title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.stop_area.nearest_topic_name")} - = f.input :comment, as: :text, :input_html => {:rows => 5, :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.stop_area.comment")} - = f.input :time_zone, :include_blank => true - = f.input :url + = f.input :area_type, as: :select, :input_html => {:disabled => !@stop_area.new_record?}, :collection => Chouette::StopArea.area_type.options, :include_blank => false .location_info h3 = t("stop_areas.stop_area.localisation") diff --git a/config/locales/enumerize.en.yml b/config/locales/enumerize.en.yml index f5e51171b..bfd7b8c22 100644 --- a/config/locales/enumerize.en.yml +++ b/config/locales/enumerize.en.yml @@ -244,3 +244,15 @@ en: streetCableCar: 'Street cable car' allFunicularServices: 'All funicular services' undefinedFunicular: 'Undefined funicular' + source_type_name: + name: "Source types" + public_and_private_utilities: "Public and private utilities" + road_authorities: "Road authorities" + transit_operator: "Transit operator" + public_transport: "Public transport" + passenger_transport_coordinating_authority: "Passenger transport coordinating authority" + travel_information_service_provider: "Travel information service provider" + travel_agency: "Travel_agency" + individual_subject_of_travel_itinerary: "Individual subject of travel itinerary" + other_information: "Other information" + diff --git a/config/locales/enumerize.fr.yml b/config/locales/enumerize.fr.yml index a5845971b..b2eab665d 100644 --- a/config/locales/enumerize.fr.yml +++ b/config/locales/enumerize.fr.yml @@ -242,3 +242,14 @@ fr: streetCableCar: 'Tramway (2)' allFunicularServices: 'Tous services de funiculaire' undefinedFunicular: 'Funiculaire non défini' + source_type_name: + name: "Type de source" + public_and_private_utilities: "Service public ou privé" + road_authorities: "Autorité routière" + transit_operator: "Exploitant de transport public" + public_transport: "Transport public" + passenger_transport_coordinating_authority: "Autorité organisatrice de transport public" + travel_information_service_provider: "Opérateur de voyage (voyagiste/tour operator ...)" + travel_agency: "Agence de voyage" + individual_subject_of_travel_itinerary: "Voyageur individuel" + other_information: "Autre source d'information" diff --git a/config/locales/lines.en.yml b/config/locales/lines.en.yml index 15e08290d..7df75052a 100644 --- a/config/locales/lines.en.yml +++ b/config/locales/lines.en.yml @@ -62,10 +62,10 @@ en: attributes: line: id: "ID" - network: "Network" + network_id: "Network" networks: name: "Network" - company: "Company" + company_id: "Company" companies: name: "Company" registration_number: "Registration number" diff --git a/config/locales/lines.fr.yml b/config/locales/lines.fr.yml index c459eb51b..728598ec9 100644 --- a/config/locales/lines.fr.yml +++ b/config/locales/lines.fr.yml @@ -63,10 +63,10 @@ fr: attributes: line: id: "ID" - network: "Réseau" + network_id: "Réseau" networks: name: "Réseau" - company: "Transporteur principal" + company_id: "Transporteur principal" companies: name: "Transporteur principal" registration_number: "Nom court" diff --git a/config/locales/source_types.en.yml b/config/locales/source_types.en.yml deleted file mode 100644 index 1cea5ed2c..000000000 --- a/config/locales/source_types.en.yml +++ /dev/null @@ -1,13 +0,0 @@ -en: - source_types: - name: "Source type" - label: - public_and_private_utilities: "public and private utilities" - road_authorities: "road authorities" - transit_operator: "transit operator" - public_transport: "public transport" - passenger_transport_coordinating_authority: "passenger transport coordinating authority" - travel_information_service_provider: "travel information service provider" - travel_agency: "travel_agency" - individual_subject_of_travel_itinerary: "individual subject of travel itinerary" - other_information: "other information" diff --git a/config/locales/source_types.fr.yml b/config/locales/source_types.fr.yml deleted file mode 100644 index 6979a14b7..000000000 --- a/config/locales/source_types.fr.yml +++ /dev/null @@ -1,13 +0,0 @@ -fr: - source_types: - name: "Type de source" - label: - public_and_private_utilities: "Service public ou privé" - road_authorities: "Autorité routière" - transit_operator: "Exploitant de transport public" - public_transport: "Transport public" - passenger_transport_coordinating_authority: "Autorité organisatrice de transport public" - travel_information_service_provider: "Opérateur de voyage (voyagiste/tour operator ...)" - travel_agency: "Agence de voyage" - individual_subject_of_travel_itinerary: "Voyageur individuel" - other_information: "Autre source d'information" |
