aboutsummaryrefslogtreecommitdiffstats
path: root/app/views/workbenches/show.html.slim
blob: 61175db98a63caf38266fd4b98330cacbb475d5f (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
/ PageHeader
= pageheader 'map-marker',
             t('referentials.index.title'),
             'Lorem ipsum dolor sit amet',
             t('last_update', time: l(@workbench.updated_at, format: :short)) do

  / Below is secundary actions & optional contents (filters, ...)
  .row
    .col-lg-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'

  .row.mt-xs
    .col-lg-5.col-md-6.col-sm-6.col-xs-8
      = search_form_for @q, url: workbench_path(@workbench.id), html: { method: :get, class: 'form'} do |f|
        .input-group.search_bar
          = f.search_field :name_cont, class: 'form-control', placeholder: 'Indiquez un nom de jeu de données'

          span.input-group-btn
            button.btn.btn-default type='submit'
              span.fa.fa-search

      / br
      / = "filtres par: etat, orga, nb lignes, plage de validité, date publi. btns: clear filter et filtrer"

/ PageContent
.page_content
  .container-fluid
    .row
      .col-lg-12
        - if @wbench_refs.any?
          = new_pagination @wbench_refs, 'pull-right'

          = table_builder @wbench_refs,
            { @wbench_refs.human_attribute_name(:name) => 'name', @wbench_refs.human_attribute_name(:status) => Proc.new {|w| w.archived? ? ("<span class='fa fa-archive'></span> Conservé").html_safe : '-'},
              'Organisation' => Proc.new {|w| w.organisation.name},
              @wbench_refs.human_attribute_name(:validity_period) => Proc.new {|w| w.validity_period.nil? ? '-' : t('validity_range', debut: l(w.try(:validity_period).try(:begin), format: :short), end: l(w.try(:validity_period).try(:end), format: :short))},
              'Nb lignes' => Proc.new {|w| w.lines.count},
              @wbench_refs.human_attribute_name(:updated_at) => Proc.new {|w| l(w.updated_at, format: :short)},
              @wbench_refs.human_attribute_name(:published_at) => ''},
            [:show, :edit, :archive, :unarchive, :delete],
            :selectable,
            'table'

          = new_pagination @wbench_refs, 'pull-right'

        - else
          = replacement_msg t('referentials.search_no_results')