| 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
 | module MultipleSelectionToolboxHelper
  # Box of links that floats at the bottom right of the page
  # c.f. https://projects.af83.io/issues/5206
  # #5206 method too long
  def multiple_selection_toolbox(actions, collection_name:)
    links = content_tag :ul do
      # #5206 `if params[:controller]` mieux passer comme parametre si besoin
      delete_path = nil
      if params[:controller] = 'workbenches'
        delete_path = referentials_workbench_path
      end
      actions.map do |action|
        if action == :delete
          action_link = link_to(
            '#',
            method: :delete,
            data: {
              path: delete_path,
              confirm: t('are_you_sure')
            },
            title: t("actions.#{action}")
          ) do
            content_tag :span, '', class: 'fa fa-trash'
          end
        end
        content_tag :li, action_link, class: 'st_action'
      end.join.html_safe
    end
    label = content_tag(
      :span,
      ("<span>0</span> #{t('table_builders.selected_elements')}").html_safe,
      class: 'info-msg'
    )
    content_tag :div, '',
      class: 'select_toolbox noselect',
      id: "selected-#{collection_name}-action-box" do
      links + label
    end
  end
end
 |