<div class="admin">
  <h2 class="heading"><%= t(".page_heading") %></h2>

  <!--subnav-->
  <%= render "navigation" %>
  <!--/subnav-->

  <%= will_paginate @api_keys %>

  <!--main content-->
  <%= form_tag url_for(controller: "admin/api", action: "index"), method: :get, class: "search", role: "search" do %>
    <p class="note"><%= t(".search_by_name") %></p>
    <dl>
      <dt><%= label_tag "query", t(".search_box.label") %></dt>
      <dd><%= text_field_tag "query", params[:query] %>
        </dd>
    </dl>
    <p class="submit actions"><%= submit_tag t(".actions.find") %></p>
  <% end %>

  <table summary="<%= t(".table.summary") %>">
    <caption><%= t(".table.caption") %></caption>
    <thead>
    <tr>
      <th scope="col"><%= t(".table.headings.name") %></th>
      <th scope="col"><%= t(".table.headings.token") %></th>
      <th scope="col"><%= t(".table.headings.banned") %></th>
      <th scope="col"><%= t(".table.headings.created") %></th>
      <th scope="col"><%= t(".table.headings.updated") %></th>
      <th scope="col"><%= t(".table.headings.actions") %></th>
    </tr>
    </thead>
    <tbody>
    <% @api_keys.each do |api_key| %>
      <tr>
        <th scope="row"><%= api_key.name %></th>
        <td><%= api_key.access_token %></td>
        <td><%= check_box_tag :banned, api_key.banned, api_key.banned, disabled: true %></td>
        <td><%= api_key.created_at %></td>
        <td><%= api_key.updated_at %></td>
        <td>
          <ul class="actions">
            <li><%= link_to t(".table.actions.edit"), edit_admin_api_path(api_key) %></li>
          </ul>
        </td>
      </tr>
    <% end %>
    </tbody>
  </table>
  <!--/content-->

  <%= will_paginate @api_keys %>

</div>
