aboutsummaryrefslogtreecommitdiffstats
path: root/app/views/time_tables/index.html.slim
blob: 58bf66a9d44a37c942ff8139e431366320330c76 (plain)
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
- breadcrumb :time_tables, @referential

.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.get_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( \
                key: :bounding_dates, \
                name: "Période englobante", \
                attribute: Proc.new { |tt| tt.object.bounding_dates.empty? ? '-' : t('bounding_dates', debut: l(tt.object.bounding_dates.min), end: l(tt.object.bounding_dates.max)) }, \
              ), \
              TableBuilderHelper::Column.new( \
                key: :vehicle_journeys_count, \
                name: "Nombre de courses associées", \
                attribute: Proc.new{ |tt| tt.vehicle_journeys.count }, \
              ), \
              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) } \
              ) \
            ],
            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_pack_tag 'date_filters'