af83/chouette-core

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

Summary

Maintainability
Test Coverage
- breadcrumb :contracts, @workbench

.page_content
  .container-fluid
    .row
      .col-lg-12
        / = render 'filters'
    - if @contracts.any?
      .row
        .col-lg-12
          = table_builder_2 @contracts,
            [ \
              TableBuilderHelper::Column.new( \
                key: :name, \
                attribute: :name, \
                link_to: -> (contract) { workbench_contract_path(@workbench, contract) } \
                            ), \
              TableBuilderHelper::Column.new( \
                key: :company_id, \
                attribute: Proc.new {|contract| contract.company&.name}, \
                link_to: -> (contract) { workbench_line_referential_company_path(@workbench, contract.company) } \
                            ), \
              TableBuilderHelper::Column.new( \
                key: :lines, \
                attribute: Proc.new { |zone| zone.lines.map(&:name).join(", ").truncate(100) }, \
                sortable: false, \
              ), \
            ].compact,
            cls: 'table has-filter has-search'

          = new_pagination @contracts, 'pull-right'

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