adds complete Booth management to admin

This commit is contained in:
Juanjo Bazán
2016-12-02 14:28:39 +01:00
parent 6f986f3750
commit f67f058b57
11 changed files with 58 additions and 142 deletions

View File

@@ -1,55 +1,15 @@
<%= render 'shared/back_link' %>
<%= back_link_to admin_booths_path %>
<div class="clear"></div>
<h2 class="inline-block">
<%= @booth.name %>
</h2>
<%= link_to t("admin.actions.edit"),
edit_admin_poll_booth_path(@poll, @booth),
edit_admin_booth_path(@booth),
class: "button hollow float-right" %>
<p>
<strong><%= t("admin.booths.show.location") %></strong>:
<%= @booth.location %>
</p>
<h3><%= t("admin.booths.show.officers_list") %></h3>
<% if @booth.officers.empty? %>
<div class="callout primary">
<%= t("admin.booths.show.no_officers") %>
</div>
<% end %>
<div class="small-12 column">
<%= form_for @booth, url: admin_poll_booth_path(@poll, @booth) do |f| %>
<%= f.label :officer_ids, t("admin.spending_proposals.edit.assigned_valuators") %>
<%= f.collection_check_boxes :officer_ids, @officers, :id, :email do |b| %>
<% b.label { b.check_box + truncate(officer_label(b.object), length: 60) } %>
<% end %>
<%= f.submit t("admin.booths.show.assign_officer"), class: "button success" %>
<% end %>
</div>
<table id="assigned_officers">
<% @booth.officers.each do |officer| %>
<tr id="officer_<%= officer.id %>" class="officer">
<td>
<%= officer.name %>
</td>
<td>
<%= officer.email %>
</td>
<td class="text-right">
<%= link_to t('admin.poll_officers.officer.delete'), "#", class: "button hollow alert" %>
<%# link_to t('admin.poll_officers.officer.delete'),
admin_poll_officer_path(Poll.last, officer),
method: :delete,
class: "button hollow alert"
%>
</td>
</tr>
<% end %>
</table>