Share helper between class Proposal and Legislation::Proposal
This commit is contained in:
@@ -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),
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<th class="text-center"><%= t("admin.legislation.proposals.index.id") %></th>
|
||||
<th><%= t("admin.legislation.proposals.index.title") %></th>
|
||||
<th class="text-center"><%= t("admin.legislation.proposals.index.supports") %></th>
|
||||
<th><%= t("admin.legislation.proposals.index.selected") %></th>
|
||||
<th><%= t("admin.proposals.index.selected") %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
<%= link_to_toggle_legislation_proposal_selection(proposal) %>
|
||||
<%= link_to_toggle_proposal_selection(proposal) %>
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user