app/views/workbenches/show.html.slim
- breadcrumb @workbench
- page_header_content_for @workbench
- content_for :page_header_content do
.row.mb-sm
.col-lg-12.text-right
- if resource_policy.create?(Referential)
= link_to t('workbenches.actions.stop_area'), workbench_stop_area_referential_stop_areas_path(@workbench), class: 'btn btn-primary'
= link_to t('workbenches.actions.lines'), workbench_line_referential_lines_path(@workbench), class: 'btn btn-primary'
= link_to t('actions.import'), workbench_imports_path(@workbench), class: 'btn btn-primary' unless @workbench.workgroup.import_types.empty?
= link_to t('actions.export'), workbench_exports_path(@workbench), class: 'btn btn-primary' unless @workbench.workgroup.export_types.empty?
= link_to t('actions.new'), new_workbench_referential_path(@workbench), class: 'btn btn-primary'
= link_to t('workbenches.actions.show_output'), workbench_output_path(@workbench), class: 'btn btn-primary'
.page_content
.container-fluid
.row
.col-lg-12
= render 'filters'
- if @wbench_refs.any?
.row
.col-lg-12
.select_table
= table_builder_2 @wbench_refs,
[ \
TableBuilderHelper::Column.new( \
key: :name, \
attribute: lambda do |referential| \
link_to(referential.name, workbench_referential_path(@workbench, referential)) \
end \
), \
TableBuilderHelper::Column.new( \
key: :status, \
attribute: Proc.new {|referential| referential_status(referential) }, \
sortable: false \
), \
(TableBuilderHelper::Column.new( \
key: :workbench, \
name: Referential.tmf('workbench'), \
attribute: Proc.new {|referential| referential.workbench.name} \
) unless @single_workbench), \
TableBuilderHelper::Column.new( \
key: :validity_period, \
attribute: Proc.new {|w| w.validity_period.nil? ? '-' : t('validity_range', debut: l(w.try(:validity_period).try(:begin)), end: l(w.try(:validity_period).try(:end)))}, \
sortable: false \
), \
TableBuilderHelper::Column.new( \
key: :lines, \
name: Referential.tmf('lines'), \
attribute: Proc.new {|w| w.lines.count}, \
sortable: false \
), \
TableBuilderHelper::Column.new( \
key: :created_at, \
attribute: Proc.new {|w| l(w.created_at)} \
), \
TableBuilderHelper::Column.new( \
key: :merged_at, \
attribute: Proc.new {|w| w.merged_at ? l(w.merged_at) : '-'} \
) \
].compact,
selectable: ->(ref) { \
@workbench.referentials.include?(ref) && \
policy(ref).destroy? \
},
cls: 'table has-filter has-search',
action: :index
= multiple_selection_toolbox([:delete], collection_name: 'referentials')
= new_pagination @wbench_refs, 'pull-right'
- unless @wbench_refs.any?
.row.mt-xs
.col-lg-12
= replacement_msg t('referentials.search_no_results')