af83/chouette-core

View on GitHub
app/views/stop_areas/index.html.slim

Summary

Maintainability
Test Coverage
- breadcrumb :stop_areas, @workbench

.page_content x-data="{ saveSearchPanel: false, graphPanel: #{@search.graphical?} }"
  .container-fluid
    .row
      .col-lg-12
        = render partial: 'filters'

    - if @stop_areas.any?
      .row
        .col-lg-12
          = table_builder_2 @stop_areas,
            [ \
              TableBuilderHelper::Column.new( \
                name: t('id_reflex'), \
                attribute: Proc.new { |n| n.get_objectid.try(:short_id) }, \
                sortable: false \
              ), \
              TableBuilderHelper::Column.new( \
                key: :name, \
                attribute: 'name', \
                link_to: lambda do |stop_area| \
                  workbench_stop_area_referential_stop_area_path( \
                    @workbench, \
                    stop_area \
                  ) \
                end \
              ), \
              TableBuilderHelper::Column.new( \
                key: :registration_number, \
                attribute: 'registration_number' \
              ), \
              TableBuilderHelper::Column.new( \
                key: :status, \
                attribute: Proc.new { |s| stop_area_status(s.status) } \
              ), \
              TableBuilderHelper::Column.new( \
                key: :stop_area_provider, \
                attribute: Proc.new { |s| s.stop_area_provider&.name }, \
                link_to: lambda do |s| \
                  workbench_stop_area_referential_stop_area_provider_path(@workbench, s.stop_area_provider) \
                end, \
                sortable: false \
              ), \
              TableBuilderHelper::Column.new( \
                key: :zip_code, \
                attribute: 'zip_code' \
              ), \
              TableBuilderHelper::Column.new( \
                key: :city_name, \
                attribute: 'city_name' \
              ), \
              TableBuilderHelper::Column.new( \
                key: :area_type, \
                attribute: Proc.new { |s| Chouette::AreaType.find(s.area_type).try :label } \
              ), \
              TableBuilderHelper::Column.new( \
                key: :is_referent, \
                attribute: Proc.new { |s| t(s.is_referent) },
                sortable: false \
              ), \
            ].compact,
            cls: 'table has-filter has-search'

          = new_pagination @stop_areas, 'pull-right'

    - unless @stop_areas.any?
      .row.mt-xs
        .col-lg-12
          = replacement_msg t('stop_areas.search_no_results')