<% content_for :title, "Child tags of #{@tag.name}" %>

<h1>Child tags of <span class="<%= tag_classes(@tag, @category) %> is-large"><%= @tag.name %></span></h1>

<%= form_tag tag_children_path(id: @category.id, tag_id: @tag.id), method: :get, class: 'form-inline' do %>
  <div class="form-group-horizontal">
    <div class="form-group">
      <%= label_tag :q, 'Search', class: 'form-element' %>
      <%= text_field_tag :q, params[:q], class: 'form-element' %>
    </div>
    <div class="actions has-padding-bottom-1">
      <button type="submit" class="button is-filled is-medium"><i class="fas fa-search"></i><span class="sr-only">Search</span></button>
    </div>
  </div>
<% end %>

<% unless params[:q].present? %>
  <div class="category-meta">
    <h3><%= pluralize(@count, 'tag') %></h3>
    <div class="button-list is-gutterless has-margin-2">
      <%= link_to 'Usage', category_tags_path(@category),
                  class: "button is-muted is-outlined #{params[:hierarchical].nil? ? 'is-active' : ''}" %>
      <%= link_to 'Hierarchy', query_url(hierarchical: '1'),
                  class: "button is-muted is-outlined #{params[:hierarchical].present? ? 'is-active' : ''}" %>
    </div>
  </div>
<% end %>

<%= render 'list' %>

<%= will_paginate @tags, renderer: BootstrapPagination::Rails %>
