<h3>Registered API Keys</h3>

<table class="table table-striped">
  <thead>
    <tr>
      <th>Key String</th>
      <th>App Name</th>
      <th>GitHub</th>
      <th>Owner</th>
      <th>Created</th>
      <th colspan="2"></th>
    </tr>
  </thead>
  <tbody>
    <% @keys.each do |key| %>
      <tr>
        <td><%= key.key %></td>
        <td><%= key.app_name %></td>
        <td><%= link_to "Repo", key.github_link %></td>
        <td>
          <% if key.user %>
            <%= key.user.username %>
          <% else %>
            <em>(No owner)</em>
          <% end %>
        </td>
        <td><%= time_ago_in_words(key.created_at) %> ago</td>
        <td><%= link_to "Edit", url_for(:controller => :api_keys, :action => :edit, :id => key.id) %></td>
        <td><%= link_to "Revoke write tokens", url_for(:controller => :api_keys, :action => :revoke_write_tokens, :id => key.id), :method => :delete, :class => "text text-danger", data: { confirm: 'Are you sure?' } %></td>
      </tr>
    <% end %>
  </tbody>
</table>

<h3>Registered API Keys</h3>

<table class="table table-striped">
  <thead>
    <tr>
      <th>Key String</th>
      <th>App Name</th>
      <th>GitHub</th>
      <th>Owner</th>
      <th>Created</th>
      <th colspan="2"></th>
    </tr>
  </thead>
  <tbody>
    <% @keys.each do |key| %>
      <tr>
        <td><%= key.key %></td>
        <td><%= key.app_name %></td>
        <td><%= link_to "Repo", key.github_link %></td>
        <td>
          <% if key.user %>
            <%= key.user.username %>
          <% else %>
            <em>(No owner)</em>
          <% end %>
        </td>
        <td><%= time_ago_in_words(key.created_at) %> ago</td>
        <td><%= link_to "Edit", url_for(:controller => :api_keys, :action => :edit, :id => key.id) %></td>
        <td><%= link_to "Revoke write tokens", url_for(:controller => :api_keys, :action => :revoke_write_tokens, :id => key.id), :method => :delete, :class => "text text-danger", data: { confirm: 'Are you sure?' } %></td>
      </tr>
    <% end %>
  </tbody>
</table>

<%= link_to "New API key", admin_new_key_url %>

Add link to new API key
Add link to new API key
