{% extends 'wagtailadmin/reports/base_report.html' %}
{% load i18n wagtailadmin_tags %}

{% block results %}
    {% if object_list %}
        <table class="listing">
            <thead>
                <tr>
                    <th class="title">
                        {% trans 'Page' %}
                    </th>
                    <th>
                        {% trans 'Action' %}
                    </th>
                    <th>
                        {% trans 'User' %}
                    </th>
                    <th class="updated">
                        {% trans 'Date / Time' %}
                    </th>
                </tr>
            </thead>
            <tbody>
                {% for entry in object_list %}
                    <tr>
                        <td class="title">
                            {% if entry.page %}
                                {% page_permissions entry.page as page_perms %}
                                {% if page_perms.can_edit %}
                                    <a href="{% url 'wagtailadmin_pages:edit' entry.page_id %}" title="{% trans 'Edit this page' %}">{{ entry.label }}</a>
                                {% else %}
                                    {{ entry.label }}
                                {% endif %}
                            {% else %}
                                {{ entry.label }}
                            {% endif %}
                        </td>
                        <td>
                            {{ entry|format_action_log_message }}
                        </td>
                        <td>
                            {% include "wagtailadmin/shared/user_avatar.html" with user=entry.user username=entry.user_display_name %}
                        </td>
                        <td class="updated">
                            <div class="human-readable-date" title="{{ entry.timestamp|date:"d M Y H:i" }}">{% blocktrans with time_period=entry.timestamp|timesince %}{{ time_period }} ago{% endblocktrans %}</div>
                        </td>
                    </tr>
                {% endfor %}
            </tbody>
        </table>
    {% else %}
        <p>{% trans "No log entries found." %}</p>
    {% endif %}
{% endblock %}

{% block no_results %}
    <p>{% trans "No log entries found." %}</p>
{% endblock %}
