<% @title = t('user.list.title') %>

<h1><%= t('user.list.heading') %></h1>

<% unless @users.empty? %>
  <%= form_tag do %>
    <%= hidden_field_tag :status, params[:status] if params[:status] %>
    <%= hidden_field_tag :ip, params[:ip] if params[:ip] %>
    <%= hidden_field_tag :page, params[:page] if params[:page] %>
    <table id="user_list">
      <tr>
        <td colspan="2">
          <%= t 'user.list.showing',
              :page => @user_pages.current_page.number,
              :first_item => @user_pages.current_page.first_item,
              :last_item => @user_pages.current_page.last_item,
              :items => @user_pages.item_count,
              :count => @user_pages.current_page.last_item - @user_pages.current_page.first_item + 1
          %>
          <% if @user_pages.page_count > 1 %>
          | <%= raw pagination_links_each(@user_pages, {}) { |n| link_to n, params.merge(:page => n) } %>
          <% end %>
        </td>
        <td>
          <%= check_box_tag "user_all", "1", false %>
        </td>
      </tr>
      <%= render :partial => 'user', :collection => @users %>
    </table>

    <div id="user_list_actions">
      <%= submit_tag t('user.list.confirm'), :name => "confirm" %>
      <%= submit_tag t('user.list.hide'), :name => "hide" %>
    </div>

    <script type="text/javascript">
     $("#user_all").change(function () {
       $("#user_list input[type=checkbox]").prop("checked", $("#user_all").prop("checked"));
     });
    </script>
  <% end %>
<% else %>
  <p><%= t "user.list.empty" %></p>
<% end %>
