aboutsummaryrefslogtreecommitdiffstats
path: root/app/views/workbenches/show.html.slim
blob: 7400c0329801f5c9204ddf7d73c9beb223bc3c11 (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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/ PageHeader
= pageheader 'map-marker',
             'Jeux de données',
             'Lorem ipsum dolor sit amet',
             'Dernière mise à jour <br> le 22/12/2016' do

  / Below is secundary actions & optional contents (filters, ...)
  .row
    .col-lg-12.col-md-12.col-sm-12.col-xs-12.text-right
      - if params[:show_all]
        = link_to t('referentials.show.from_this_workbench'), workbench_path(@workbench.id), class: 'btn btn-primary', disabled: params[:archived]
      - else
        = link_to t('referentials.show.show_all_referentials'), workbench_path(@workbench.id, show_all: true), class: 'btn btn-primary'

      = link_to t('referentials.actions.new'), new_referential_path(workbench_id: @workbench), class: 'btn btn-primary'

/ PageContent
.page_content
  .container-fluid
    .row
      .col-lg-12
        .referentials.paginated_content
          = new_pagination @wbench_refs, 'pull-right'

          table.table.table-bordered.table-hover
            thead
              tr
                th = Referential.human_attribute_name(:name)
                th = Referential.human_attribute_name(:updated_at)
                th = "Publié le"
                th = Referential.human_attribute_name(:validity_period)
                th = Referential.human_attribute_name(:lines)
                th = Referential.human_attribute_name(:organisation)
                th = "Etat"
                th = "Actions"

            tbody
              - @wbench_refs.each do |referential|
                tr
                  td = referential.name
                  td = l referential.updated_at, format: :long
                  td
                  td
                    - if referential.validity_period.nil?
                      = Referential.human_attribute_name('no_validity_period')
                    - else
                      => Referential.human_attribute_name('start_validity_period')
                      => l referential.validity_period.begin, format: :long
                      => Referential.human_attribute_name('end_validity_period')
                      => l referential.validity_period.end, format: :long

                  td = referential.lines.count
                  td = referential.organisation.name

                  / Status (archived?)
                  td.text-center
                    - if referential.archived?
                      span.fa.fa-archive title="Archivé"
                    - else
                      = "-"

                  / Actions
                  td.text-center
                    .btn-group.btn-group-xs
                      .btn-primary.btn.dropdown-toggle data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"
                        span.fa.fa-bars
                        span.caret

                      ul.dropdown-menu
                        li = link_to "Voir", referential_path(referential)

                        - if policy(referential).update?
                          li = link_to "Editer", edit_referential_path(referential)

                        li = link_to "Cloner", new_referential_path(from: referential)

                        - if referential.archived?
                          - if referential.can_unarchive?
                            li = link_to "Désarchiver", unarchive_referential_path(referential), method: :put
                          - else
                            li.disabled title="L'action est impossible pour ce référentiel"
                              = link_to "Désarchiver", "#"
                        - else
                          li = link_to "Archiver", archive_referential_path(referential), method: :put

                        li = link_to "Supprimer", referential_path(referential), method: :delete, :data => {:confirm => t('referentials.actions.destroy_confirm')}

          = new_pagination @wbench_refs, 'pull-right'