af83/chouette-core

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

Summary

Maintainability
Test Coverage
- breadcrumb :lines, @workbench
- javascript_additional_packs 'lines/index'

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

    - if @lines.any?
      .row
        .col-lg-12
          = table_builder_2 @lines,
            [ \
              TableBuilderHelper::Column.new( \
                name: t('id_codif'), \
                attribute: Proc.new { |n| n.get_objectid.short_id }, \
                sortable: false \
              ), \
              TableBuilderHelper::Column.new( \
                key: :number, \
                attribute: 'number' \
              ), \
              TableBuilderHelper::Column.new( \
                key: :registration_number, \
                attribute: 'registration_number' \
              ), \
              TableBuilderHelper::Column.new( \
                key: :name, \
                attribute: 'name', \
                link_to: lambda do |line| \
                  workbench_line_referential_line_path(@workbench, line) \
                end \
              ), \
              TableBuilderHelper::Column.new( \
                key: :deactivated, \
                name: Chouette::Line.tmf(:status), \
                class: :state, \
                attribute: Proc.new { |n| line_status(n) } \
              ), \
              TableBuilderHelper::Column.new( \
                key: 'network', \
                attribute: Proc.new { |n| n&.network&.name }, \
              ), \
              TableBuilderHelper::Column.new( \
                key: 'company', \
                attribute: Proc.new { |n| n&.company&.name || "-" }, \
              ), \
              TableBuilderHelper::Column.new( \
                key: :transport_mode, \
                attribute: Proc.new { |n| n.transport_mode.present? ? t("enumerize.transport_mode.#{n.try(:transport_mode)}") : "-" } \
              ), \
              TableBuilderHelper::Column.new( \
                key: :transport_submode, \
                attribute: Proc.new { |n| n.transport_submode.present? ? t("enumerize.transport_submode.#{n.try(:transport_submode)}") : "-" } \
              ) \
            ],
            cls: 'table has-filter has-search'

          = new_pagination @lines, 'pull-right'

    - unless @lines.any?
      .row.mt-xs
        .col-lg-12
          = replacement_msg 'referential_lines.search_no_results'.t