af83/chouette-core

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

Summary

Maintainability
Test Coverage
- breadcrumb :line_routing_constraint_zones, @workbench

.page_content
  .container-fluid
  - if params[:q].present? or @line_routing_constraint_zones.any?
    .row
      .col-lg-12
        / = render partial: 'filters'

  - if @line_routing_constraint_zones.any?
    .row
      .col-lg-12
        = table_builder_2 @line_routing_constraint_zones,
          [ \
            TableBuilderHelper::Column.new( \
              key: :name, \
              attribute: :name, \
              sortable: false, \
              link_to: lambda do |line_routing_constraint_zones| \
              workbench_line_referential_line_routing_constraint_zone_path( \
                  @workbench, \
                  line_routing_constraint_zones \
                ) \
              end \
            ), \
            TableBuilderHelper::Column.new( \
              key: :lines, \
              attribute: Proc.new { |zone| zone.lines.map(&:name).join(", ").truncate(100) }, \
              sortable: false, \
            ), \
            TableBuilderHelper::Column.new( \
              key: :stop_areas, \
              attribute: Proc.new { |zone| zone.stop_areas.map(&:name).join(", ").truncate(100) }, \
              sortable: false, \
            ), \
            TableBuilderHelper::Column.new( \
                key: :created_at, \
                attribute: Proc.new { |n| l(n.created_at, format: :short_with_time) if n.created_at }, \
                sortable: false,\
              ), \
            TableBuilderHelper::Column.new( \
                key: :updated_at, \
                attribute: Proc.new { |n| l(n.updated_at, format: :short_with_time) if n.updated_at }, \
                sortable: false,\
              ), \
          ],\
          cls: 'table has-filter has-search'

        = new_pagination @line_routing_constraint_zones, 'pull-right'

  - else
    .row.mt-xs
      .col-lg-12
        = replacement_msg t('line_routing_constraint_zones.search_no_results')