Files
grecia/app/views/admin/moderators/search.html.erb
2019-03-19 12:16:50 +01:00

44 lines
1.5 KiB
Plaintext

<h2><%= t("admin.moderators.search.title") %></h2>
<%= render "admin/shared/user_search", url: search_admin_moderators_path %>
<div id="moderators">
<% if @users.any? %>
<h3 class="margin"><%= page_entries_info @users %></h3>
<table id="moderators">
<thead>
<th scope="col"><%= t("admin.moderators.index.name") %></th>
<th scope="col" class="small-6"><%= t("admin.moderators.index.email") %></th>
<th scope="col" class="small-3"><%= t("admin.shared.actions") %></th>
</thead>
<tbody>
<% @users.each do |user| %>
<tr>
<td><%= user.name %></td>
<td><%= user.email %></td>
<td>
<% if user.moderator? && user.moderator.persisted? %>
<%= link_to t("admin.moderators.moderator.delete"),
admin_moderator_path(user),
method: :delete,
class: "button hollow alert expanded" %>
<% else %>
<%= link_to t("admin.moderators.moderator.add"),
{ controller: "admin/moderators",
action: :create,
user_id: user },
method: :post,
class: "button success expanded" %>
<% end %>
</td>
</tr>
<% end %>
</table>
<% else %>
<div class="callout alert margin">
<%= t("admin.shared.no_search_results") %>
</div>
<% end %>
</div>