hides table if there are no officers
This commit is contained in:
@@ -12,40 +12,42 @@
|
||||
<%= page_entries_info @officers, entry_name: t('admin.poll_officers.officer.entry_name') %>
|
||||
</h3>
|
||||
|
||||
<table id="officers">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><%= t('admin.poll_officers.officer.name') %></th>
|
||||
<th colspan="2"><%= t('admin.poll_officers.officer.email') %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @officers.each do |officer| %>
|
||||
<tr>
|
||||
<td>
|
||||
<%= officer.name %>
|
||||
</td>
|
||||
<td>
|
||||
<%= officer.email %>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<% if officer.persisted? %>
|
||||
<%= link_to t('admin.poll_officers.officer.delete'),
|
||||
admin_officer_path(officer),
|
||||
method: :delete,
|
||||
class: "button hollow alert"
|
||||
%>
|
||||
<% else %>
|
||||
<%= link_to t('admin.poll_officers.officer.add'),
|
||||
{ controller: "admin/poll/officers", action: :create,
|
||||
user_id: officer.user_id },
|
||||
method: :post,
|
||||
class: "button success" %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<% if @officers.any? %>
|
||||
<table id="officers">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><%= t('admin.poll_officers.officer.name') %></th>
|
||||
<th colspan="2"><%= t('admin.poll_officers.officer.email') %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @officers.each do |officer| %>
|
||||
<tr>
|
||||
<td>
|
||||
<%= officer.name %>
|
||||
</td>
|
||||
<td>
|
||||
<%= officer.email %>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<% if officer.persisted? %>
|
||||
<%= link_to t('admin.poll_officers.officer.delete'),
|
||||
admin_officer_path(officer),
|
||||
method: :delete,
|
||||
class: "button hollow alert"
|
||||
%>
|
||||
<% else %>
|
||||
<%= link_to t('admin.poll_officers.officer.add'),
|
||||
{ controller: "admin/poll/officers", action: :create,
|
||||
user_id: officer.user_id },
|
||||
method: :post,
|
||||
class: "button success" %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<%= paginate @officers %>
|
||||
<%= paginate @officers %>
|
||||
<% end %>
|
||||
Reference in New Issue
Block a user