af83/chouette-core

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

Summary

Maintainability
Test Coverage
- breadcrumb :stop_area_groups, @workbench

.page_content x-data="{ saveSearchPanel: false }"
  .container-fluid
    .row
      .col-lg-12
          = render 'filters'

    - if @stop_area_groups.any?
      .row
        .col-lg-12
          = table_builder_2 @stop_area_groups,
            [ \
              TableBuilderHelper::Column.new( \
                key: :name, \
                attribute: :name, \
                sortable: false, \
                link_to: lambda do |stop_area_group| \
                workbench_stop_area_referential_stop_area_group_path( \
                    @workbench, \
                    stop_area_group \
                  ) \
                end \
              ), \
              TableBuilderHelper::Column.new( \
                key: :description, \
                attribute: Proc.new { |stop_area_group| stop_area_group.description&.truncate(100) }, \
                sortable: false, \
              ), \
              TableBuilderHelper::Column.new( \
                key: :count, \
                attribute: Proc.new { |stop_area_group| stop_area_group.stop_area_ids.count }, \
                sortable: false \
              ), \
              TableBuilderHelper::Column.new( \
                key: :stop_areas, \
                attribute: Proc.new { |stop_area_group| stop_area_group.stop_areas.map(&:name).join(", ").truncate(100) }, \
                sortable: false, \
              ), \
            ].compact,
            cls: 'table has-filter has-search'

          = new_pagination @stop_area_groups, 'pull-right'

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