{% load i18n wagtailadmin_tags %}
{% if last_edits %}
    <section class="object collapsible">
        <h2 class="title-wrapper">{% trans "Your most recent edits" %}</h2>
        <div class="object-layout">
            <table class="listing listing-page">
                <col />
                <col width="30%"/>
                <col width="15%"/>
                <thead>{# Note: the header is visually hidden behind .title-wrapper #}
                    <tr>
                        <th class="title">{% trans "Title" %}</th>
                        <th>{% trans "Status" %}</th>
                        <th>{% trans "Date" %}</th>
                    </tr>
                </thead>
                <tbody>
                    {% for revision, page in last_edits %}
                        <tr>
                            <td class="title" valign="top">
                                <div class="title-wrapper">
                                    <a href="{% url 'wagtailadmin_pages:edit' page.id %}" title="{% trans 'Edit this page' %}">{{ page.get_admin_display_title }}</a>

                                    {% i18n_enabled as show_locale_labels %}
                                    {% if show_locale_labels and page.locale_id %}
                                        {% locale_label_from_id page.locale_id as locale_label %}
                                        <span class="status-tag status-tag--label">{{ locale_label }}</span>
                                    {% endif %}
                                    {% include "wagtailadmin/pages/listing/_privacy_indicator.html" with page=page %}
                                    {% include "wagtailadmin/pages/listing/_locked_indicator.html" with page=page %}
                                </div>
                                <ul class="actions">
                                    <li><a href="{% url 'wagtailadmin_pages:edit' page.id %}" class="button button-small button-secondary">{% trans "Edit" %}</a></li>
                                    {% if page.has_unpublished_changes and page.is_previewable %}
                                        <li><a href="{% url 'wagtailadmin_pages:view_draft' page.id %}" class="button button-small button-secondary" target="_blank" rel="noreferrer">{% trans 'Draft' %}</a></li>
                                    {% endif %}
                                    {% if page.live %}
                                        {% with page_url=page.url %}
                                            {% if page_url is not None %}
                                                <li><a href="{{ page_url }}" class="button button-small button-secondary" target="_blank" rel="noreferrer">{% trans 'Live' %}</a></li>
                                            {% endif %}
                                        {% endwith %}
                                    {% endif %}
                                </ul>
                            </td>
                            <td valign="top">
                                {% include "wagtailadmin/shared/page_status_tag.html" with page=page %}
                            </td>
                            <td valign="top"><div class="human-readable-date" title="{{ revision.created_at|date:"DATETIME_FORMAT" }}">{% blocktrans trimmed with time_period=revision.created_at|timesince_simple %}{{ time_period }}{% endblocktrans %}</div></td>
                        </tr>
                    {% endfor %}
                </tbody>
            </table>
        </div>
    </section>
{% endif %}
