af83/chouette-core

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

Summary

Maintainability
Test Coverage
- breadcrumb :import, @parent, @import

.row
  .col-lg-6.col-md-6.col-sm-12.col-xs-12
    = render 'metadatas', import: @import
  = processing_helper(@import)
- if @import.overlapping_referentials.any?
  .row
    .col-lg-6.col-md-6.col-sm-12.col-xs-12
      = simple_block_for @import, title: t('imports.show.overlapping') do |d|
        = d.attribute :overlapping_referentials, as: :associations, value: @import.overlapping_referentials.sort_by(&:name), link: ->(child) { workbench_referential_path(@workbench, child) }
        p.mt-6
          = t('imports.show.overlapping_tips')
.col-lg-12
  .error_messages
    - messages = @import.messages + @import.resources.flat_map(&:messages)
    = render 'shared/iev_interfaces/messages', messages: messages

- if @import.children.any?
  .col-lg-12
    = table_builder_2 @import.children,
      [ \
        TableBuilderHelper::Column.new( \
          name: t('imports.show.referential_name'),
          attribute: -> (import) { link_to(import.name, workbench_referential_path(@workbench, import.referential)) },
          if: -> (import) { import.referential },
          sortable: false,
        ),
        TableBuilderHelper::Column.new( \
          key: :status,
          attribute: lambda do |n| \
            link_to(operation_status(n.status, verbose: true, default_status: :pending), [@parent, n]) \
          end,
          sortable: false,
        ),
        TableBuilderHelper::Column.new( \
          name: I18n.t('imports.index.workbench_macro_list_run'),
          attribute: lambda do |n| \
            n.workbench_macro_list_run ? link_to_if(@parent.is_a?(Workbench), operation_status(n.workbench_macro_list_run.processed.user_status, verbose: true), [@workbench, n.workbench_macro_list_run.processed]) : '-' \
          end,
          sortable: false,
        ),
        TableBuilderHelper::Column.new( \
          name: I18n.t('imports.index.workbench_control_list_run'),
          attribute: lambda do |n| \
            n.workbench_control_list_run ? link_to_if(@parent.is_a?(Workbench), operation_status(n.workbench_control_list_run.processed.user_status, verbose: true), [@workbench, n.workbench_control_list_run.processed]) : '-' \
          end,
          sortable: false,
        ),
        TableBuilderHelper::Column.new( \
          name: I18n.t('imports.index.workrgroup_control_list_run'),
          attribute: lambda do |n| \
            n.workgroup_control_list_run ? link_to_if(@parent.is_a?(Workbench), operation_status(n.workgroup_control_list_run.processed.user_status, verbose: true), [@workbench, n.workgroup_control_list_run.processed]) : '-' \
          end,
          sortable: false,
        ),
      ],
      cls: 'table'