af83/chouette-core

View on GitHub
app/views/workbench_outputs/show.html.slim

Summary

Maintainability
Test Coverage
/ PageHeader
- breadcrumb :workbench_output, @workbench
- content_for :page_header_title, t('.title')
- content_for :page_header_content do
  .row.mb-sm
    .col-lg-12.text-right
      = link_to t('.see_current_output'), workbench_referential_path(@workbench, @workbench.output.current), class: 'btn btn-primary' if @workbench.output&.current
      - if parent_policy.create?(Merge)
        = link_to t('merges.actions.create'), new_workbench_merge_path(@workbench), class: 'btn btn-primary'

.page_content
  .container-fluid
      .row
        .col-lg-12
          = table_builder_2 @workbench_merges,
            [ \
              TableBuilderHelper::Column.new( \
                key: :status, \
                attribute: Proc.new { |n| merge_status(n) }, \
              ), \
              TableBuilderHelper::Column.new( \
                key: :name, \
                attribute: 'full_names', \
                link_to: lambda do |merge| \
                  workbench_merge_path merge.workbench, merge \
                end \
              ), \
              TableBuilderHelper::Column.new( \
                name: t(".table_headers.ended_at"), \
                attribute: Proc.new { |n| l(n.ended_at, format: :short_with_time) if n.ended_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( \
                name: t(".table_headers.aggregated_at"), \
                attribute:  Proc.new { |n| n.last_aggregate ? l(n.last_aggregate.ended_at, format: :short_with_time) : '-' }\
              ), \
              TableBuilderHelper::Column.new( \
                key: :creator, \
                attribute: 'creator' \
              ) \
            ],
            cls: 'table has-search',
            action: :index

          = new_pagination @workbench_merges, 'pull-right'