<div class="row">
  <div class="col-12">
    <h2>
      <a href="/t/<%= @tag.name %>" style="background:<%= @tag.bg_color_hex %>;color:<%= @tag.text_color_hex %>;">#<%= @tag.name %></a>, tagged <%= @tag.taggings_count %> times.
    </h2>
  </div>
  <div class="col-12">
    <h3>Moderators</h3>
    <% if @tag.tag_moderator_ids.any? %>
      <ul class="list-group-flush">
        <% @tag.tag_moderator_ids.each do |id| %>
            <li class="list-group-item d-flex justify-content-between">
              <a href="/<%= User.find(id).username %>">@<%= User.find(id).username %></a>
              <%= form_for [:internal, @tag] do |f| %>
                <%= f.hidden_field :remove_moderator_id, value: id %>
                <%= f.submit "Remove", class: "btn btn-danger btn-sm" %>
              <% end %>
            </li>
        <% end %>
      </ul>
    <% else %>
      <p>This tag currently has no moderators.</p>
    <% end %>
    <%= form_for [:internal, @tag], html: { class: "form-inline justify-content-between" } do |f| %>
      <div class="form-group">
        <%= f.label "Add Moderator (id):", class: "mr-3" %>
        <%= f.text_field :tag_moderator_id, class: "form-control" %>
      </div>
      <div>
        <%= f.submit "Add Moderator", class: "btn btn-primary" %>
      </div>
    <% end %>
    <hr>
  </div>
  <div class="col-12">
    <%= form_for [:internal, @tag] do |f| %>
      <div class="form-group">
        <%= f.label :supported %>
        <%= f.check_box :supported %>
      </div>
      <div class="form-group">
        <%= f.label :badge_id %>
        <% badges_array = Badge.pluck(:title, :id) %>
        <%= f.select(:badge_id, options_for_select([["None", nil]] + badges_array, @tag.badge_id)) %>
      </div>
      <div class="form-group">
        <%= f.label :category %>
        <%= f.select(:category, options_for_select(Tag.valid_categories, @tag.category)) %>
      </div>
      <div class="form-group">
        <%= f.label :social_preview_template %>
        <%= f.select(:social_preview_template, Tag.social_preview_templates) %>
      </div>
      <div class="form-group">
        <%= f.label :alias_for %>
        <%= f.text_field :alias_for, class: "form-control" %>
      </div>
      <div class="form-group">
        <%= f.label :pretty_name %>
        <%= f.text_field :pretty_name, class: "form-control" %>
      </div>
      <div class="form-group">
        <%= f.label :short_summary %>
        <%= f.text_field :short_summary, class: "form-control" %>
      </div>
      <div class="form-group">
        <%= f.label :rules_markdown %>
        <br>
        <%= f.text_area :rules_markdown, class: "form-control" %>
      </div>
      <div class="form-group">
        <%= f.label :wiki_body_markdown %>
        <br>
        <%= f.text_area :wiki_body_markdown, class: "form-control" %>
      </div>
      <div class="form-group">
        <%= f.label :bg_color_hex %>
        <%= f.text_field :bg_color_hex, class: "color-picker form-control", required: true %>
      </div>
      <div class="form-group">
        <%= f.label :text_color_hex %>
        <%= f.text_field :text_color_hex, class: "color-picker form-control", required: true %>
      </div>
      <%= f.submit class: "btn btn-primary float-right" %>
    <% end %>
  </div>
</div>
