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
|
/ PageHeader
= pageheader 'calendrier-application',
t('time_tables.index.title'),
'',
((policy(Chouette::TimeTable).create? && @referential.organisation == current_organisation) ? link_to(t('actions.add'), new_referential_time_table_path(@referential), class: 'btn btn-default') : '')
/ PageContent
.page_content
.container-fluid
.row
.col-lg-12
= render 'filter'
- if @time_tables.any?
.row
.col-lg-12
= table_builder_2 @time_tables,
[ \
TableBuilderHelper::Column.new( \
name: 'ID', \
attribute: Proc.new { |n| n.objectid.short_id}, \
sortable: false \
), \
TableBuilderHelper::Column.new( \
key: :color, \
attribute: Proc.new { |tt| tt.color ? content_tag(:span, '', class: 'fa fa-circle', style: "color:#{tt.color}") : '-' }, \
), \
TableBuilderHelper::Column.new( \
key: :comment, \
attribute: 'comment', \
link_to: lambda do |time_table| \
referential_time_table_path(@referential, time_table) \
end \
), \
TableBuilderHelper::Column.new( \
name: "Période englobante", \
attribute: Proc.new { |tt| tt.bounding_dates.empty? ? '-' : t('bounding_dates', debut: l(tt.bounding_dates.min), end: l(tt.bounding_dates.max)) }, \
sortable: false \
), \
TableBuilderHelper::Column.new( \
name: "Nombre de courses associées", \
attribute: Proc.new{ |tt| tt.vehicle_journeys.count }, \
sortable: false \
), \
TableBuilderHelper::Column.new( \
name: "Journées d'application", \
attribute: Proc.new { |tt| (%w(monday tuesday wednesday thursday friday saturday sunday).collect{|d| tt.send(d) ? t("calendars.days.#{d}") : '' }).reject{|a| a.empty?}.join(', ').html_safe }, \
sortable: false \
), \
TableBuilderHelper::Column.new( \
key: :calendar, \
attribute: Proc.new { |tt| tt.calendar ? tt.calendar.try(:name) : '-' } \
), \
TableBuilderHelper::Column.new( \
key: :updated_at, \
attribute: Proc.new { |tt| l(tt.updated_at, format: :short) } \
) \
],
links: [:show, :edit],
cls: 'table has-search'
= new_pagination @time_tables, 'pull-right'
- unless @time_tables.any?
.row.mt-xs
.col-lg-12
= replacement_msg t('time_tables.search_no_results')
= javascript_tag do
| window.I18n = #{(I18n.backend.send(:translations).to_json).html_safe};
= javascript_include_tag 'filters/time_table.js'
|