AlchemyCMS/alchemy-devise

View on GitHub
app/views/alchemy/admin/users/index.html.erb

Summary

Maintainability
Test Coverage
<%= content_for :toolbar do %>
  <%= toolbar_button(
    icon: :plus,
    label: Alchemy.t(:create_user),
    url: alchemy.new_admin_user_path,
    title: Alchemy.t(:create_user),
    hotkey: 'alt+n',
    tooltip_placement: "top-start",
    dialog_options: {
      title: Alchemy.t(:create_user),
      size: "430x560"
    },
    if_permitted_to: [:create, Alchemy::User]
  ) %>
  <%= render "alchemy/admin/partials/search_form" %>
<% end %>

<div id="archive_all" class="resources-table-wrapper">
  <%= render "alchemy/admin/resources/table_header" %>
<% if @users.any? %>

  <table class="list" id="user_list">
    <thead>
      <tr>
        <th class="icon"></th>
        <th class="login">
          <%= sort_link @query, :login, hide_indicator: true %>
        </th>
        <th class="name">
          <%= sort_link @query, :firstname, hide_indicator: true %>
        </th>
        <th>
          <%= sort_link @query, :lastname, hide_indicator: true %>
        </th>
        <th class="email">
          <%= sort_link @query, :email, hide_indicator: true %>
        </th>
        <th><%= Alchemy::User.human_attribute_name('language') %></th>
        <th>
          <%= sort_link @query, :last_sign_in_at, hide_indicator: true %>
        </th>
        <th class="role"><%= Alchemy::User.human_attribute_name('roles') %></th>
        <th class="tools"></th>
      </tr>
    </thead>
    <tbody>
      <%= render partial: 'alchemy/admin/users/user', collection: @users %>
    </tbody>
  </table>

  <%= paginate @users, theme: 'alchemy' %>

<% elsif params[:query] %>

  <div class="info">
    <%= render_icon('info') %>
    <%= Alchemy.t('No users found') %>
  </div>

<% end %>
</div>