0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-12-01 11:41:20 +01:00

Remove unnecessary object_list check in report results templates

It's already done in the base listing_results.html template
This commit is contained in:
Sage Abdullah 2024-05-21 17:04:16 +01:00
parent 38dcd6506f
commit 6fe7d9e6e5
No known key found for this signature in database
GPG Key ID: EB1A33CC51CC0217
4 changed files with 151 additions and 159 deletions

View File

@ -2,9 +2,7 @@
{% load i18n wagtailadmin_tags %}
{% block results %}
{% if object_list %}
{% include "wagtailadmin/reports/listing/_list_page_types_usage.html" with page_types=object_list %}
{% endif %}
{% include "wagtailadmin/reports/listing/_list_page_types_usage.html" with page_types=object_list %}
{% endblock %}
{% block no_results_message %}

View File

@ -2,52 +2,50 @@
{% load i18n wagtailadmin_tags %}
{% block results %}
{% if object_list %}
<table class="listing">
<thead>
<table class="listing">
<thead>
<tr>
<th class="title">
{% trans 'Name' %}
</th>
<th>
{% trans 'Type' %}
</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>
<th class="title">
{% trans 'Name' %}
</th>
<th>
{% trans 'Type' %}
</th>
<th>
{% trans 'Action' %}
</th>
<th>
{% trans 'User' %}
</th>
<th class="updated">
{% trans 'Date / Time' %}
</th>
<td class="title">
{% if entry.edit_url %}
<a href="{{ entry.edit_url }}" title="{% trans 'Edit this item' %}">{{ entry.label }}</a>
{% else %}
{{ entry.label }}
{% endif %}
</td>
<td>
{{ entry.content_type|format_content_type }}
</td>
<td>
{{ entry.message }}
</td>
<td>
{% include "wagtailadmin/shared/user_avatar.html" with user=entry.user username=entry.user_display_name %}
</td>
<td class="updated">{% human_readable_date entry.timestamp %}</td>
</tr>
</thead>
<tbody>
{% for entry in object_list %}
<tr>
<td class="title">
{% if entry.edit_url %}
<a href="{{ entry.edit_url }}" title="{% trans 'Edit this item' %}">{{ entry.label }}</a>
{% else %}
{{ entry.label }}
{% endif %}
</td>
<td>
{{ entry.content_type|format_content_type }}
</td>
<td>
{{ entry.message }}
</td>
<td>
{% include "wagtailadmin/shared/user_avatar.html" with user=entry.user username=entry.user_display_name %}
</td>
<td class="updated">{% human_readable_date entry.timestamp %}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
{% endfor %}
</tbody>
</table>
{% endblock %}
{% block no_results_message %}

View File

