Extract select proposal button into a partial

This commit is contained in:
Javi Martín
2018-09-17 17:23:31 +02:00
parent 9df201780d
commit 806b1fb3ca
2 changed files with 9 additions and 10 deletions

View File

@@ -19,16 +19,7 @@
<td class="text-center"><%= proposal.id %></td>
<td><%= proposal.title %></td>
<td class="text-center"><%= proposal.cached_votes_up %></td>
<td>
<% if proposal.selected?
button_text = t("admin.legislation.proposals.index.selected")
clas = 'button expanded'
else
button_text = t("admin.legislation.proposals.index.select")
clas = 'button hollow expanded'
end %>
<%= link_to button_text, admin_legislation_process_proposal_path(@process, proposal), method: 'PUT', class: clas %>
</td>
<td><%= render "select_proposal", proposal: proposal %></td>
</tr>
<% end %>
</tbody>

View File

@@ -0,0 +1,8 @@
<% if proposal.selected?
button_text = t("admin.legislation.proposals.index.selected")
clas = 'button expanded'
else
button_text = t("admin.legislation.proposals.index.select")
clas = 'button hollow expanded'
end %>
<%= link_to button_text, admin_legislation_process_proposal_path(proposal.process, proposal), method: 'PUT', class: clas %>