aboutsummaryrefslogtreecommitdiffstats
path: root/app/views/time_tables/index.html.slim
blob: a0b9e438088b7f09b267fb3b651001b652619e36 (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
/ PageHeader
= pageheader 'map-marker',
             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 @time_tables,
            { 'ID' => Proc.new { |n| n.objectid.local_id }, :color => Proc.new{|tt| tt.color ? content_tag(:span, '', class: 'fa fa-circle', style: "color:#{tt.color}") : '-' }, :comment => 'comment', 
              "Période englobante" => Proc.new{ |tt| tt.bounding_dates.empty? ? '-' : t('bounding_dates', debut: l(tt.bounding_dates.min), end: l(tt.bounding_dates.max)) },
              "Nombre de courses associées" => Proc.new{ |tt| tt.vehicle_journeys.count },
              "Journées d'application" => 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 },
              :calendar => Proc.new{ |tt| tt.calendar ? tt.calendar.try(:name) : '-' }, :updated_at => Proc.new {|tt| l(tt.updated_at, format: :short)} },
            [:show, :edit, :duplicate, :actualize, :delete],
            [],
            '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')