aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/helpers/multiple_selection_toolbox_helper.rb48
1 files changed, 25 insertions, 23 deletions
diff --git a/app/helpers/multiple_selection_toolbox_helper.rb b/app/helpers/multiple_selection_toolbox_helper.rb
index c5a30ddb0..e66dafe22 100644
--- a/app/helpers/multiple_selection_toolbox_helper.rb
+++ b/app/helpers/multiple_selection_toolbox_helper.rb
@@ -1,30 +1,11 @@
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(workbench_id, *actions, collection_name:)
links = content_tag :ul do
-
- delete_path = referentials_workbench_path workbench_id
- actions.flatten.map do |action|
- if action == :delete
- action_link = link_to(
- '#',
- method: :delete,
- data: {
- path: delete_path,
- # #5206 Missing Translations an
- confirm: 'Etes-vous sûr(e) de vouloir effectuer cette action ?'
- },
- 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
+ actions.flatten.map{ |action| make_action action, workbench_id }
+ .join
+ .html_safe
end
label = content_tag(
@@ -36,7 +17,28 @@ module MultipleSelectionToolboxHelper
content_tag :div, '',
class: 'select_toolbox noselect',
id: "selected-#{collection_name}-action-box" do
- links + label
+ links + label
+ end
+ end
+
+
+ private
+
+ def make_action action, workbench_id
+ if action == :delete
+ action_link = link_to(
+ '#',
+ method: :delete,
+ data: {
+ path: referentials_workbench_path(workbench_id),
+ confirm: 'Etes-vous sûr(e) de vouloir effectuer cette action ?'
+ },
+ title: t("actions.#{action}")
+ ) do
+ content_tag :span, '', class: 'fa fa-trash'
+ end
end
+
+ content_tag :li, action_link, class: 'st_action'
end
end