<div class="toolbar" data-hook="toolbar">
  <ul class="actions">
    <li>
      <p><%= button_link_to t(:new_user), new_object_url, :icon => 'add', :id => 'admin_new_user_link' %></p>
    </li>
  </ul>
  <br class="clear" />
</div>

<h1><%= t(:listing_users) %></h1>

<table class="index" id="listing_users" data-hook>
  <thead>
    <tr data-hook="admin_users_index_headers">
      <th><%= sort_link @search,:email, t(:user), {}, {:title => 'users_email_title'} %></th>
      <th data-hook="admin_users_index_header_actions"></th>
    </tr>
  </thead>
  <tbody>
    <% @users.each do |user|%>
      <tr id="<%= dom_id user %>" data-hook="admin_users_index_rows">
        <td width="350px" class='user_email'><%=link_to user.email, object_url(user) %></td>
        <td data-hook="admin_users_index_row_actions">
          <%= link_to_edit user, :class => 'edit' %> &nbsp;
          <%= link_to_delete user %>
        </td>
      </tr>
    <% end %>
  </tbody>
</table>

<%= paginate @users %>


<% content_for :sidebar do %>
  <div class="box" data-hook="admin_users_index_search">
    <h3><%= t(:search) %></h3>
    <% @search = Spree::User.search %>
    <%= form_for [:admin, @search] do |f| %>
      <p>
        <%= t(:email) %><br />
        <%= f.text_field :email_contains, :size =>18 %>
      </p>
      <div data-hook="admin_users_index_search_buttons">
        <p><%= button t(:search) %></p>
      </div>
    <% end %>
  </div>
<% end %>
