1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
- breadcrumb @workbench
- page_header_content_for @workbench
- content_for :page_header_content do
.row.mb-sm
.col-lg-12.text-right
- if policy(Referential).create?
= link_to t('actions.import'), workbench_imports_path(@workbench), class: 'btn btn-primary'
= link_to t('actions.add'), new_referential_path(workbench_id: @workbench), class: 'btn btn-primary'
= link_to t('workbenches.actions.show_output'), workbench_output_path(@workbench), class: 'btn btn-primary'
.page_content
.container-fluid
- if params[:q].present? or @wbench_refs.any?
.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: 'name', \
link_to: lambda do |referential| \
referential_path(referential, current_workbench_id: params[:id]) \
end \
), \
TableBuilderHelper::Column.new( \
key: :status, \
attribute: Proc.new {|w| w.referential_read_only? ? ("<div class='td-block'><span class='fa fa-archive'></span><span>#{t('activerecord.attributes.referential.archived_at')}</span></div>").html_safe : ("<div class='td-block'><span class='sb sb-lg sb-preparing'></span><span>#{t('activerecord.attributes.referential.archived_at_null')}</span></div>").html_safe} \
), \
TableBuilderHelper::Column.new( \
key: :organisation, \
attribute: Proc.new {|w| w.organisation.name} \
), \
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), format: :short), end: l(w.try(:validity_period).try(:end), format: :short))} \
), \
TableBuilderHelper::Column.new( \
key: :lines, \
name: t('activerecord.attributes.referential.number_of_lines'), \
attribute: Proc.new {|w| w.lines.count} \
), \
TableBuilderHelper::Column.new( \
key: :created_at, \
attribute: Proc.new {|w| l(w.created_at, format: :short)} \
), \
TableBuilderHelper::Column.new( \
key: :updated_at, \
attribute: Proc.new {|w| l(w.updated_at, format: :short)} \
), \
TableBuilderHelper::Column.new( \
key: :merged_at, \
attribute: Proc.new {|w| w.merged_at ? l(w.merged_at, format: :short) : '-'} \
) \
],
selectable: ->(ref){ @workbench.referentials.include?(ref) },
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')
= javascript_tag do
// | window.I18n = #{(I18n.backend.send(:translations).to_json).html_safe};
= javascript_pack_tag 'date_filters'
|