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') %> <%= page_entries_info @officers, entry_name: t('admin.poll_officers.officer.entry_name') %>
</h3> </h3>
<table id="officers"> <% if @officers.any? %>
<thead> <table id="officers">
<tr> <thead>
<th><%= t('admin.poll_officers.officer.name') %></th> <tr>
<th colspan="2"><%= t('admin.poll_officers.officer.email') %></th> <th><%= t('admin.poll_officers.officer.name') %></th>
</tr> <th colspan="2"><%= t('admin.poll_officers.officer.email') %></th>
</thead> </tr>
<tbody> </thead>
<% @officers.each do |officer| %> <tbody>
<tr> <% @officers.each do |officer| %>
<td> <tr>
<%= officer.name %> <td>
</td> <%= officer.name %>
<td> </td>
<%= officer.email %> <td>
</td> <%= officer.email %>
<td class="text-right"> </td>
<% if officer.persisted? %> <td class="text-right">
<%= link_to t('admin.poll_officers.officer.delete'), <% if officer.persisted? %>
admin_officer_path(officer), <%= link_to t('admin.poll_officers.officer.delete'),
method: :delete, admin_officer_path(officer),
class: "button hollow alert" method: :delete,
%> class: "button hollow alert"
<% else %> %>
<%= link_to t('admin.poll_officers.officer.add'), <% else %>
{ controller: "admin/poll/officers", action: :create, <%= link_to t('admin.poll_officers.officer.add'),
user_id: officer.user_id }, { controller: "admin/poll/officers", action: :create,
method: :post, user_id: officer.user_id },
class: "button success" %> method: :post,
<% end %> class: "button success" %>
</td> <% end %>
</tr> </td>
<% end %> </tr>
</tbody> <% end %>
</table> </tbody>
</table>
<%= paginate @officers %> <%= paginate @officers %>
<% end %>