<script src="https://cdnjs.cloudflare.com/ajax/libs/jscolor/2.0.4/jscolor.min.js"
  integrity="sha256-CJWfUCeP3jLdUMVNUll6yQx37gh9AKmXTRxvRf7jzro=" crossorigin="anonymous"></script>
<style>
  textarea {
    height: 140px;
  }
</style>
<h1>Tags</h1>
<%= form_tag("/internal/tags", method: "get") do %>
  <%= label_tag(:search, "Find by tag name:") %>
  <%= text_field_tag(:search, params[:search]) %>
  <% if params[:state].present? %>
    <%= hidden_field_tag(:state, params[:state]) %>
  <% end %>
  <%= submit_tag("Search") %>
<% end %>

<h3>
  <a href="/internal/tags"
     style="<%= "background: yellow" if params[:state].blank? %>">All</a> |
  <a href="/internal/tags?state=supported"
     style="<%= "background: yellow" if params[:state] == "supported" %>">Supported</a> |
  <a href="/internal/tags?state=unsupported"
     style="<%= "background: yellow" if params[:state] == "unsupported" %>">Unsupported</a> |
</h3>

<%= paginate @tags %>
<div class="wrapper" style="font-weight: 600; border-bottom: 2px solid black;">
  <div>Tag</div>
  <div>ID</div>
  <div>Alias For</div>
  <div>Taggings Count</div>
  <div>Category</div>
  <div>Is Moderated?</div>
</div>
<% @tags.each do |tag| %>
  <div class="wrapper" style="border-bottom: 1px solid grey; padding: 10px;">
    <div class="grid-item"><a href="/internal/tags/<%= tag.id %>" target="_blank">#<%= tag.name %></a></div>
    <div><%= tag.id %></div>
    <div><%= tag.alias_for %></div>
    <div><%= tag.taggings_count %></div>
    <div><%= tag.category %></div>
    <div><%= tag.tag_moderator_ids.any? %></div>
  </div>
<% end %>
<%= paginate @tags %>
