af83/chouette-core

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

Summary

Maintainability
Test Coverage
- breadcrumb :routing_constraint_zones, @workbench, @referential, @line

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

    - if @routing_constraint_zones.any?
      .row
        .col-lg-12
          = table_builder_2 @routing_constraint_zones,
            [ \
              TableBuilderHelper::Column.new( \
                name: t('objectid'), \
                attribute: Proc.new { |n| n.get_objectid.short_id }, \
                sortable: false \
              ), \
              TableBuilderHelper::Column.new( \
                key: :name, \
                attribute: 'name', \
                link_to: lambda do |routing_constraint_zone| \
                  workbench_referential_line_routing_constraint_zone_path( \
                    @workbench, \
                    @referential, \
                    @line, \
                    routing_constraint_zone \
                  ) \
                end \
              ), \
              TableBuilderHelper::Column.new( \
                key: :stop_points_count, \
                attribute: 'stop_points_count' \
              ), \
              TableBuilderHelper::Column.new( \
                key: :route, \
                attribute: 'route_name' \
              ), \
            ],
            links: [:show],
            cls: 'table has-filter has-search'
          
          = new_pagination @routing_constraint_zones, 'pull-right'

    - unless @routing_constraint_zones.any?
      .row.mt-xs
        .col-lg-12
          - if can_create_rcz?
            = replacement_msg t('.search_no_results')
          - else
            = replacement_msg t('.cannot_create')