diff --git a/app/components/admin/table_actions_component.html.erb b/app/components/admin/table_actions_component.html.erb
index 2648f99dc..6a885a37a 100644
--- a/app/components/admin/table_actions_component.html.erb
+++ b/app/components/admin/table_actions_component.html.erb
@@ -1,3 +1,5 @@
+<%= content %>
+
<% if actions.include?(:edit) %>
<%= link_to edit_text, edit_path, edit_options %>
<% end %>
diff --git a/app/views/admin/admin_notifications/index.html.erb b/app/views/admin/admin_notifications/index.html.erb
index 48f132461..ad284ce11 100644
--- a/app/views/admin/admin_notifications/index.html.erb
+++ b/app/views/admin/admin_notifications/index.html.erb
@@ -30,14 +30,17 @@
<% if admin_notification.draft? %>
- <%= render Admin::TableActionsComponent.new(admin_notification) %>
- <%= link_to t("admin.admin_notifications.index.preview"),
- admin_admin_notification_path(admin_notification),
- class: "button" %>
+ <%= render Admin::TableActionsComponent.new(admin_notification) do |actions| %>
+ <%= actions.link_to t("admin.admin_notifications.index.preview"),
+ admin_admin_notification_path(admin_notification),
+ class: "button" %>
+ <% end %>
<% else %>
- <%= link_to t("admin.admin_notifications.index.view"),
- admin_admin_notification_path(admin_notification),
- class: "button" %>
+ <%= render Admin::TableActionsComponent.new(actions: []) do |actions| %>
+ <%= actions.link_to t("admin.admin_notifications.index.view"),
+ admin_admin_notification_path(admin_notification),
+ class: "button" %>
+ <% end %>
<% end %>
|
diff --git a/app/views/admin/audits/_audits.html.erb b/app/views/admin/audits/_audits.html.erb
index ee1f3c030..684c246a3 100644
--- a/app/views/admin/audits/_audits.html.erb
+++ b/app/views/admin/audits/_audits.html.erb
@@ -34,9 +34,11 @@
<%= audit.user&.name %>
- <%= link_to t("shared.show"),
- admin_polymorphic_path(audit),
- class: "button hollow primary" %>
+ <%= render Admin::TableActionsComponent.new(actions: []) do |actions| %>
+ <%= actions.link_to t("shared.show"),
+ admin_polymorphic_path(audit),
+ class: "button hollow primary" %>
+ <% end %>
|
<% end %>
diff --git a/app/views/admin/budget_groups/index.html.erb b/app/views/admin/budget_groups/index.html.erb
index 3634e4bdc..023cdae4a 100644
--- a/app/views/admin/budget_groups/index.html.erb
+++ b/app/views/admin/budget_groups/index.html.erb
@@ -16,7 +16,6 @@
<%= t("admin.budget_groups.name") %> |
<%= Budget::Group.human_attribute_name(:max_votable_headings) %> |
<%= t("admin.budget_groups.headings_name") %> |
- <%= t("admin.budget_groups.headings_edit") %> |
<%= t("admin.actions.actions") %> |
@@ -26,10 +25,11 @@
<%= link_to group.name, edit_admin_budget_group_path(@budget, group) %> |
<%= group.max_votable_headings %> |
<%= group.headings.count %> |
- <%= link_to t("admin.budget_groups.headings_manage"),
- admin_budget_group_headings_path(@budget, group) %> |
- <%= render Admin::TableActionsComponent.new(group) %>
+ <%= render Admin::TableActionsComponent.new(group) do |actions| %>
+ <%= actions.link_to t("admin.budget_groups.headings_manage"),
+ admin_budget_group_headings_path(@budget, group) %>
+ <% end %>
|
<% end %>
diff --git a/app/views/admin/budgets/index.html.erb b/app/views/admin/budgets/index.html.erb
index c63ee4789..8f89a02bc 100644
--- a/app/views/admin/budgets/index.html.erb
+++ b/app/views/admin/budgets/index.html.erb
@@ -14,10 +14,7 @@
| <%= t("admin.budgets.index.table_name") %> |
<%= t("admin.budgets.index.table_phase") %> |
- <%= t("admin.budgets.index.table_investments") %> |
- <%= t("admin.budgets.index.table_edit_groups") %> |
- <%= t("admin.budgets.index.table_edit_budget") %> |
- <%= t("admin.budgets.index.table_admin_ballots") %> |
+ <%= t("admin.actions.actions") %> |
@@ -30,21 +27,16 @@
<%= t("budgets.phase.#{budget.phase}") %>
- <%= link_to t("admin.budgets.index.budget_investments"),
- admin_budget_budget_investments_path(budget_id: budget.id),
- class: "button hollow medium" %>
- |
-
- <%= link_to t("admin.budgets.index.edit_groups"), admin_budget_groups_path(budget) %>
- |
-
- <%= link_to t("admin.budgets.index.edit_budget"), edit_admin_budget_path(budget) %>
- |
-
- <% if budget.poll.present? %>
- <%= link_to t("admin.budgets.index.admin_ballots"), admin_poll_booth_assignments_path(budget.poll) %>
- <% else %>
- <%= link_to_create_budget_poll(budget) %>
+ <%= render Admin::TableActionsComponent.new(budget, actions: [:edit], edit_text: t("admin.budgets.index.edit_budget")) do |actions| %>
+ <%= actions.link_to t("admin.budgets.index.budget_investments"),
+ admin_budget_budget_investments_path(budget_id: budget.id),
+ class: "button hollow medium" %>
+ <%= actions.link_to t("admin.budgets.index.edit_groups"), admin_budget_groups_path(budget) %>
+ <% if budget.poll.present? %>
+ <%= actions.link_to t("admin.budgets.index.admin_ballots"), admin_poll_booth_assignments_path(budget.poll) %>
+ <% else %>
+ <%= link_to_create_budget_poll(budget) %>
+ <% end %>
<% end %>
|
diff --git a/app/views/admin/newsletters/index.html.erb b/app/views/admin/newsletters/index.html.erb
index f9cf9b604..a86d704c3 100644
--- a/app/views/admin/newsletters/index.html.erb
+++ b/app/views/admin/newsletters/index.html.erb
@@ -29,10 +29,11 @@
<% end %>
- <%= render Admin::TableActionsComponent.new(newsletter) %>
-
- <%= link_to t("admin.newsletters.index.preview"), admin_newsletter_path(newsletter),
- class: "button" %>
+ <%= render Admin::TableActionsComponent.new(newsletter) do |actions| %>
+ <%= actions.link_to t("admin.newsletters.index.preview"),
+ admin_newsletter_path(newsletter),
+ class: "button" %>
+ <% end %>
|
<% 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 1663ac00f..acbddc7fa 100644
--- a/app/views/admin/poll/booth_assignments/_booth_assignment.html.erb
+++ b/app/views/admin/poll/booth_assignments/_booth_assignment.html.erb
@@ -25,11 +25,15 @@
<%= t("admin.booth_assignments.manage.status.unassigned") %>
- <%= link_to t("admin.booth_assignments.manage.actions.assign"),
- admin_poll_booth_assignments_path(@poll, booth_id: booth.id),
- method: :post,
- remote: true,
- title: t("admin.booth_assignments.manage.actions.assign"),
- class: "button hollow expanded" if !@poll.expired? %>
+ <% unless @poll.expired? %>
+ <%= render Admin::TableActionsComponent.new(actions: []) do |actions| %>
+ <%= actions.link_to t("admin.booth_assignments.manage.actions.assign"),
+ admin_poll_booth_assignments_path(@poll, booth_id: booth.id),
+ method: :post,
+ remote: true,
+ title: t("admin.booth_assignments.manage.actions.assign"),
+ class: "button hollow expanded" %>
+ <% end %>
+ <% end %>
|
<% end %>
diff --git a/app/views/admin/poll/booths/_booth.html.erb b/app/views/admin/poll/booths/_booth.html.erb
index bca880e5d..0e02fa36d 100644
--- a/app/views/admin/poll/booths/_booth.html.erb
+++ b/app/views/admin/poll/booths/_booth.html.erb
@@ -7,9 +7,11 @@
<% if controller_name == "shifts" || controller_name == "booths" && action_name == "available" %>
- <%= link_to t("admin.booths.booth.shifts"),
- new_admin_booth_shift_path(booth),
- class: "button hollow" %>
+ <%= render Admin::TableActionsComponent.new(actions: []) do |actions| %>
+ <%= actions.link_to t("admin.booths.booth.shifts"),
+ new_admin_booth_shift_path(booth),
+ class: "button hollow" %>
+ <% end %>
<% else %>
<%= render Admin::TableActionsComponent.new(booth,
actions: [:edit],
diff --git a/app/views/admin/poll/officers/_officer.html.erb b/app/views/admin/poll/officers/_officer.html.erb
index 45e516594..dd3202e7d 100644
--- a/app/views/admin/poll/officers/_officer.html.erb
+++ b/app/views/admin/poll/officers/_officer.html.erb
@@ -21,9 +21,11 @@
destroy_text: t("admin.poll_officers.officer.delete")
) %>
<% else %>
- <%= link_to t("admin.poll_officers.officer.add"), { controller: "admin/poll/officers", action: :create, user_id: officer.user_id },
- method: :post,
- class: "button success expanded" %>
+ <%= render Admin::TableActionsComponent.new(actions: []) do |actions| %>
+ <%= actions.link_to t("admin.poll_officers.officer.add"), { controller: "admin/poll/officers", action: :create, user_id: officer.user_id },
+ method: :post,
+ class: "button success expanded" %>
+ <% end %>
<% end %>
|
diff --git a/app/views/admin/poll/officers/index.html.erb b/app/views/admin/poll/officers/index.html.erb
index 02b67492f..1e2b4e144 100644
--- a/app/views/admin/poll/officers/index.html.erb
+++ b/app/views/admin/poll/officers/index.html.erb
@@ -35,11 +35,13 @@
destroy_text: t("admin.poll_officers.officer.delete")
) %>
<% else %>
- <%= link_to t("admin.poll_officers.officer.add"),
- { controller: "admin/poll/officers", action: :create,
- user_id: officer.user_id },
- method: :post,
- class: "button success expanded" %>
+ <%= render Admin::TableActionsComponent.new(actions: []) do |actions| %>
+ <%= actions.link_to t("admin.poll_officers.officer.add"),
+ { controller: "admin/poll/officers", action: :create,
+ user_id: officer.user_id },
+ method: :post,
+ class: "button success expanded" %>
+ <% end %>
<% end %>
diff --git a/app/views/admin/poll/polls/_poll.html.erb b/app/views/admin/poll/polls/_poll.html.erb
index 27f43affd..33189750b 100644
--- a/app/views/admin/poll/polls/_poll.html.erb
+++ b/app/views/admin/poll/polls/_poll.html.erb
@@ -13,9 +13,10 @@
<%= render Admin::TableActionsComponent.new(poll,
destroy_confirmation: t("admin.polls.destroy.alert")
- ) %>
- <%= link_to t("admin.actions.configure"),
- admin_poll_path(poll),
- class: "button hollow " %>
+ ) do |actions| %>
+ <%= actions.link_to t("admin.actions.configure"),
+ admin_poll_path(poll),
+ class: "button hollow " %>
+ <% end %>
|
diff --git a/app/views/admin/poll/polls/_questions.html.erb b/app/views/admin/poll/polls/_questions.html.erb
index 59964d6e6..79e57748a 100644
--- a/app/views/admin/poll/polls/_questions.html.erb
+++ b/app/views/admin/poll/polls/_questions.html.erb
@@ -30,9 +30,10 @@
<% end %>
- <%= link_to t("admin.polls.show.edit_answers"), admin_question_path(question),
- class: "button hollow" %>
- <%= render Admin::TableActionsComponent.new(question) %>
+ <%= render Admin::TableActionsComponent.new(question) do |actions| %>
+ <%= actions.link_to t("admin.polls.show.edit_answers"), admin_question_path(question),
+ class: "button hollow" %>
+ <% end %>
|
<% end %>
diff --git a/app/views/admin/poll/polls/booth_assignments.html.erb b/app/views/admin/poll/polls/booth_assignments.html.erb
index 66814cefc..0816de134 100644
--- a/app/views/admin/poll/polls/booth_assignments.html.erb
+++ b/app/views/admin/poll/polls/booth_assignments.html.erb
@@ -5,7 +5,7 @@
<%= t("admin.polls.index.name") %> |
<%= t("admin.polls.index.dates") %> |
- <%= t("admin.actions.actions") %> |
+ <%= t("admin.actions.actions") %> |
<% @polls.each do |poll| %>
@@ -16,10 +16,12 @@
<%= l poll.starts_at.to_date %> - <%= l poll.ends_at.to_date %>
|
-
- <%= link_to t("admin.booth_assignments.manage_assignments"),
- manage_admin_poll_booth_assignments_path(poll),
- class: "button hollow" %>
+ |
+ <%= render Admin::TableActionsComponent.new(actions: []) do |actions| %>
+ <%= actions.link_to t("admin.booth_assignments.manage_assignments"),
+ manage_admin_poll_booth_assignments_path(poll),
+ class: "button hollow" %>
+ <% end %>
|
<% end %>
diff --git a/app/views/admin/poll/questions/_successful_proposals.html.erb b/app/views/admin/poll/questions/_successful_proposals.html.erb
index f58c84d25..88bd6e477 100644
--- a/app/views/admin/poll/questions/_successful_proposals.html.erb
+++ b/app/views/admin/poll/questions/_successful_proposals.html.erb
@@ -15,9 +15,11 @@
- <%= link_to t("admin.questions.index.create_question"),
- new_admin_question_path(proposal_id: proposal.id),
- class: "button hollow" %>
+ <%= render Admin::TableActionsComponent.new(actions: []) do |actions| %>
+ <%= actions.link_to t("admin.questions.index.create_question"),
+ new_admin_question_path(proposal_id: proposal.id),
+ class: "button hollow" %>
+ <% end %>
|
<% end %>
diff --git a/app/views/admin/poll/questions/answers/documents.html.erb b/app/views/admin/poll/questions/answers/documents.html.erb
index 3f6ff5df7..5ec767388 100644
--- a/app/views/admin/poll/questions/answers/documents.html.erb
+++ b/app/views/admin/poll/questions/answers/documents.html.erb
@@ -36,16 +36,17 @@
<%= link_to document.title, document.attachment.url %>
- <%= link_to t("documents.buttons.download_document"),
- document.attachment.url,
- target: "_blank",
- rel: "nofollow",
- class: "button hollow" %>
-
<%= render Admin::TableActionsComponent.new(document,
actions: [:destroy],
destroy_path: document_path(document)
- ) %>
+ ) do |actions| %>
+ <%= actions.link_to t("documents.buttons.download_document"),
+ document.attachment.url,
+ target: "_blank",
+ rel: "nofollow",
+ class: "button hollow" %>
+
+ <% end %>
|
<% end %>
diff --git a/app/views/admin/site_customization/pages/index.html.erb b/app/views/admin/site_customization/pages/index.html.erb
index d22efec9b..359ba932f 100644
--- a/app/views/admin/site_customization/pages/index.html.erb
+++ b/app/views/admin/site_customization/pages/index.html.erb
@@ -35,17 +35,17 @@
<%= I18n.l page.created_at, format: :short %> |
<%= t("admin.site_customization.pages.page.status_#{page.status}") %> |
- <% if page.status == "published" %>
- <%= link_to t("admin.site_customization.pages.index.see_page"),
- page.url,
- target: "_blank",
- class: "button hollow" %>
- <% end %>
-
<%= render Admin::TableActionsComponent.new(page,
actions: [:destroy],
destroy_text: t("admin.site_customization.pages.index.delete")
- ) %>
+ ) do |actions| %>
+ <% if page.status == "published" %>
+ <%= actions.link_to t("admin.site_customization.pages.index.see_page"),
+ page.url,
+ target: "_blank",
+ class: "button hollow" %>
+ <% end %>
+ <% end %>
|
<% end %>
diff --git a/app/views/admin/system_emails/index.html.erb b/app/views/admin/system_emails/index.html.erb
index 3e8cabc3b..c70793954 100644
--- a/app/views/admin/system_emails/index.html.erb
+++ b/app/views/admin/system_emails/index.html.erb
@@ -18,32 +18,29 @@
<%= t("admin.system_emails.#{system_email_title}.description") %>
- <% if system_email_actions.include?("view") %>
-
- <%= link_to t("admin.shared.view"), admin_system_email_view_path(system_email_title),
- class: "button hollow expanded" %>
-
- <% end %>
- <% if system_email_actions.include?("preview_pending") %>
-
- <%= link_to t("admin.system_emails.preview_pending.action"),
- admin_system_email_preview_pending_path(system_email_title),
- class: "button expanded" %>
-
-
- <%= link_to t("admin.system_emails.preview_pending.send_pending"),
- admin_system_email_send_pending_path(system_email_title),
- class: "button success expanded",
- method: :put %>
-
- <% end %>
- <% if system_email_actions.include?("edit_info") %>
-
+ <%= render Admin::TableActionsComponent.new(actions: []) do |actions| %>
+ <% if system_email_actions.include?("view") %>
+ <%= actions.link_to t("admin.shared.view"),
+ admin_system_email_view_path(system_email_title),
+ class: "button hollow" %>
+ <% end %>
+
+ <% if system_email_actions.include?("preview_pending") %>
+ <%= actions.link_to t("admin.system_emails.preview_pending.action"),
+ admin_system_email_preview_pending_path(system_email_title),
+ class: "button" %>
+ <%= actions.link_to t("admin.system_emails.preview_pending.send_pending"),
+ admin_system_email_send_pending_path(system_email_title),
+ class: "button success",
+ method: :put %>
+ <% end %>
+
+ <% if system_email_actions.include?("edit_info") %>
<%= t("admin.system_emails.edit_info") %>
<%= "app/views/mailer/#{system_email_title}.html.erb" %>
-
+ <% end %>
<% end %>
|
diff --git a/config/locales/en/admin.yml b/config/locales/en/admin.yml
index cbe7f7a15..a7960eee4 100644
--- a/config/locales/en/admin.yml
+++ b/config/locales/en/admin.yml
@@ -72,10 +72,6 @@ en:
budget_investments: Manage projects
table_name: Name
table_phase: Phase
- table_investments: Investments
- table_edit_groups: Headings groups
- table_edit_budget: Edit
- table_admin_ballots: Ballots
edit_groups: Edit headings groups
edit_budget: Edit budget
admin_ballots: Admin ballots
@@ -117,7 +113,6 @@ en:
budget_groups:
name: "Name"
headings_name: "Headings"
- headings_edit: "Edit Headings"
headings_manage: "Manage headings"
no_groups: "There are no groups."
amount:
diff --git a/config/locales/es/admin.yml b/config/locales/es/admin.yml
index d6d3d1563..586cc1b70 100644
--- a/config/locales/es/admin.yml
+++ b/config/locales/es/admin.yml
@@ -72,10 +72,6 @@ es:
budget_investments: Gestionar proyectos de gasto
table_name: Nombre
table_phase: Fase
- table_investments: Proyectos de gasto
- table_edit_groups: Grupos de partidas
- table_edit_budget: Editar
- table_admin_ballots: Urnas
edit_groups: Editar grupos de partidas
edit_budget: Editar presupuesto
admin_ballots: Gestionar urnas
@@ -117,7 +113,6 @@ es:
budget_groups:
name: "Nombre"
headings_name: "Partidas"
- headings_edit: "Editar Partidas"
headings_manage: "Gestionar partidas"
no_groups: "No hay grupos."
amount:
diff --git a/spec/components/admin/table_actions_component_spec.rb b/spec/components/admin/table_actions_component_spec.rb
index eba078a57..c4630c645 100644
--- a/spec/components/admin/table_actions_component_spec.rb
+++ b/spec/components/admin/table_actions_component_spec.rb
@@ -54,4 +54,15 @@ describe Admin::TableActionsComponent, type: :component do
expect(page).to have_css "a#edit_me"
end
+
+ it "allows custom content" do
+ render_inline Admin::TableActionsComponent.new(record) do
+ "Main".html_safe
+ end
+
+ expect(page).to have_css "a", count: 3
+ expect(page).to have_link "Main", href: "/"
+ expect(page).to have_link "Edit"
+ expect(page).to have_link "Delete"
+ end
end