aboutsummaryrefslogtreecommitdiffstats
path: root/app/views/time_tables/show.html.slim
blob: 46c32f4b0fdde96cf99b1a3b20c6f384b7a3a7a8 (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
- require 'calendar_helper'

/ PageHeader
= pageheader 'map-marker',
             @time_table.comment,
             '',
             (policy(@time_table).edit? ? link_to(t('actions.edit'), edit_referential_time_table_path(@referential, @time_table), class: 'btn btn-default') : '')

  / Below is secundary actions & optional contents (filters, ...)
  .row.mb-sm
    .col-lg-12.text-right
      / - if policy(@time_table).create? && @referential.organisation == current_organisation
      /   = link_to t('time_tables.actions.new'), new_referential_time_table_path(@referential), class: 'btn btn-primary'
      - if @time_table.calendar
        = link_to t('actions.actualize'), actualize_referential_time_table_path(@referential, @time_table), method: :post, class: 'btn btn-primary'

      /- if policy(@time_table).create? && @referential.organisation == current_organisation
      = link_to t('actions.combine'), new_referential_time_table_time_table_combination_path(@referential, @time_table), class: 'btn btn-primary'

      - if policy(@time_table).create? && @referential.organisation == current_organisation
        = link_to t('actions.clone'), duplicate_referential_time_table_path(@referential, @time_table), class: 'btn btn-primary'

      - if policy(@time_table).destroy?
        = link_to referential_time_table_path(@referential, @time_table), method: :delete, data: {confirm:  t('time_tables.actions.destroy_confirm')}, class: 'btn btn-primary' do
          span.fa.fa-trash
          span = t('actions.destroy')

/ PageContent
.page_content
  .container-fluid
    .row
      .col-lg-6.col-md-6.col-sm-12.col-xs-12
        = definition_list t('metadatas'),
          { "Période d'application" => (@time_table.bounding_dates.empty? ? '-' : t('bounding_dates', debut: l(@time_table.bounding_dates.min), end: l(@time_table.bounding_dates.max))),
            'Couleur associée' => (@time_table.color.nil? ? '-' : content_tag(:span, '', class: 'fa fa-circle', style: "color:#{@time_table.try(:color)}")),
            'Etiquettes' => @time_table.tag_list,
            'Modèle de calendrier' => (@time_table.calendar ? link_to(@time_table.calendar.name, @time_table.calendar) : '-'),
            "Journées d'application pour les périodes ci-dessous" => %w(monday tuesday wednesday thursday friday saturday sunday).collect{ |d| content_tag(:span, t("calendars.days.#{d}"), class: "label label-default #{@time_table.send(d) ? '' : 'disabled'}") }.join.html_safe }

    .row
      .col-lg-12.mb-sm
        .pagination.pull-right
          = @year
          .page_links
            = link_to '', referential_time_table_path(@referential, @time_table, year: (@year - 1)), class: 'previous_page'
            = link_to '', referential_time_table_path(@referential, @time_table, year: (@year + 1)), class: 'next_page'

    = render 'show_time_table'