af83/chouette-core

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

Summary

Maintainability
Test Coverage
- breadcrumb :exports, @parent

.page_content
  .container-fluid
    .row
      .col-lg-12
        = render 'filters'
    - if @exports.any?
      .row
        .col-lg-12
          = table_builder_2 @exports,
            [ \
              TableBuilderHelper::Column.new( \
                key: :status, \
                attribute: Proc.new { |n| operation_status(n.status, verbose: true) }, \
              ), \
              TableBuilderHelper::Column.new( \
                key: :name, \
                attribute: 'name', \
                link_to: lambda do |export| \
                  [@parent, export] \
                end, \
                sortable: false,\
                ), \
              TableBuilderHelper::Column.new( \
                key: :type, \
                attribute: Proc.new { |n| n.object.class.human_name }, \
              ), \
              TableBuilderHelper::Column.new( \
                key: :referential, \
                attribute: Proc.new { |n| \
                  if n.referential.present? then \
                    link_to(n.referential.name, workbench_referential_path(@workbench, n.referential)) \
                  else \
                    "-" \
                  end \
                }, \
              ), \
              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: :creator, \
                attribute: 'creator' \
              ) \
            ],
            cls: 'table has-search'

          = new_pagination @exports, 'pull-right'

    - else
      .row.mt-xs
        .col-lg-12
          = replacement_msg t('exports.search_no_results')