{% extends "wagtailadmin/base.html" %}
{% load i18n %}
{% block titletag %}{% blocktrans trimmed with title=object %}Usage of {{ title }}{% endblocktrans %}{% endblock %}
{% block bodyclass %}model-{{ model_opts.model_name }}{% endblock %}

{% block content %}
    {% include 'wagtailsnippets/snippets/headers/usage_header.html' %}

    {% trans "Usage of" as usage_str %}
    {% include "wagtailadmin/shared/header.html" with title=usage_str subtitle=object %}

    <div class="nice-padding">
        <table class="listing">
            <thead>
                <tr>
                    <th class="title">{% trans "Title" %}</th>
                    <th>{% trans "Field" %}</th>
                </tr>
            </thead>
            <tbody>
                {% for label, edit_url, edit_link_title, references in results %}
                    <tr>
                        <td class="title">
                            <div class="title-wrapper">
                                {% if edit_url %}<a href="{{ edit_url }}" title="{{ edit_link_title }}">{% endif %}
                                {{ label }}
                                {% if edit_url %}</a>{% endif %}
                            </div>
                        </td>
                        <td>
                            <ul>
                                {% for reference in references %}
                                    <li>
                                        {% if edit_url %}<a href="{{ edit_url }}#content-path-{{ reference.content_path }}">{% endif %}
                                        {{ reference.describe_source_field }}
                                        {% if edit_url %}</a>{% endif %}
                                    </li>
                                {% endfor %}
                            </ul>
                        </td>
                    </tr>
                {% endfor %}
            </tbody>
        </table>
    </div>
    {% include "wagtailadmin/shared/pagination_nav.html" with items=page_obj %}
{% endblock %}
