{% load i18n wagtailadmin wagtailsnippets_admin_tags %}
{% if items %}
    {% if is_searching %}
        <h2 role="alert">
        {% blocktrans count counter=items.paginator.count %}
            There is {{ counter }} match
        {% plural %}
            There are {{ counter }} matches
        {% endblocktrans %}
        </h2>
    {% endif %}

    <table class="listing">
        <col />
        <thead>
            <tr class="table-headers">
                <th>{% trans "Title" %}</th>
            </tr>
        </thead>
        <tbody>
            {% for snippet in items %}
                <tr id="snippet-row-{{ snippet.pk }}">
                    <td class="title">
                        <div class="title-wrapper"><a class="snippet-choice" href="{% url 'wagtailsnippets:chosen' model_opts.app_label model_opts.model_name snippet.pk|admin_urlquote %}">{{ snippet }}</a></div>
                    </td>
                </tr>
            {% endfor %}
        </tbody>
    </table>

    {% url 'wagtailsnippets:choose_results' model_opts.app_label model_opts.model_name as pagination_base_url %}
    {% include "wagtailadmin/shared/pagination_nav.html" with items=items linkurl=pagination_base_url %}
{% else %}
    {% if is_searching %}
         <p role="alert">{% blocktrans %}Sorry, no snippets match "<em>{{ query_string }}</em>"{% endblocktrans %}</p>
    {% else %}
        {% url 'wagtailsnippets:add' model_opts.app_label model_opts.model_name as wagtailsnippets_create_snippet_url %}
        <p>{% blocktrans with snippet_type_name=model_opts.verbose_name %}You haven't created any {{ snippet_type_name }} snippets. Why not <a href="{{ wagtailsnippets_create_snippet_url }}" target="_blank" rel="noopener noreferrer">create one now</a>?{% endblocktrans %}</p>
    {% endif %}
{% endif %}
