{% load i18n apphooks_config_tags %}

{% regroup dates by date.year as years %}
{% with current_year=year current_month=month %}

<div class="aldryn aldryn-dashboards_app aldryn-dashboards_app-archive">
    <div class="panel panel-default">
        {% for year in years %}
            <div class="panel-heading">
                <a href="{% namespace_url 'dashboard-list-by-year' year=year.grouper namespace=instance.app_config.namespace default='' %}" class="panel-title">{{ year.grouper }}</a>
            </div>
            {# month list #}
            <div class="list-group">
                {# NOTE: Wrapping the following anchor markup will break tests #}
                {% for month in year.list %}
                    <a href="{% namespace_url 'dashboard-list-by-month' year=year.grouper month=month.date|date:"n" namespace=instance.app_config.namespace default='' %}" class="list-group-item{% if year.grouper == current_year and month.date.month == current_month %} active{% endif %}">{{ month.date|date:"F" }}<span class="badge">{{ month.num_dashboards }}</span></a>
                {% endfor %}
            </div>
        {% empty %}
            <div class="list-group">
                <p class="list-group-item disabled">{% trans "No items available" %}</p>
            </div>
        {% endfor %}
    </div>
</div>

{% endwith %}
