diff --git a/app/views/admin/admin_notifications/index.html.erb b/app/views/admin/admin_notifications/index.html.erb
index c4d8b9c43..14c88ab1c 100644
--- a/app/views/admin/admin_notifications/index.html.erb
+++ b/app/views/admin/admin_notifications/index.html.erb
@@ -30,27 +30,14 @@
<% if admin_notification.draft? %>
-
- <%= link_to t("admin.admin_notifications.index.edit"),
- edit_admin_admin_notification_path(admin_notification),
- class: "button expanded hollow" %>
-
-
- <%= link_to t("admin.admin_notifications.index.delete"),
- admin_admin_notification_path(admin_notification),
- method: :delete, class: "button expanded hollow alert" %>
-
-
- <%= link_to t("admin.admin_notifications.index.preview"),
- admin_admin_notification_path(admin_notification),
- class: "button expanded" %>
-
+ <%= render "shared/table_actions", record: admin_notification, actions: [:edit, :destroy] %>
+ <%= link_to t("admin.admin_notifications.index.preview"),
+ admin_admin_notification_path(admin_notification),
+ class: "button" %>
<% else %>
-
- <%= link_to t("admin.admin_notifications.index.view"),
- admin_admin_notification_path(admin_notification),
- class: "button expanded" %>
-
+ <%= link_to t("admin.admin_notifications.index.view"),
+ admin_admin_notification_path(admin_notification),
+ class: "button" %>
<% end %>
|
diff --git a/app/views/admin/administrators/index.html.erb b/app/views/admin/administrators/index.html.erb
index db08c5933..fa70f0bf0 100644
--- a/app/views/admin/administrators/index.html.erb
+++ b/app/views/admin/administrators/index.html.erb
@@ -29,13 +29,7 @@
<%= administrator.description %>
- <%= link_to t("admin.actions.edit"),
- edit_admin_administrator_path(administrator),
- class: "button hollow" %>
- <%= link_to t("admin.administrators.administrator.delete"),
- admin_administrator_path(administrator),
- method: :delete,
- class: "button hollow alert" %>
+ <%= render "shared/table_actions", record: administrator, actions: [:edit, :destroy] %>
|
<% end %>
diff --git a/app/views/admin/administrators/search.html.erb b/app/views/admin/administrators/search.html.erb
index 89064f298..07cd39cb3 100644
--- a/app/views/admin/administrators/search.html.erb
+++ b/app/views/admin/administrators/search.html.erb
@@ -19,10 +19,7 @@
<%= user.email %> |
<% if user.administrator? && user.administrator.persisted? %>
- <%= link_to t("admin.administrators.administrator.delete"),
- admin_administrator_path(user.administrator),
- method: :delete,
- class: "button hollow alert expanded" %>
+ <%= render "shared/table_actions", record: user.administrator, actions: [:destroy] %>
<% else %>
<%= link_to t("admin.administrators.administrator.add"),
{ controller: "admin/administrators",
diff --git a/app/views/admin/budget_groups/index.html.erb b/app/views/admin/budget_groups/index.html.erb
index 4df47b16d..915635975 100644
--- a/app/views/admin/budget_groups/index.html.erb
+++ b/app/views/admin/budget_groups/index.html.erb
@@ -29,13 +29,7 @@
| <%= link_to t("admin.budget_groups.headings_manage"),
admin_budget_group_headings_path(@budget, group) %> |
- <%= link_to t("admin.actions.edit"),
- edit_admin_budget_group_path(@budget, group),
- class: "button hollow" %>
- <%= link_to t("admin.actions.delete"),
- admin_budget_group_path(@budget, group),
- method: :delete,
- class: "button hollow alert" %>
+ <%= render "shared/table_actions", record: group, actions: [:edit, :destroy] %>
|
<% end %>
diff --git a/app/views/admin/budget_headings/index.html.erb b/app/views/admin/budget_headings/index.html.erb
index 0abc51073..bed3d5688 100644
--- a/app/views/admin/budget_headings/index.html.erb
+++ b/app/views/admin/budget_headings/index.html.erb
@@ -34,13 +34,7 @@
<%= heading.allow_custom_content ? t("admin.shared.true_value") : t("admin.shared.false_value") %>
- <%= link_to t("admin.actions.edit"),
- edit_admin_budget_group_heading_path(@budget, @group, heading),
- class: "button hollow" %>
- <%= link_to t("admin.actions.delete"),
- admin_budget_group_heading_path(@budget, @group, heading),
- method: :delete,
- class: "button hollow alert" %>
+ <%= render "shared/table_actions", record: heading, actions: [:edit, :destroy] %>
|
<% end %>
diff --git a/app/views/admin/dashboard/actions/index.html.erb b/app/views/admin/dashboard/actions/index.html.erb
index 7a4a736c4..2bf3a91d9 100644
--- a/app/views/admin/dashboard/actions/index.html.erb
+++ b/app/views/admin/dashboard/actions/index.html.erb
@@ -32,14 +32,7 @@
<%= number_with_delimiter(action.required_supports, delimiter: ".") %> |
<%= action.order %> |
- <%= link_to t("admin.dashboard.actions.index.edit"),
- edit_admin_dashboard_action_path(action),
- class: "button hollow" %>
- <%= link_to t("admin.dashboard.actions.index.delete"),
- admin_dashboard_action_path(action),
- method: :delete,
- class: "button hollow alert",
- data: { confirm: t("admin.actions.confirm") } %>
+ <%= render "shared/table_actions", record: action, actions: [:edit, :destroy] %>
|
<% end %>
diff --git a/app/views/admin/geozones/index.html.erb b/app/views/admin/geozones/index.html.erb
index 5c2162a02..3db62760a 100644
--- a/app/views/admin/geozones/index.html.erb
+++ b/app/views/admin/geozones/index.html.erb
@@ -22,17 +22,7 @@
<%= geozone.census_code %> |
<%= geozone.html_map_coordinates %> |
-
- <%= link_to t("admin.geozones.index.edit"),
- edit_admin_geozone_path(geozone),
- class: "button hollow expanded" %>
-
-
- <%= link_to t("admin.geozones.index.delete"),
- admin_geozone_path(geozone),
- method: :delete,
- class: "button hollow alert expanded" %>
-
+ <%= render "shared/table_actions", record: geozone, actions: [:edit, :destroy] %>
|
<% end %>
diff --git a/app/views/admin/homepage/_card.html.erb b/app/views/admin/homepage/_card.html.erb
index 7e5481a08..2b1c64453 100644
--- a/app/views/admin/homepage/_card.html.erb
+++ b/app/views/admin/homepage/_card.html.erb
@@ -17,14 +17,6 @@
<% end %>
- <%= link_to t("admin.actions.edit"),
- edit_admin_widget_card_path(card),
- class: "button hollow" %>
-
- <%= link_to t("admin.actions.delete"),
- admin_widget_card_path(card),
- method: :delete,
- data: { confirm: t("admin.actions.confirm") },
- class: "button hollow alert" %>
+ <%= render "shared/table_actions", record: card, actions: [:edit, :destroy] %>
|
diff --git a/app/views/admin/legislation/processes/index.html.erb b/app/views/admin/legislation/processes/index.html.erb
index 5e2a647c3..d57e85994 100644
--- a/app/views/admin/legislation/processes/index.html.erb
+++ b/app/views/admin/legislation/processes/index.html.erb
@@ -35,9 +35,7 @@
<%= I18n.l process.end_date %> |
<%= process.total_comments %> |
- <%= link_to t("admin.legislation.processes.index.delete"), admin_legislation_process_path(process),
- method: :delete,
- class: "button hollow alert expanded" %>
+ <%= render "shared/table_actions", record: process, actions: [:destroy] %>
|
<% end %>
diff --git a/app/views/admin/local_census_records/_local_census_record.html.erb b/app/views/admin/local_census_records/_local_census_record.html.erb
index e8bd618f3..22beea26e 100644
--- a/app/views/admin/local_census_records/_local_census_record.html.erb
+++ b/app/views/admin/local_census_records/_local_census_record.html.erb
@@ -12,14 +12,6 @@
<%= local_census_record.postal_code %>
- <%= link_to t("admin.actions.edit"),
- edit_admin_local_census_record_path(local_census_record),
- class: "button hollow" %>
-
- <%= link_to t("admin.actions.delete"),
- admin_local_census_record_path(local_census_record),
- method: :delete,
- class: "button hollow alert",
- data: { confirm: t("admin.actions.confirm") } %>
+ <%= render "shared/table_actions", record: local_census_record, actions: [:edit, :destroy] %>
|
diff --git a/app/views/admin/managers/index.html.erb b/app/views/admin/managers/index.html.erb
index 0ff1971c4..2dc28ffcb 100644
--- a/app/views/admin/managers/index.html.erb
+++ b/app/views/admin/managers/index.html.erb
@@ -22,10 +22,7 @@
<%= manager.email %>
- <%= link_to t("admin.managers.manager.delete"),
- admin_manager_path(manager),
- method: :delete,
- class: "button hollow alert expanded" %>
+ <%= render "shared/table_actions", record: manager, actions: [:destroy] %>
|
<% end %>
diff --git a/app/views/admin/managers/search.html.erb b/app/views/admin/managers/search.html.erb
index bc6005d42..a03d7b72d 100644
--- a/app/views/admin/managers/search.html.erb
+++ b/app/views/admin/managers/search.html.erb
@@ -19,10 +19,7 @@
<%= user.email %> |
<% if user.manager? && user.manager.persisted? %>
- <%= link_to t("admin.managers.manager.delete"),
- admin_manager_path(user.manager),
- method: :delete,
- class: "button hollow alert expanded" %>
+ <%= render "shared/table_actions", record: user.manager, actions: [:destroy] %>
<% else %>
<%= link_to t("admin.managers.manager.add"),
{ controller: "admin/managers",
diff --git a/app/views/admin/milestone_statuses/index.html.erb b/app/views/admin/milestone_statuses/index.html.erb
index bf1940a64..e7bf0c720 100644
--- a/app/views/admin/milestone_statuses/index.html.erb
+++ b/app/views/admin/milestone_statuses/index.html.erb
@@ -23,12 +23,7 @@
<%= status.description %>
|
- <%= link_to t("admin.statuses.index.edit"),
- edit_admin_milestone_status_path(status),
- class: "button hollow" %>
- <%= link_to t("admin.statuses.index.delete"),
- admin_milestone_status_path(status),
- method: :delete, class: "button hollow alert" %>
+ <%= render "shared/table_actions", record: status, actions: [:edit, :destroy] %>
|
<% end %>
diff --git a/app/views/admin/moderators/index.html.erb b/app/views/admin/moderators/index.html.erb
index 770fd77c5..0594fb2d3 100644
--- a/app/views/admin/moderators/index.html.erb
+++ b/app/views/admin/moderators/index.html.erb
@@ -24,10 +24,7 @@
<%= moderator.email %>
- <%= link_to t("admin.moderators.moderator.delete"),
- admin_moderator_path(moderator),
- method: :delete,
- class: "button hollow alert expanded" %>
+ <%= render "shared/table_actions", record: moderator, actions: [:destroy] %>
|
<% end %>
diff --git a/app/views/admin/moderators/search.html.erb b/app/views/admin/moderators/search.html.erb
index 358e67043..f07ab647b 100644
--- a/app/views/admin/moderators/search.html.erb
+++ b/app/views/admin/moderators/search.html.erb
@@ -19,10 +19,7 @@
<%= user.email %> |
<% if user.moderator? && user.moderator.persisted? %>
- <%= link_to t("admin.moderators.moderator.delete"),
- admin_moderator_path(user.moderator),
- method: :delete,
- class: "button hollow alert expanded" %>
+ <%= render "shared/table_actions", record: user.moderator, actions: [:destroy] %>
<% else %>
<%= link_to t("admin.moderators.moderator.add"),
{ controller: "admin/moderators",
diff --git a/app/views/admin/newsletters/index.html.erb b/app/views/admin/newsletters/index.html.erb
index 7bbabde90..a1ac52803 100644
--- a/app/views/admin/newsletters/index.html.erb
+++ b/app/views/admin/newsletters/index.html.erb
@@ -29,18 +29,10 @@
<% end %>
|
-
- <%= link_to t("admin.newsletters.index.edit"), edit_admin_newsletter_path(newsletter),
- class: "button hollow expanded" %>
-
-
- <%= link_to t("admin.newsletters.index.delete"), admin_newsletter_path(newsletter),
- method: :delete, class: "button hollow alert expanded" %>
-
-
+ <%= render "shared/table_actions", record: newsletter, actions: [:edit, :destroy] %>
+
<%= link_to t("admin.newsletters.index.preview"), admin_newsletter_path(newsletter),
- class: "button expanded" %>
-
+ class: "button" %>
|
<% end %>
diff --git a/app/views/admin/poll/polls/_questions.html.erb b/app/views/admin/poll/polls/_questions.html.erb
index ee5f174ed..6aacb275e 100644
--- a/app/views/admin/poll/polls/_questions.html.erb
+++ b/app/views/admin/poll/polls/_questions.html.erb
@@ -30,19 +30,9 @@
<% end %>
-
- <%= link_to t("admin.polls.show.edit_answers"), admin_question_path(question),
- class: "button hollow expanded" %>
-
-
- <%= link_to t("shared.edit"), edit_admin_question_path(question),
- class: "button hollow expanded" %>
-
-
- <%= link_to t("shared.delete"), admin_question_path(question),
- class: "button hollow alert expanded",
- method: :delete %>
-
+ <%= link_to t("admin.polls.show.edit_answers"), admin_question_path(question),
+ class: "button hollow" %>
+ <%= render "shared/table_actions", record: question, actions: [:edit, :destroy] %>
|
<% end %>
diff --git a/app/views/admin/poll/questions/_questions.html.erb b/app/views/admin/poll/questions/_questions.html.erb
index 489a700f6..0099b3c10 100644
--- a/app/views/admin/poll/questions/_questions.html.erb
+++ b/app/views/admin/poll/questions/_questions.html.erb
@@ -27,12 +27,7 @@
<% end %>
-
- <%= link_to t("shared.edit"), edit_admin_question_path(question), class: "button hollow expanded" %>
-
-
- <%= link_to t("shared.delete"), admin_question_path(question), class: "button hollow alert expanded", method: :delete %>
-
+ <%= render "shared/table_actions", record: question, actions: [:edit, :destroy] %>
|
<% end %>
diff --git a/app/views/admin/poll/questions/answers/videos/index.html.erb b/app/views/admin/poll/questions/answers/videos/index.html.erb
index 0ea64c570..d74762dda 100644
--- a/app/views/admin/poll/questions/answers/videos/index.html.erb
+++ b/app/views/admin/poll/questions/answers/videos/index.html.erb
@@ -29,15 +29,7 @@
<%= video.title %> |
<%= link_to "#{video.url}", video.url %> |
-
- <%= link_to t("shared.edit"),
- edit_admin_video_path(video),
- class: "button hollow" %>
-
- <%= link_to t("shared.delete"),
- admin_video_path(video),
- class: "button hollow alert",
- method: :delete %>
+ <%= render "shared/table_actions", record: video, actions: [:edit, :destroy] %>
|
<% end %>
diff --git a/app/views/admin/progress_bars/_progress_bars.html.erb b/app/views/admin/progress_bars/_progress_bars.html.erb
index 1ac03e331..e0d87e3ee 100644
--- a/app/views/admin/progress_bars/_progress_bars.html.erb
+++ b/app/views/admin/progress_bars/_progress_bars.html.erb
@@ -36,14 +36,7 @@
<%= number_to_percentage(progress_bar.percentage, strip_insignificant_zeros: true) %>
- <%= link_to t("admin.actions.edit"),
- admin_polymorphic_path(progress_bar, action: :edit),
- class: "button hollow" %>
-
- <%= link_to t("admin.actions.delete"),
- admin_polymorphic_path(progress_bar),
- method: :delete,
- class: "button hollow alert" %>
+ <%= render "shared/table_actions", record: progress_bar, actions: [:edit, :destroy] %>
|
<% end %>
diff --git a/app/views/admin/valuator_groups/_group.html.erb b/app/views/admin/valuator_groups/_group.html.erb
index ea69515f7..ea67ffd76 100644
--- a/app/views/admin/valuator_groups/_group.html.erb
+++ b/app/views/admin/valuator_groups/_group.html.erb
@@ -6,12 +6,6 @@
<%= group.valuators.count %>
- <%= link_to t("admin.actions.delete"),
- admin_valuator_group_path(group),
- method: :delete, class: "button hollow alert" %>
-
- <%= link_to t("admin.actions.edit"),
- edit_admin_valuator_group_path(group),
- class: "button hollow" %>
+ <%= render "shared/table_actions", record: group, actions: [:edit, :destroy] %>
|
diff --git a/app/views/admin/valuators/_valuator_row.html.erb b/app/views/admin/valuators/_valuator_row.html.erb
index a09e9fd51..7b0ce40bf 100644
--- a/app/views/admin/valuators/_valuator_row.html.erb
+++ b/app/views/admin/valuators/_valuator_row.html.erb
@@ -19,12 +19,6 @@
<%= valuator_abilities(valuator) %>
- <%= link_to t("admin.actions.edit"),
- edit_admin_valuator_path(valuator),
- class: "button hollow" %>
- <%= link_to t("admin.valuators.valuator.delete"),
- admin_valuator_path(valuator),
- method: :delete,
- class: "button hollow alert" %>
+ <%= render "shared/table_actions", record: valuator, actions: [:edit, :destroy] %>
|
diff --git a/app/views/shared/_table_actions.html.erb b/app/views/shared/_table_actions.html.erb
new file mode 100644
index 000000000..d12beda51
--- /dev/null
+++ b/app/views/shared/_table_actions.html.erb
@@ -0,0 +1,13 @@
+<% if actions.include?(:edit) %>
+ <%= link_to t("admin.actions.edit"),
+ admin_polymorphic_path(record, action: :edit),
+ class: "button hollow" %>
+<% end %>
+
+<% if actions.include?(:destroy) %>
+ <%= link_to t("admin.actions.delete"),
+ admin_polymorphic_path(record),
+ method: :delete,
+ class: "button hollow alert",
+ data: { confirm: t("admin.actions.confirm") } %>
+<% end %>
diff --git a/config/locales/en/admin.yml b/config/locales/en/admin.yml
index 2ec0222ef..6cbf33afe 100644
--- a/config/locales/en/admin.yml
+++ b/config/locales/en/admin.yml
@@ -297,8 +297,6 @@ en:
table_name: Name
table_description: Description
table_actions: Actions
- delete: Delete
- edit: Edit
edit:
title: Edit milestone status
update:
@@ -362,7 +360,6 @@ en:
description: "When users create proposals they can access a dashboard of their proposal, where you can propose resources and recommendations to get support for their idea."
create: Create resource or action
edit: Edit
- delete: Delete
active: 'Yes'
inactive: 'No'
title: Resources and actions
@@ -497,7 +494,6 @@ en:
banner_title: Header colors
index:
create: New process
- delete: Delete
title: Collaborative legislation
filters:
active: Active
@@ -629,7 +625,6 @@ en:
no_managers: There are no managers.
manager:
add: Add
- delete: Delete
search:
title: "Managers: User search"
menu:
@@ -709,7 +704,6 @@ en:
no_administrators: There are no administrators.
administrator:
add: Add
- delete: Delete
restricted_removal: "Sorry, you can't remove yourself from the administrators"
search:
title: "Administrators: User search"
@@ -724,7 +718,6 @@ en:
no_moderators: There are no moderators.
moderator:
add: Add
- delete: Delete
search:
title: "Moderators: User search"
segment_recipient:
@@ -751,8 +744,6 @@ en:
sent: Sent
actions: Actions
draft: Draft
- edit: Edit
- delete: Delete
preview: Preview
empty_newsletters: There are no newsletters to show
new:
@@ -788,8 +779,6 @@ en:
sent: Sent
actions: Actions
draft: Draft
- edit: Edit
- delete: Delete
preview: Preview
view: View
empty_notifications: There are no notifications to show
@@ -887,7 +876,6 @@ en:
can_edit_dossier: "Can edit dossier"
valuator:
add: Add to valuators
- delete: Delete
search:
title: "Valuators: User search"
form:
@@ -1309,8 +1297,6 @@ en:
index:
title: Geozone
create: Create geozone
- edit: Edit
- delete: Delete
geozone:
name: Name
external_code: External code
diff --git a/config/locales/es/admin.yml b/config/locales/es/admin.yml
index 6323c3b74..575518f56 100644
--- a/config/locales/es/admin.yml
+++ b/config/locales/es/admin.yml
@@ -297,8 +297,6 @@ es:
table_name: Nombre
table_description: Descripción
table_actions: Acciones
- delete: Borrar
- edit: Editar
edit:
title: Editar estado de seguimiento
update:
@@ -362,7 +360,6 @@ es:
description: "Cuando los usuarios crean propuestas pueden acceder a un panel de progreso de su propuesta, donde se le puede proponer recursos y recomendaciones para conseguir apoyos a su idea."
create: Crear recurso o acción
edit: Editar
- delete: Borrar
active: 'Si'
inactive: 'No'
title: Recursos y acciones
@@ -497,7 +494,6 @@ es:
banner_title: Colores del encabezado
index:
create: Nuevo proceso
- delete: Borrar
title: Procesos de legislación colaborativa
filters:
active: Activos
@@ -628,7 +624,6 @@ es:
no_managers: No hay gestores.
manager:
add: Añadir como gestor
- delete: Borrar
search:
title: "Gestores: Búsqueda de usuarios"
menu:
@@ -708,7 +703,6 @@ es:
no_administrators: No hay administradores.
administrator:
add: Añadir como Administrador
- delete: Borrar
restricted_removal: "Lo sentimos, no puedes eliminarte a ti mismo de la lista"
search:
title: "Administradores: Búsqueda de usuarios"
@@ -723,7 +717,6 @@ es:
no_moderators: No hay moderadores.
moderator:
add: Añadir como Moderador
- delete: Borrar
search:
title: "Moderadores: Búsqueda de usuarios"
segment_recipient:
@@ -750,8 +743,6 @@ es:
sent: Enviado
actions: Acciones
draft: Borrador
- edit: Editar
- delete: Borrar
preview: Previsualizar
empty_newsletters: No hay newsletters para mostrar
new:
@@ -787,8 +778,6 @@ es:
sent: Enviado
actions: Acciones
draft: Borrador
- edit: Editar
- delete: Borrar
preview: Previsualizar
view: Visualizar
empty_notifications: No hay notificaciones para mostrar
@@ -886,7 +875,6 @@ es:
can_edit_dossier: "Puede editar informes"
valuator:
add: Añadir como evaluador
- delete: Borrar
search:
title: "Evaluadores: Búsqueda de usuarios"
form:
@@ -1308,8 +1296,6 @@ es:
index:
title: Zonas
create: Crear una zona
- edit: Editar
- delete: Borrar
geozone:
name: Nombre
external_code: Código externo