{% load i18n wagtailadmin_tags %}
{% if documents %}
    {% if is_searching %}
        <h2 role="alert">
            {% blocktrans trimmed count counter=documents.paginator.count %}
                There is {{ counter }} match
            {% plural %}
                There are {{ counter }} matches
            {% endblocktrans %}
        </h2>
    {% else %}
        <h2>{% trans "Latest documents" %}</h2>
    {% endif %}

    {% component table %}
    {% include "wagtailadmin/shared/pagination_nav.html" with items=documents linkurl='wagtaildocs:chooser_results' %}
{% else %}
    {% if documents_exist %}
        <p role="alert">{% blocktrans trimmed %}Sorry, no documents match "<em>{{ query_string }}</em>"{% endblocktrans %}</p>
    {% else %}
        <p>
            {% if collection_id %}
                {% trans "You haven't uploaded any documents in this collection." %}
            {% else %}
                {% trans "You haven't uploaded any documents." %}
            {% endif %}
            {% if uploadform %}
                {% blocktrans trimmed %}
                    Why not <a class="upload-one-now" href="#tab-upload" data-tab-trigger>upload one now</a>?
                {% endblocktrans %}
            {% endif %}
        </p>
    {% endif %}
{% endif %}
