diff options
Diffstat (limited to 'app')
| -rw-r--r-- | app/helpers/referentials_helper.rb | 15 | ||||
| -rw-r--r-- | app/models/chouette/line.rb | 4 | ||||
| -rw-r--r-- | app/views/lines/_filters.html.slim | 10 | ||||
| -rw-r--r-- | app/views/lines/index.html.slim | 4 | ||||
| -rw-r--r-- | app/views/referentials/show.html.slim | 4 | ||||
| -rw-r--r-- | app/views/stop_areas/_filters.html.slim | 2 | ||||
| -rw-r--r-- | app/views/stop_areas/index.html.slim | 2 | ||||
| -rw-r--r-- | app/views/stop_areas/show.html.slim | 20 | 
8 files changed, 32 insertions, 29 deletions
| diff --git a/app/helpers/referentials_helper.rb b/app/helpers/referentials_helper.rb index a01d901e6..9b5b13ace 100644 --- a/app/helpers/referentials_helper.rb +++ b/app/helpers/referentials_helper.rb @@ -1,15 +1,14 @@  module ReferentialsHelper    # Outputs a green check icon and the text "Oui" or a red exclamation mark    # icon and the text "Non" based on `status` -  def line_status(status, verbose=true) -     if status -      out = content_tag(:span, nil, class: 'fa fa-exclamation-circle fa-lg text-danger') -      out += t('activerecord.attributes.line.deactivated') if verbose -      out +  def line_status(status) +    case status +    when :deactivated +      content_tag(:span, nil, class: 'fa fa-exclamation-circle fa-lg text-danger') + +      Chouette::Line.tmf('deactivated')      else -      out = content_tag(:span, nil, class: 'fa fa-check-circle fa-lg text-success') -      out += t('activerecord.attributes.line.activated') if verbose -      out +      content_tag(:span, nil, class: 'fa fa-check-circle fa-lg text-success') + +      Chouette::Line.tmf('activated')      end    end diff --git a/app/models/chouette/line.rb b/app/models/chouette/line.rb index 4b5d1a68d..3ef2d8e1d 100644 --- a/app/models/chouette/line.rb +++ b/app/models/chouette/line.rb @@ -114,5 +114,9 @@ module Chouette      def activated?        !deactivated      end + +    def status +      activated? ? :activated : :deactivated +    end    end  end diff --git a/app/views/lines/_filters.html.slim b/app/views/lines/_filters.html.slim index f745d10a4..992d163fe 100644 --- a/app/views/lines/_filters.html.slim +++ b/app/views/lines/_filters.html.slim @@ -8,23 +8,23 @@    .ffg-row      .form-group.togglable class=filter_item_class(params[:q], :network_id_eq_any) -      = f.label Chouette::Line.human_attribute_name(:network_id), required: false, class: 'control-label' +      = f.label Chouette::Line.tmf(: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 class=filter_item_class(params[:q], :company_id_eq_any) -      = f.label Chouette::Line.human_attribute_name(:company_id), required: false, class: 'control-label' +      = f.label Chouette::Line.tmf(: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 class=filter_item_class(params[:q], :transport_mode_eq_any) -      = f.label Chouette::Line.human_attribute_name(:transport_mode), required: false, class: 'control-label' +      = f.label Chouette::Line.tmf(:transport_mode), required: false, class: 'control-label'        = f.input :transport_mode_eq_any, collection: StifTransportModeEnumerations.sorted_transport_modes, as: :check_boxes, label: false, label_method: lambda{|l| ("<span>" + t("enumerize.transport_mode.#{l}") + "</span>").html_safe}, required: false, wrapper_html: { class: 'checkbox_list'}      .form-group.togglable class=filter_item_class(params[:q], :transport_submode_eq_any) -      = f.label Chouette::Line.human_attribute_name(:transport_submode), required: false, class: 'control-label' +      = f.label Chouette::Line.tmf(:transport_submode), required: false, class: 'control-label'        = f.input :transport_submode_eq_any, collection: StifTransportSubmodeEnumerations.sorted_transport_submodes, as: :check_boxes, label: false, label_method: lambda{|l| ("<span>" + t("enumerize.transport_submode.#{l}") + "</span>").html_safe}, required: false, wrapper_html: { class: 'checkbox_list'}      .form-group.togglable class=filter_item_class(params[:q], :status) -      = f.label Chouette::Line.human_attribute_name(:state), required: false, class: 'control-label' +      = f.label Chouette::Line.tmf(:status), required: false, class: 'control-label'        .form-group.checkbox_list          = f.simple_fields_for :status do |p|            = p.input :activated, diff --git a/app/views/lines/index.html.slim b/app/views/lines/index.html.slim index 4d4ba938d..02bb5ec6e 100644 --- a/app/views/lines/index.html.slim +++ b/app/views/lines/index.html.slim @@ -29,9 +29,9 @@                  end \                ), \                TableBuilderHelper::Column.new( \ -                name: t('activerecord.attributes.line.state'), \ +                key: :status, \                  class: :state, \ -                attribute: Proc.new { |n| line_status(n.deactivated) } \ +                attribute: Proc.new { |n| line_status(n.status) } \                ), \                TableBuilderHelper::Column.new( \                  key: 'networks.name', \ diff --git a/app/views/referentials/show.html.slim b/app/views/referentials/show.html.slim index b2a079ab4..3cdcff63b 100644 --- a/app/views/referentials/show.html.slim +++ b/app/views/referentials/show.html.slim @@ -40,8 +40,8 @@                  end \                ), \                TableBuilderHelper::Column.new( \ -                key: :state, \ -                attribute: Proc.new { |n| line_status(n.deactivated?) } \ +                key: :status, \ +                attribute: Proc.new { |n| line_status(n.status) } \                ), \                TableBuilderHelper::Column.new( \                  key: :transport_mode, \ diff --git a/app/views/stop_areas/_filters.html.slim b/app/views/stop_areas/_filters.html.slim index c698eaaa5..caa264d5e 100644 --- a/app/views/stop_areas/_filters.html.slim +++ b/app/views/stop_areas/_filters.html.slim @@ -15,7 +15,7 @@        = f.input :area_type_eq_any, checked: params[:q] && params[:q][:area_type_eq_any], collection: Chouette::AreaType.options, as: :check_boxes, label: false, label_method: lambda{|w| ("<span>" + w[0] + "</span>").html_safe}, required: false, wrapper_html: { class: 'checkbox_list' }      .form-group.togglable class=filter_item_class(params[:q], :status) -      = f.label Chouette::StopArea.human_attribute_name(:state), required: false, class: 'control-label' +      = f.label Chouette::StopArea.tmf('status'), required: false, class: 'control-label'        .form-group.checkbox_list          = f.simple_fields_for :status do |p|            = p.input :in_creation, diff --git a/app/views/stop_areas/index.html.slim b/app/views/stop_areas/index.html.slim index fbdb54e02..81a0cf26f 100644 --- a/app/views/stop_areas/index.html.slim +++ b/app/views/stop_areas/index.html.slim @@ -32,7 +32,7 @@                  attribute: 'registration_number' \                ), \                TableBuilderHelper::Column.new( \ -                name: Chouette::StopArea.tmf('state'), \ +                name: Chouette::StopArea.tmf('status'), \                  attribute: Proc.new { |s| stop_area_status(s) } \                ), \                TableBuilderHelper::Column.new( \ diff --git a/app/views/stop_areas/show.html.slim b/app/views/stop_areas/show.html.slim index 851bd9b82..c4d06f61d 100644 --- a/app/views/stop_areas/show.html.slim +++ b/app/views/stop_areas/show.html.slim @@ -10,18 +10,18 @@          - if has_feature?(:stop_area_localized_names)            - @stop_area.localized_names.each do |k, v| -            - attributes.merge!({label_for_country(k, @stop_area.human_attribute_name(:name)) => v }) if v.present? -        - attributes.merge!({ @stop_area.human_attribute_name(:parent) => @stop_area.parent ? link_to(@stop_area.parent.name, stop_area_referential_stop_area_path(@stop_area_referential, @stop_area.parent)) : "-" }) if @stop_area.commercial? -        - attributes.merge!({ @stop_area.human_attribute_name(:stop_area_type) => Chouette::AreaType.find(@stop_area.area_type).try(:label), -            @stop_area.human_attribute_name(:registration_number) => @stop_area.registration_number, +            - attributes.merge!({label_for_country(k, Chouette::StopArea.tmf('name')) => v }) if v.present? +        - attributes.merge!({ Chouette::StopArea.tmf('parent') => @stop_area.parent ? link_to(@stop_area.parent.name, stop_area_referential_stop_area_path(@stop_area_referential, @stop_area.parent)) : "-" }) if @stop_area.commercial? +        - attributes.merge!({ Chouette::StopArea.tmf('stop_area_type') => Chouette::AreaType.find(@stop_area.area_type).try(:label), +            Chouette::StopArea.tmf('registration_number') => @stop_area.registration_number,              }) -        - attributes.merge!(@stop_area.human_attribute_name(:waiting_time) => @stop_area.waiting_time_text) if has_feature?(:stop_area_waiting_time) +        - attributes.merge!(Chouette::StopArea.tmf('waiting_time') => @stop_area.waiting_time_text) if has_feature?(:stop_area_waiting_time)          - attributes.merge!({ "Coordonnées" => geo_data(@stop_area, @stop_area_referential), -            @stop_area.human_attribute_name(:zip_code) => @stop_area.zip_code, -            @stop_area.human_attribute_name(:city_name) => @stop_area.city_name, -            @stop_area.human_attribute_name(:country_code) => @stop_area.country_code.presence || '-', -            t('activerecord.attributes.stop_area.state') => stop_area_status(@stop_area), -            @stop_area.human_attribute_name(:comment) => @stop_area.try(:comment), +            Chouette::StopArea.tmf('zip_code') => @stop_area.zip_code, +            Chouette::StopArea.tmf('city_name') => @stop_area.city_name, +            Chouette::StopArea.tmf('country_code') => @stop_area.country_code.presence || '-', +            Chouette::StopArea.tmf('status') => stop_area_status(@stop_area), +            Chouette::StopArea.tmf('comment') => @stop_area.try(:comment),              })          - @stop_area.custom_fields.each do |code, field|            - attributes.merge!(field.name => field.display_value) | 
