diff --git a/app/components/admin/table_actions_component.html.erb b/app/components/admin/table_actions_component.html.erb index e2d859a9b..2648f99dc 100644 --- a/app/components/admin/table_actions_component.html.erb +++ b/app/components/admin/table_actions_component.html.erb @@ -1,11 +1,7 @@ <% if actions.include?(:edit) %> - <%= link_to edit_text, edit_path, class: "button hollow" %> + <%= link_to edit_text, edit_path, edit_options %> <% end %> <% if actions.include?(:destroy) %> - <%= link_to destroy_text, - destroy_path, - method: :delete, - class: "button hollow alert", - data: { confirm: destroy_confirmation } %> + <%= link_to destroy_text, destroy_path, destroy_options %> <% end %> diff --git a/app/components/admin/table_actions_component.rb b/app/components/admin/table_actions_component.rb index 740538ab0..339dc4c6c 100644 --- a/app/components/admin/table_actions_component.rb +++ b/app/components/admin/table_actions_component.rb @@ -20,6 +20,10 @@ class Admin::TableActionsComponent < ApplicationComponent options[:edit_path] || admin_polymorphic_path(record, action: :edit) end + def edit_options + { class: "button hollow" }.merge(options[:edit_options] || {}) + end + def destroy_text options[:destroy_text] || t("admin.actions.delete") end @@ -28,6 +32,14 @@ class Admin::TableActionsComponent < ApplicationComponent options[:destroy_path] || admin_polymorphic_path(record) end + def destroy_options + { + method: :delete, + class: "button hollow alert", + data: { confirm: destroy_confirmation } + }.merge(options[:destroy_options] || {}) + end + def destroy_confirmation options[:destroy_confirmation] || t("admin.actions.confirm") end diff --git a/app/views/admin/poll/booth_assignments/_booth_assignment.html.erb b/app/views/admin/poll/booth_assignments/_booth_assignment.html.erb index 8f159a264..1663ac00f 100644 --- a/app/views/admin/poll/booth_assignments/_booth_assignment.html.erb +++ b/app/views/admin/poll/booth_assignments/_booth_assignment.html.erb @@ -11,13 +11,14 @@