<div class="row m-3">
  <div class="col">
    <ul class="nav nav-pills">
      <li class="nav-item">
        <a href="/internal/tags" class="nav-link <%= "active" if params[:state].blank? %>">All</a>
      </li>
      <li class="nav-item">
        <a href="/internal/tags?state=supported" class="nav-link <%= "active" if params[:state] == "supported" %>">Supported</a>
      </li>
      <li class="nav-item">
        <a href="/internal/tags?state=unsupported" class="nav-link <%= "active" if params[:state] == "unsupported" %>">Unsupported</a>
      </li>
    </ul>
  </div>
  <div class="col">
    <%= form_tag(internal_tags_path, method: "get") do %>
      <div class="form-row justify-content-end">
        <div class="form-group">
          <%= text_field_tag(:search, params[:search]) %>
          <% if params[:state].present? %>
            <%= hidden_field_tag(:state, params[:state]) %>
          <% end %>
          <%= submit_tag("Search") %>
        </div>
      </div>
    <% end %>
  </div>
</div>

<%= paginate @tags %>

<table class="table">
  <thead>
    <tr>
      <th scope="col">Tag</th>
      <th scope="col">ID</th>
      <th scope="col">Alias For</th>
      <th scope="col">Taggings Count</th>
      <th scope="col">Category</th>
      <th scope="col">Is Moderated?</th>
    </tr>
  </thead>
  <tbody>
    <% @tags.each do |tag| %>
      <tr>
        <td><%= link_to tag.name, internal_tag_path(tag.id) %></td>
        <td><%= tag.id %></td>
        <td><%= tag.alias_for %></td>
        <td><%= tag.taggings_count %></td>
        <td><%= tag.category %></td>
        <td><%= tag.tag_moderator_ids.any? %></td>
      </tr>
    <% end %>
  </tbody>
</table>

<%= paginate @tags %>
