Share helper between class Proposal and Legislation::Proposal
This commit is contained in:
@@ -11,22 +11,6 @@ module LegislationHelper
|
|||||||
t("proposals.index.start_proposal")
|
t("proposals.index.start_proposal")
|
||||||
end
|
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)
|
def legislation_process_tabs(process)
|
||||||
{
|
{
|
||||||
"info" => edit_admin_legislation_process_path(process),
|
"info" => edit_admin_legislation_process_path(process),
|
||||||
|
|||||||
@@ -73,11 +73,14 @@ module ProposalsHelper
|
|||||||
html_class = "button hollow expanded"
|
html_class = "button hollow expanded"
|
||||||
end
|
end
|
||||||
|
|
||||||
link_to button_text,
|
case proposal.class.to_s
|
||||||
toggle_selection_admin_proposal_path(proposal),
|
when "Proposal"
|
||||||
remote: true,
|
path = toggle_selection_admin_proposal_path(proposal)
|
||||||
method: :patch,
|
when "Legislation::Proposal"
|
||||||
class: html_class
|
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
|
end
|
||||||
|
|
||||||
def css_for_proposal_info_row
|
def css_for_proposal_info_row
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
<th class="text-center"><%= t("admin.legislation.proposals.index.id") %></th>
|
<th class="text-center"><%= t("admin.legislation.proposals.index.id") %></th>
|
||||||
<th><%= t("admin.legislation.proposals.index.title") %></th>
|
<th><%= t("admin.legislation.proposals.index.title") %></th>
|
||||||
<th class="text-center"><%= t("admin.legislation.proposals.index.supports") %></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>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
<%= link_to_toggle_legislation_proposal_selection(proposal) %>
|
<%= link_to_toggle_proposal_selection(proposal) %>
|
||||||
|
|||||||
@@ -556,8 +556,6 @@ en:
|
|||||||
id: Id
|
id: Id
|
||||||
title: Title
|
title: Title
|
||||||
supports: Total supports
|
supports: Total supports
|
||||||
select: Select
|
|
||||||
selected: Selected
|
|
||||||
form:
|
form:
|
||||||
custom_categories: Categories
|
custom_categories: Categories
|
||||||
custom_categories_description: Categories that users can select creating the proposal. Max 160 characteres.
|
custom_categories_description: Categories that users can select creating the proposal. Max 160 characteres.
|
||||||
|
|||||||
@@ -555,8 +555,6 @@ es:
|
|||||||
back: Volver
|
back: Volver
|
||||||
id: Id
|
id: Id
|
||||||
supports: Apoyos totales
|
supports: Apoyos totales
|
||||||
select: Seleccionar
|
|
||||||
selected: Seleccionada
|
|
||||||
form:
|
form:
|
||||||
custom_categories: Categorías
|
custom_categories: Categorías
|
||||||
custom_categories_description: Categorías que el usuario puede seleccionar al crear la propuesta. Máximo 160 caracteres.
|
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