hides table if there are no officers

This commit is contained in:
Alberto Garcia Cabeza
2016-12-28 12:53:04 +01:00
parent 8e3f80628d
commit 69ab67a81f

View File

@@ -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 %>