af83/chouette-core

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

Summary

Maintainability
Test Coverage
- breadcrumb :imports, @parent

- if @parent.is_a? Workgroup
  - content_for(:page_header_title) { 'imports.workgroup_index.title'.t }

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

    - if @chart
      = @chart.to_chartkick(self, download: true)
    - elsif @imports.any?
      .row
        .col-lg-12
          = table_builder_2 @imports,
            [ \
              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 |import| \
                  [@parent, import] \
                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, \
              ), \
              *@contextual_cols \
            ],
            cls: 'table has-search'

          = new_pagination @imports, 'pull-right'
    - else
      .row.mt-xs
        .col-lg-12
          = replacement_msg t('imports.search_no_results')