improves admin administrators views
This commit is contained in:
@@ -2,45 +2,47 @@
|
||||
|
||||
<%= render 'admin/shared/user_search', url: search_admin_administrators_path %>
|
||||
|
||||
<% if @administrators.any? %>
|
||||
<h3 class="margin"><%= page_entries_info @administrators %></h3>
|
||||
<div id="administrators">
|
||||
<% if @administrators.any? %>
|
||||
<h3 class="margin"><%= page_entries_info @administrators %></h3>
|
||||
|
||||
<table id="administrators">
|
||||
<thead>
|
||||
<th scope="col"><%= t("admin.administrators.index.name") %></th>
|
||||
<th scope="col"><%= t("admin.administrators.index.email") %></th>
|
||||
<th scope="col" class="small-3"><%= t("admin.shared.actions") %></th>
|
||||
</thead>
|
||||
<% @administrators.each do |administrator| %>
|
||||
<tr>
|
||||
<td>
|
||||
<%= administrator.name %>
|
||||
</td>
|
||||
<td>
|
||||
<%= administrator.email %>
|
||||
</td>
|
||||
<td>
|
||||
<% if administrator.persisted? %>
|
||||
<%= link_to t('admin.administrators.administrator.delete'),
|
||||
admin_administrator_path(administrator),
|
||||
method: :delete,
|
||||
class: "button hollow alert expanded"
|
||||
%>
|
||||
<% else %>
|
||||
<%= link_to t('admin.administrators.administrator.add'),
|
||||
{ controller: "admin/administrators", action: :create,
|
||||
user_id: administrator.user_id },
|
||||
method: :post,
|
||||
class: "button success expanded" %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
<table>
|
||||
<thead>
|
||||
<th scope="col"><%= t("admin.administrators.index.name") %></th>
|
||||
<th scope="col"><%= t("admin.administrators.index.email") %></th>
|
||||
<th scope="col" class="small-3"><%= t("admin.shared.actions") %></th>
|
||||
</thead>
|
||||
<% @administrators.each do |administrator| %>
|
||||
<tr>
|
||||
<td>
|
||||
<%= administrator.name %>
|
||||
</td>
|
||||
<td>
|
||||
<%= administrator.email %>
|
||||
</td>
|
||||
<td>
|
||||
<% if administrator.persisted? %>
|
||||
<%= link_to t('admin.administrators.administrator.delete'),
|
||||
admin_administrator_path(administrator),
|
||||
method: :delete,
|
||||
class: "button hollow alert expanded"
|
||||
%>
|
||||
<% else %>
|
||||
<%= link_to t('admin.administrators.administrator.add'),
|
||||
{ controller: "admin/administrators", action: :create,
|
||||
user_id: administrator.user_id },
|
||||
method: :post,
|
||||
class: "button success expanded" %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
|
||||
<%= paginate @administrators %>
|
||||
<% else %>
|
||||
<div class="callout primary margin">
|
||||
<%= t("admin.administrators.index.no_administrators") %>
|
||||
</div>
|
||||
<% end %>
|
||||
<%= paginate @administrators %>
|
||||
<% else %>
|
||||
<div class="callout primary margin">
|
||||
<%= t("admin.administrators.index.no_administrators") %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
@@ -2,28 +2,43 @@
|
||||
|
||||
<%= render 'admin/shared/user_search', url: search_admin_administrators_path %>
|
||||
|
||||
<h3><%= page_entries_info @users %></h3>
|
||||
<div id="administrators">
|
||||
<% if @users.any? %>
|
||||
<h3 class="margin"><%= page_entries_info @users %></h3>
|
||||
|
||||
<table id="administrators">
|
||||
<% @users.each do |user| %>
|
||||
<tr>
|
||||
<td><%= user.name %></td>
|
||||
<td><%= user.email %></td>
|
||||
<td class="text-right">
|
||||
<% if user.administrator? && user.administrator.persisted? %>
|
||||
<%= link_to t('admin.administrators.administrator.delete'),
|
||||
admin_administrator_path(user),
|
||||
method: :delete,
|
||||
class: "button hollow alert" %>
|
||||
<% else %>
|
||||
<%= link_to t('admin.administrators.administrator.add'),
|
||||
{ controller: "admin/administrators",
|
||||
action: :create,
|
||||
user_id: user },
|
||||
method: :post,
|
||||
class: "button success" %>
|
||||
<table>
|
||||
<thead>
|
||||
<th scope="col"><%= t("admin.administrators.index.name") %></th>
|
||||
<th scope="col"><%= t("admin.administrators.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 class="text-right">
|
||||
<% if user.administrator? && user.administrator.persisted? %>
|
||||
<%= link_to t('admin.administrators.administrator.delete'),
|
||||
admin_administrator_path(user),
|
||||
method: :delete,
|
||||
class: "button hollow alert expanded" %>
|
||||
<% else %>
|
||||
<%= link_to t('admin.administrators.administrator.add'),
|
||||
{ controller: "admin/administrators",
|
||||
action: :create,
|
||||
user_id: user },
|
||||
method: :post,
|
||||
class: "button success expanded" %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<% else %>
|
||||
<div class="callout alert margin">
|
||||
<%= t("admin.shared.no_search_results") %>
|
||||
</div>
|
||||
<% end %>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
@@ -60,7 +60,7 @@ feature 'Admin administrators' do
|
||||
click_button 'Search'
|
||||
|
||||
expect(page).to have_content('Administrators: User search')
|
||||
expect(page).to have_content('users cannot be found')
|
||||
expect(page).to have_content('No results found')
|
||||
expect(page).to_not have_content(@administrator1.name)
|
||||
expect(page).to_not have_content(@administrator2.name)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user