adds officer-polls relation and spec
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
class Poll < ActiveRecord::Base
|
||||
has_many :booth_assignments, class_name: "Poll::BoothAssignment"
|
||||
has_many :booths, through: :booth_assignments
|
||||
has_many :officer_assignments, class_name: "Poll::OfficerAssignment"
|
||||
has_many :officer_assignments, through: :booth_assignments
|
||||
has_many :officers, through: :officer_assignments
|
||||
|
||||
has_many :voters, through: :booths, class_name: "Poll::Voter"
|
||||
|
||||
@@ -11,28 +11,18 @@
|
||||
<table>
|
||||
<thead>
|
||||
<th><%= t("admin.polls.show.name") %></th>
|
||||
<th><%= t("admin.polls.show.location") %></th>
|
||||
<th><%= t("admin.polls.show.officers") %></th>
|
||||
<th> </th>
|
||||
<th><%= t("admin.polls.show.email") %></th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @poll.officers.each do |officer| %>
|
||||
<tr id="officer_<%= officer.id %>" class="officer">
|
||||
<td>
|
||||
<strong>
|
||||
<%= link_to officer.name, admin_poll_officer_path(@poll, booth) %>
|
||||
<%= officer.name %>
|
||||
</strong>
|
||||
</td>
|
||||
<td>
|
||||
<%= officer.name %>
|
||||
</td>
|
||||
<td>
|
||||
N <%= t("admin.booths.index.officers") %>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<%= link_to t("admin.actions.edit"),
|
||||
edit_admin_poll_officer_path(@poll, officer),
|
||||
class: "button hollow" %>
|
||||
<%= officer.email %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
Reference in New Issue
Block a user