af83/chouette-core

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

Summary

Maintainability
Test Coverage
- breadcrumb :aggregate, @aggregate
- page_header_content_for @aggregate

.page_content
  .container-fluid
    .row
      .col-lg-6.col-md-6.col-sm-12.col-xs-12
        = simple_block_for @aggregate, title: t('aggregate.form.sections.informations') do |d|
                    = d.attribute :status, value: operation_status(@aggregate.status, verbose: true, i18n_prefix: "aggregates.statuses")
                    = d.attribute :new, as: :association, link: ->(new) { workbench_referential_path(owner_workbench, new) }
                    = d.attribute :contains_urgent_offer, value: boolean_icon(@aggregate.contains_urgent_offer?)
                    = d.attribute :vehicle_journeys_count, value: @aggregate.new.vehicle_journeys_count if @aggregate.new

      = processing_helper(@aggregate)

    - if @aggregate_resources.any?
      .col-lg-12
        = table_builder_2 @aggregate_resources,
          [ \
            TableBuilderHelper::Column.new( \
              name: Aggregate::Resource.tmf(:workbench_name), \
              attribute: Proc.new { |item| item.workbench_name }, \
              sortable: false, \
            ), \
            TableBuilderHelper::Column.new( \
              key: :referential_created_at, \
              attribute: Proc.new { |n| l(n.referential_created_at, format: :short_with_time) if n.referential_created_at }, \
              sortable: true, \
            ), \
            TableBuilderHelper::Column.new( \
              key: :priority, \
              attribute: Proc.new { |item| item.priority }, \
              sortable: true, \
            ), \
            TableBuilderHelper::Column.new( \
              name: Aggregate::Resource.tmf(:duration), \
              attribute: Proc.new { |item| decorated_duration(item.duration) }, \
              sortable: false, \
            ), \
            TableBuilderHelper::Column.new( \
              name: Aggregate::Resource.tmf(:metrics), \
              attribute: Proc.new { |item| decorated_metrics(item.metrics) }, \
              sortable: false, \
            )\
          ], cls: 'table'

    - if @aggregate.new
      .col-lg-12
        = table_builder_2 [@aggregate.new],
          [ \
            TableBuilderHelper::Column.new( \
              name: t('.table_headers.aggregated_referential'),
              attribute: lambda do |referential| \
                link_to(decorate_referential_name(referential), workbench_referential_path(owner_workbench, referential)) \
              end,
              sortable: false,
            ),
            TableBuilderHelper::Column.new( \
              name: t('.table_headers.workgroup_control_list_run'),
              attribute: lambda do |referential| \
                workgroup_control_list_run = @processing&.processed; \
                link_to_if_table(workgroup_control_list_run.present?, operation_status(workgroup_control_list_run&.user_status, verbose: true), [owner_workbench, workgroup_control_list_run]) \
              end,
              sortable: false,
            ),
          ],
          model: Referential, cls: 'table'