diff --git a/app/helpers/legislation_helper.rb b/app/helpers/legislation_helper.rb index 415de8e74..943f1b35d 100644 --- a/app/helpers/legislation_helper.rb +++ b/app/helpers/legislation_helper.rb @@ -11,22 +11,6 @@ module LegislationHelper t("proposals.index.start_proposal") end - def link_to_toggle_legislation_proposal_selection(proposal) - if proposal.selected? - button_text = t("admin.legislation.proposals.index.selected") - html_class = "button expanded" - else - button_text = t("admin.legislation.proposals.index.select") - html_class = "button hollow expanded" - end - - link_to button_text, - toggle_selection_admin_legislation_process_proposal_path(proposal.process, proposal), - remote: true, - method: :patch, - class: html_class - end - def legislation_process_tabs(process) { "info" => edit_admin_legislation_process_path(process), diff --git a/app/helpers/proposals_helper.rb b/app/helpers/proposals_helper.rb index 3cc0ba03a..9f0b36815 100644 --- a/app/helpers/proposals_helper.rb +++ b/app/helpers/proposals_helper.rb @@ -73,11 +73,14 @@ module ProposalsHelper html_class = "button hollow expanded" end - link_to button_text, - toggle_selection_admin_proposal_path(proposal), - remote: true, - method: :patch, - class: html_class + case proposal.class.to_s + when "Proposal" + path = toggle_selection_admin_proposal_path(proposal) + when "Legislation::Proposal" + path = toggle_selection_admin_legislation_process_proposal_path(proposal.process, proposal) + end + + link_to button_text, path, remote: true, method: :patch, class: html_class end def css_for_proposal_info_row diff --git a/app/views/admin/legislation/proposals/_proposals.html.erb b/app/views/admin/legislation/proposals/_proposals.html.erb index 8682eeab6..a740cbd38 100644 --- a/app/views/admin/legislation/proposals/_proposals.html.erb +++ b/app/views/admin/legislation/proposals/_proposals.html.erb @@ -9,7 +9,7 @@ <%= t("admin.legislation.proposals.index.id") %> <%= t("admin.legislation.proposals.index.title") %> <%= t("admin.legislation.proposals.index.supports") %> - <%= t("admin.legislation.proposals.index.selected") %> + <%= t("admin.proposals.index.selected") %> diff --git a/app/views/admin/legislation/proposals/_select_proposal.html.erb b/app/views/admin/legislation/proposals/_select_proposal.html.erb index 0d5eb845d..d5d2069ab 100644 --- a/app/views/admin/legislation/proposals/_select_proposal.html.erb +++ b/app/views/admin/legislation/proposals/_select_proposal.html.erb @@ -1 +1 @@ -<%= link_to_toggle_legislation_proposal_selection(proposal) %> +<%= link_to_toggle_proposal_selection(proposal) %> diff --git a/config/locales/en/admin.yml b/config/locales/en/admin.yml index 4376979ba..81efc4701 100644 --- a/config/locales/en/admin.yml +++ b/config/locales/en/admin.yml @@ -556,8 +556,6 @@ en: id: Id title: Title supports: Total supports - select: Select - selected: Selected form: custom_categories: Categories custom_categories_description: Categories that users can select creating the proposal. Max 160 characteres. diff --git a/config/locales/es/admin.yml b/config/locales/es/admin.yml index 7f63504aa..30a0512a1 100644 --- a/config/locales/es/admin.yml +++ b/config/locales/es/admin.yml @@ -555,8 +555,6 @@ es: back: Volver id: Id supports: Apoyos totales - select: Seleccionar - selected: Seleccionada form: custom_categories: Categorías custom_categories_description: Categorías que el usuario puede seleccionar al crear la propuesta. Máximo 160 caracteres.