{% extends "two_column_body.html" %}
{% import "macros.html" as macros %}
<!-- tags.html -->
{% block title %}{% spaceless %}{% trans %}Tag list{% endtrans %}{% endspaceless %}{% endblock %}
{% block content %}
<!-- Tabs -->
{% if stag %}
    <h1 class="section-title">{% trans %}Tags, matching "{{ stag }}"{% endtrans %}</h1>
{% else %}
    <h1 class="section-title">{% trans %}Tag list{% endtrans %}</h1>
{% endif %}
<div class="tabBar tabBar-tags">
    <div class="tabsA">
        <span class="label">{% trans %}Sort by &raquo;{% endtrans %}</span>
        <a
            id="sort_name"
            href="{% url tags %}?sort=name"
            {% if tab_id == 'name' %}class="on"{% endif %}
            title="{% trans %}sorted alphabetically{% endtrans %}"
        ><span>{% trans %}by name{% endtrans %}</span></a>
        <a
            id="sort_used"
            href="{% url tags %}?sort=used"
            {% if tab_id == 'used' %}class="on"{% endif %}
            title="{% trans %}sorted by frequency of tag use{% endtrans %}"
        ><span>{% trans %}by popularity{% endtrans %}</span></a>
    </div>
</div>
{% if tag_list_type == 'list' %}
    {% if not tags.object_list %}
        <span>{% trans %}Nothing found{% endtrans %}</span>
    {% endif %}
    {% if tags.object_list %}
        <div class='clearfix'></div>
        <ul class='tags'>
            {% for tag in tags.object_list %}
            <li>
                {{ macros.tag_widget(
                            tag = tag.name,
                            html_tag = 'div',
                            extra_content = '<span class="tag-number">&#215; ' ~
                                            tag.used_count|intcomma ~ '</span>'
                    )
                }}
            </li>
            {% endfor %}
        </ul>
        <div class="clean"></div>
        <div class="pager">
            {{macros.paginator(paginator_context)}}
        </div>
    {% endif %}
{% else %}
    <div class="clearfix"></div>
    {% if not tags %}
        <span>{% trans %}Nothing found{% endtrans %}</span>
    {% endif %}
    {{ macros.tag_cloud(tags = tags, font_sizes = font_size) }}
{% endif %}

{% endblock %}
{% block endjs %}
    <script type="text/javascript">
    /*<![CDATA[*/
        $().ready(function(){
            $("#ipSearchTag").focus();
            $("#type-tag").attr('checked',true);
            Hilite.exact = false;
            Hilite.elementid = "searchtags";
            Hilite.debug_referrer = location.href;
        });
    /*]]>*/
    </script>
{% endblock %}
<!-- end tags.html -->