@ -2,73 +2,71 @@
{% load i18n wagtailadmin_tags %}
{% block results %}
{% if object_list %}
<table class="listing">
<thead>
<table class="listing">
<thead>
<tr>
<th>
{% trans 'Workflow' %}
</th>
<th>
{% trans 'Page/Snippet' %}
</th>
<th>
{% trans 'Status' %}
</th>
<th>
{% trans 'Tasks' %}
</th>
<th>
{% trans 'Requested by' %}
</th>
<th>
{% trans 'Started at' %}
</th>
</tr>
</thead>
<tbody>
{% for workflow_state in object_list %}
<tr>
<th>
{% trans 'Workflow' %}
</th>
<th>
{% trans 'Page/Snippet' %}
</th>
<th>
{% trans 'Status' %}
</th>
<th>
{% trans 'Tasks' %}
</th>
<th>
{% trans 'Requested by' %}
</th>
<th>
{% trans 'Started at' %}
</th>
<td>
<b>{{ workflow_state.workflow }}</b>
</td>
<td>
<a href="{% admin_edit_url workflow_state.content_object %}">
{% latest_str workflow_state.content_object %}
</a>
{% i18n_enabled as show_locale_labels %}
{% if show_locale_labels and workflow_state.content_object.locale_id %}
{% locale_label_from_id workflow_state.content_object.locale_id as locale_label %}
{% status locale_label classname="w-status--label" %}
{% endif %}
</td>
<td>
{% admin_url_name workflow_state.content_object 'workflow_history_detail' as workflow_history_detail_url_name %}
{% url workflow_history_detail_url_name workflow_state.content_object.pk|admin_urlquote workflow_state.pk as status_url %}
{% status workflow_state.get_status_display url=status_url classname="w-status--primary" %}
</td>
<td>
<h2>{{ workflow_name }}</h2>
{% trans 'Incomplete task' as incomplete_title %}
{% for task in workflow_state.all_tasks_with_status %}
<span data-controller="w-tooltip" data-w-tooltip-content-value="{{ task.name }}: {{ task.status_display }}">
{% if task.status == 'approved' %}
{% icon "success" title=task.status_display classname="initial" %}
{% elif task.status == 'rejected' %}
{% icon "error" title=task.status_display classname="initial" %}
{% else %}
{% icon "radio-empty" title=incomplete_title classname="initial" %}
{% endif %}
</span>
{% endfor %}
</td>
<td>{{ workflow_state.requested_by|user_display_name }}</td>
<td>{{ workflow_state.created_at }}</td>
</tr>
</thead>
<tbody>
{% for workflow_state in object_list %}
<tr>
<td>
<b>{{ workflow_state.workflow }}</b>
</td>
<td>
<a href="{% admin_edit_url workflow_state.content_object %}">
{% latest_str workflow_state.content_object %}
</a>
{% i18n_enabled as show_locale_labels %}
{% if show_locale_labels and workflow_state.content_object.locale_id %}
{% locale_label_from_id workflow_state.content_object.locale_id as locale_label %}
{% status locale_label classname="w-status--label" %}
{% endif %}
</td>
<td>
{% admin_url_name workflow_state.content_object 'workflow_history_detail' as workflow_history_detail_url_name %}
{% url workflow_history_detail_url_name workflow_state.content_object.pk|admin_urlquote workflow_state.pk as status_url %}
{% status workflow_state.get_status_display url=status_url classname="w-status--primary" %}
</td>
<td>
<h2>{{ workflow_name }}</h2>
{% trans 'Incomplete task' as incomplete_title %}
{% for task in workflow_state.all_tasks_with_status %}
<span data-controller="w-tooltip" data-w-tooltip-content-value="{{ task.name }}: {{ task.status_display }}">
{% if task.status == 'approved' %}
{% icon "success" title=task.status_display classname="initial" %}
{% elif task.status == 'rejected' %}
{% icon "error" title=task.status_display classname="initial" %}
{% else %}
{% icon "radio-empty" title=incomplete_title classname="initial" %}
{% endif %}
</span>
{% endfor %}
</td>
<td>{{ workflow_state.requested_by|user_display_name }}</td>
<td>{{ workflow_state.created_at }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
{% endfor %}
</tbody>
</table>
{% endblock %}
{% block no_results_message %}

View File

@ -2,55 +2,53 @@
{% load i18n wagtailadmin_tags %}
{% block results %}
{% if object_list %}
<table class="listing">
<thead>
<table class="listing">
<thead>
<tr>
<th>
{% trans 'Task' %}
</th>
<th>
{% trans 'Page/Snippet' %}
</th>
<th>
{% trans 'Status' %}
</th>
<th>
{% trans 'Started at' %}
</th>
<th>
{% trans 'Completed at' %}
</th>
</tr>
</thead>
<tbody>
{% for task_state in object_list %}
<tr>
<th>
{% trans 'Task' %}
</th>
<th>
{% trans 'Page/Snippet' %}
</th>
<th>
{% trans 'Status' %}
</th>
<th>
{% trans 'Started at' %}
</th>
<th>
{% trans 'Completed at' %}
</th>
<td>
<b>{{ task_state.task }}</b>
</td>
<td>
{% with task_state.workflow_state.content_object as object %}
<a href="{% admin_edit_url object %}">
{% latest_str object %}
</a>
{% i18n_enabled as show_locale_labels %}
{% if show_locale_labels and object.locale_id %}
{% locale_label_from_id object.locale_id as locale_label %}
{% status locale_label classname="w-status--label" %}
{% endif %}
{% endwith %}
</td>
<td>
{% status task_state.get_status_display classname="w-status--primary" %}
</td>
<td>{{ task_state.started_at }}</td>
<td>{{ task_state.finished_at }}</td>
</tr>
</thead>
<tbody>
{% for task_state in object_list %}
<tr>
<td>
<b>{{ task_state.task }}</b>
</td>
<td>
{% with task_state.workflow_state.content_object as object %}
<a href="{% admin_edit_url object %}">
{% latest_str object %}
</a>
{% i18n_enabled as show_locale_labels %}
{% if show_locale_labels and object.locale_id %}
{% locale_label_from_id object.locale_id as locale_label %}
{% status locale_label classname="w-status--label" %}
{% endif %}
{% endwith %}
</td>
<td>
{% status task_state.get_status_display classname="w-status--primary" %}
</td>
<td>{{ task_state.started_at }}</td>
<td>{{ task_state.finished_at }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
{% endfor %}
</tbody>
</table>
{% endblock %}
{% block no_results_message %}