af83/chouette-core

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

Summary

Maintainability
Test Coverage
- breadcrumb :macro_lists, @workbench

.page_content
  .container-fluid
    - if params[:q].present? or @macro_lists.any?
      .row
        .col-lg-12

    - if @macro_lists.any?
      .row
        .col-lg-12
          = table_builder_2 @macro_lists,
            [ \
              TableBuilderHelper::Column.new( \
                key: :name, \
                attribute: :name, \
                sortable: false, \
                link_to: lambda do |macro_list| \
                workbench_macro_list_path( \
                    @workbench, \
                    macro_list \
                  ) \
                end \
              ), \
              TableBuilderHelper::Column.new( \
                key: :comments, \
                attribute: ->(l){ truncate(l.comments, length: 150) }, \
                sortable: false \
              ), \
              TableBuilderHelper::Column.new( \
                name: ProcessingRule::Base.model_name.human(count: 2), \
                attribute: ->(p){ processing_rules_names(p.processing_rules) }, \
                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,\
              ) \
              \
            ].compact,
            cls: 'table has-filter has-search'

          = new_pagination @macro_lists, 'pull-right'

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