{% extends '_base.html' %}
{% load helpers %}

{% block header %}
    <div class="row">
        <div class="col-sm-8 col-md-9">
            <ol class="breadcrumb">
                <li><a href="{% url 'extras:tag_list' %}">Tags</a></li>
                <li>{{ tag }}</li>
            </ol>
        </div>
        <div class="col-sm-4 col-md-3">
            <form action="{% url 'extras:tag_list' %}" method="get">
                <div class="input-group">
                    <input type="text" name="q" class="form-control" />
                    <span class="input-group-btn">
                        <button type="submit" class="btn btn-primary">
                            <span class="fa fa-search" aria-hidden="true"></span>
                        </button>
                    </span>
                </div>
            </form>
        </div>
    </div>
    <div class="pull-right">
        {% if perms.taggit.change_tag %}
            <a href="{% url 'extras:tag_edit' slug=tag.slug %}?return_url={% url 'extras:tag' slug=tag.slug %}" class="btn btn-warning">
                <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>
                Edit this tag
            </a>
        {% endif %}
    </div>
    <h1>{% block title %}Tag: {{ tag }}{% endblock %}</h1>
{% endblock %}

{% block content %}
    <div class="row">
        <div class="col-md-6">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <strong>Tag</strong>
                </div>
                <table class="table table-hover panel-body attr-table">
                    <tr>
                        <td>Name</td>
                        <td>
                            {{ tag.name }}
                        </td>
                    </tr>
                    <tr>
                        <td>Slug</td>
                        <td>
                            {{ tag.slug }}
                        </td>
                    </tr>
                    <tr>
                        <td>Tagged Items</td>
                        <td>
                            {{ items_count }}
                        </td>
                    </tr>
                </table>
            </div>
        </div>
        <div class="col-md-6">
            {% include 'panel_table.html' with table=items_table heading='Tagged Objects' %}
        </div>
    </div>
{% endblock %}
