af83/chouette-core

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

Summary

Maintainability
Test Coverage
- breadcrumb :entrances, @workbench

.page_content
  .container-fluid
    .row
      .col-lg-12
          = render 'filters'

    - if @entrances.any?
      .row
        .col-lg-12
          = table_builder_2 @entrances,
            [ \
              TableBuilderHelper::Column.new( \
                key: :objectid, \
                attribute: Proc.new { |n| n.get_objectid.try(:short_id) }, \
                sortable: false \
              ), \
              \
              TableBuilderHelper::Column.new( \
                key: :name, \
                attribute: :name, \
                sortable: false, \
                link_to: lambda do |entrance| \
                workbench_stop_area_referential_entrance_path( \
                    @workbench, \
                    entrance \
                  ) \
                end \
              ), \
              TableBuilderHelper::Column.new( \
                key: :stop_area, \
                attribute: Proc.new{|entrance| entrance.stop_area.name}, \
                sortable: false, \
                link_to: lambda do |entrance| \
                workbench_stop_area_referential_stop_area_path( \
                    @workbench, \
                    entrance.stop_area \
                  ) \
                end \
              ), \
              TableBuilderHelper::Column.new( \
                name: StopAreaProvider.model_name.human, \
                attribute: Proc.new{|entrance| entrance.stop_area_provider.name}, \
                sortable: false, \
                link_to: lambda do |entrance| \
                workbench_stop_area_referential_stop_area_provider_path( \
                    @workbench, \
                    entrance.stop_area_provider \
                  ) \
                end \
              ), \
              TableBuilderHelper::Column.new( \
                key: :zip_code, \
                attribute: :zip_code, \
                sortable: false \
              ), \
              TableBuilderHelper::Column.new( \
                key: :city_name, \
                attribute: :city_name, \
                sortable: false \
              ), \
              TableBuilderHelper::Column.new( \
                key: :entrance_type, \
                attribute: Proc.new{|entrance| entrance.entrance_type.text  if entrance.entrance_type}, \
                sortable: false \
              ), \
            ].compact,
            cls: 'table has-filter has-search'

          = new_pagination @entrances, 'pull-right'

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