{% extends "sentry/explore/list_tag.html" %}

{% load i18n %}
{% load sentry_helpers %}
{% load sentry_plugins %}

{% block title %}{{ tag.value }} | {{ block.super }}{% endblock %}

{% block bodyclass %} with-sidebar{% endblock %}

{% block sidebar %}
    <h6>{% trans "Tag Details" %}</h6>
    <dl>
        <dt>First Seen:</dt>
        <dd>{{ tag_value.first_seen|timesince }}</dd>
        <dt>Last Seen:</dt>
        <dd>{{ tag_value.last_seen|timesince }}</dd>
        <dt>Number of Events:</dt>
        <dd>{{ tag_value.times_seen|small_count }}</dd>
        <dt>Other Values:</dt>
        <dd>{{ tag.values_seen|small_count }}</dd>
    </dl>
{% endblock %}

{% block main %}
    {% paginator event_list from request as event_list per_page EVENTS_PER_PAGE %}

    <div class="btn-toolbar">
        <div class="pull-left">
            <h2 style="line-height:1;">Explore by {{ tag.get_label }}
                <small>{{ tag_value.value }}</small>
            </h2>
        </div>
        <div class="btn-group pull-right">
            <a class="btn prev{% if not event_list.paginator.has_previous %} disabled{% else %}" href="?p={{ event_list.paginator.previous_page }}{% endif %}"><span>{% trans "Previous" %}</span></a>
            <a class="btn next{% if not event_list.paginator.has_next %} disabled{% else %}" href="?p={{ event_list.paginator.next_page }}{% endif %}"><span>{% trans "Next" %}</span></a>
        </div>
    </div>

    <div id="event_list"></div>

    <script>
    $(function(){
        new app.GroupListView({
            className: 'group-list',
            members: {{ event_list.paginator.objects|to_json:request|safe }},
            id: "event_list"
        });
    });
    </script>

    <div class="btn-toolbar">
        <div class="btn-group pull-right">
            <a class="btn prev{% if not event_list.paginator.has_previous %} disabled{% else %}" href="?p={{ event_list.paginator.previous_page }}{% endif %}"><span>{% trans "Previous" %}</span></a>
            <a class="btn next{% if not event_list.paginator.has_next %} disabled{% else %}" href="?p={{ event_list.paginator.next_page }}{% endif %}"><span>{% trans "Next" %}</span></a>
        </div>
    </div>
{% endblock %}
