{# vim: set syntax=htmldjango: #}
{% extends "django_tables2/table.html" %}
{% comment %}
    django-tables 1.2.7 introduced some changes to their pagination
    footer which I wasn't fond of (specifically they got rid of the
    "X of Y item(s)" text).  This custom template just overrides that
    block to revert back to 1.2.6 behavior.

    Since I want to implement a pagination system which lets you go
    directly to various page numbers anyway, it'll be nice to have
    this in place...
{% endcomment %}
{% load django_tables2 %}
{% load i18n %}

{% block pagination %}
<ul class="pagination">
    {% if table.page.has_previous %}
        {% block pagination.previous %}
            <li class="previous">
                <a href="{% querystring table.prefixed_page_field=table.page.previous_page_number %}">{% trans "Previous" %}</a>
            </li>
        {% endblock pagination.previous %}
    {% endif %}

    {% if table.page.has_previous or table.page.has_next %}
        {% block pagination.current %}
            <li class="current">
                {% blocktrans with table.page.number as current and table.paginator.num_pages as total %}Page {{ current }} of {{ total }}{% endblocktrans %}
            </li>
        {% endblock pagination.current %}
    {% endif %}

    {% if table.page.has_next %}
        {% block pagination.next %}
            <li class="next">
                <a href="{% querystring table.prefixed_page_field=table.page.next_page_number %}">{% trans "Next" %}</a>
            </li>
        {% endblock pagination.next %}
    {% endif %}
    {% block pagination.cardinality %}
        <li class="cardinality">
            {% if total != count %}{% blocktrans %}{{ count }} of {{ total }}{% endblocktrans %}{% else %}{{ total }}{% endif %} {% if total == 1 %}{{ table.data.verbose_name }}{% else %}{{ table.data.verbose_name_plural }}{% endif %}
        </li>
    {% endblock pagination.cardinality %}
</ul>
{% endblock pagination %}
