Extract proposals table into a partial
This commit is contained in:
38
app/views/admin/legislation/proposals/_proposals.html.erb
Normal file
38
app/views/admin/legislation/proposals/_proposals.html.erb
Normal file
@@ -0,0 +1,38 @@
|
||||
<% if proposals.any? %>
|
||||
<h3><%= page_entries_info proposals %></h3>
|
||||
|
||||
<%= render 'shared/wide_order_selector', i18n_namespace: "admin.legislation.processes.proposals" %>
|
||||
|
||||
<table class="stack" id="proposals_table">
|
||||
<thead>
|
||||
<tr>
|
||||
<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>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<% proposals.each do |proposal| %>
|
||||
<tr id="<%= dom_id(proposal) %>">
|
||||
<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>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<%= paginate proposals %>
|
||||
<% end %>
|
||||
@@ -11,44 +11,5 @@
|
||||
<%= render 'admin/legislation/processes/subnav', process: @process, active: 'proposals' %>
|
||||
|
||||
<%= render 'form' %>
|
||||
|
||||
<% if @proposals.any? %>
|
||||
<h3><%= page_entries_info @proposals %></h3>
|
||||
|
||||
<%= render 'shared/wide_order_selector', i18n_namespace: "admin.legislation.processes.proposals" %>
|
||||
|
||||
<table class="stack" id="proposals_table">
|
||||
<thead>
|
||||
<tr>
|
||||
<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>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<% @proposals.each do |proposal| %>
|
||||
<tr id="<%= dom_id(proposal) %>">
|
||||
<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>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<%= paginate @proposals %>
|
||||
<% end %>
|
||||
|
||||
<%= render 'proposals', proposals: @proposals %>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user