af83/chouette-core

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

Summary

Maintainability
Test Coverage
- breadcrumb :workgroup_control_list_runs, @workgroup

.page_content
  .container-fluid
    .row
      .col-lg-12
        = render 'filters'

    - if @control_list_runs.any?
      .row
        .col-lg-12
          = table_builder_2 @control_list_runs,
            [ \
                            TableBuilderHelper::Column.new( \
                key: :user_status, \
                attribute: Proc.new { |control_list_run| operation_user_status(control_list_run) }, \
              ), \
              TableBuilderHelper::Column.new( \
                key: :name, \
                attribute: :name, \
                link_to: lambda do |control_list_run| \
                workgroup_control_list_run_path( \
                    @workgroup, \
                    control_list_run \
                  ) \
                end \
              ), \
              TableBuilderHelper::Column.new( \
                key: :referential_id, \
                attribute: Proc.new { |m| m.referential.name }, \
                                if: Proc.new { |m| m.referential }, \
                sortable: false \
              ), \
              TableBuilderHelper::Column.new( \
                key: :started_at, \
                attribute: Proc.new { |n| l(n.started_at, format: :short_with_time) if n.started_at }, \
              ), \
              TableBuilderHelper::Column.new( \
                key: :duration, \
                attribute: Proc.new { |object| object.ended_at.presence && object.started_at.presence && duration_in_words(object.ended_at - object.started_at)}, \
                sortable: false,\
              ), \
              TableBuilderHelper::Column.new( \
                key: :workbench, \
                attribute: Proc.new { |control_list_run| control_list_run.workbench.name }, \
                sortable: false,\
              ), \
              TableBuilderHelper::Column.new( \
                key: :created_by, \
                attribute: :creator, \
                sortable: false,\
              ) \
              \
            ].compact,
            cls: 'table has-filter has-search'

          = new_pagination @control_list_runs, 'pull-right'

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