Refactor workflow reports to be based on reports base template

pull/6257/head
Matt Westcott 2020-04-17 17:58:50 +01:00 zatwierdzone przez Matt Westcott
rodzic b2fba99817
commit 984eb4efcf
3 zmienionych plików z 131 dodań i 158 usunięć

Wyświetl plik

@ -1,90 +1,77 @@
{% extends "wagtailadmin/base.html" %}
{% load i18n l10n wagtailadmin_tags wagtailui_tags %}
{% extends 'wagtailadmin/reports/base_report.html' %}
{% load i18n wagtailadmin_tags wagtailui_tags %}
{% block titletag %}{% trans "Workflows" %}{% endblock %}
{% block content %}
<header role="banner">
<div class="row nice-padding">
<div class="left">
<div class="col header-title">
<h1 class="icon icon-{{ header_icon }}">{% trans "Workflows" %}</h1>
</div>
</div>
<div class="right">
<div class="addbutton">
<a href="{% url 'wagtailadmin_reports:workflow_tasks' %}" class="button">{% trans "By Task" %}</a>
</div>
</div>
</div>
</header>
<div class="nice-padding">
{% if object_list %}
<table class="listing">
<thead>
<tr>
<th>
{% trans 'Workflow' %}
</th>
<th>
{% trans 'Page' %}
</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>
<td>
<b>{{ workflow_state.workflow }}</b>
</td>
<td>
<a href="{% url 'wagtailadmin_pages:edit' workflow_state.page.id %}">
{{ workflow_state.page.get_admin_display_title }}
</a>
</td>
<td>
<a href="{% url 'wagtailadmin_pages:workflow_history_detail' workflow_state.page.id workflow_state.id %}" class="status-tag primary">
{{ workflow_state.get_status_display }}
</a>
</td>
<td>
<h2>{{ workflow_name }}</h2>
{% trans 'Approved task' as approved_title %}
{% trans 'Incomplete task' as incomplete_title %}
{% for task in workflow_state.all_tasks_with_status %}
<span data-wagtail-tooltip="{{ task.name }}: {{ task.status_display }}">
{% if task.status == 'approved' %}
{% wagtail_icon name="success" title=approved_title %}
{% else %}
{% wagtail_icon name="radio-empty" title=incomplete_title %}
{% endif %}
</span>
{% endfor %}
</td>
<td>{{ workflow_state.requested_by.get_full_name|default:workflow_state.requested_by.get_username }}</td>
<td>{{ workflow_state.created_at }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p>{% trans "No pages have been submitted for moderation yet" %}</p>
{% endif %}
{% block actions %}
<div class="addbutton">
<a href="{% url 'wagtailadmin_reports:workflow_tasks' %}" class="button">{% trans "By Task" %}</a>
</div>
{{ block.super }}
{% endblock %}
{% block results %}
{% if object_list %}
<table class="listing">
<thead>
<tr>
<th>
{% trans 'Workflow' %}
</th>
<th>
{% trans 'Page' %}
</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>
<td>
<b>{{ workflow_state.workflow }}</b>
</td>
<td>
<a href="{% url 'wagtailadmin_pages:edit' workflow_state.page.id %}">
{{ workflow_state.page.get_admin_display_title }}
</a>
</td>
<td>
<a href="{% url 'wagtailadmin_pages:workflow_history_detail' workflow_state.page.id workflow_state.id %}" class="status-tag primary">
{{ workflow_state.get_status_display }}
</a>
</td>
<td>
<h2>{{ workflow_name }}</h2>
{% trans 'Approved task' as approved_title %}
{% trans 'Incomplete task' as incomplete_title %}
{% for task in workflow_state.all_tasks_with_status %}
<span data-wagtail-tooltip="{{ task.name }}: {{ task.status_display }}">
{% if task.status == 'approved' %}
{% wagtail_icon name="success" title=approved_title %}
{% else %}
{% wagtail_icon name="radio-empty" title=incomplete_title %}
{% endif %}
</span>
{% endfor %}
</td>
<td>{{ workflow_state.requested_by.get_full_name|default:workflow_state.requested_by.get_username }}</td>
<td>{{ workflow_state.created_at }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p>{% trans "No pages have been submitted for moderation yet" %}</p>
{% endif %}
{% endblock %}
{% block extra_js %}

Wyświetl plik

@ -1,74 +1,60 @@
{% extends "wagtailadmin/base.html" %}
{% load i18n l10n wagtailadmin_tags wagtailui_tags %}
{% extends 'wagtailadmin/reports/base_report.html' %}
{% load i18n wagtailadmin_tags %}
{% block titletag %}{% trans "Workflows" %}{% endblock %}
{% block content %}
{% trans "Workflows" as title_str %}
<header role="banner">
<div class="row nice-padding">
<div class="left">
<div class="col header-title">
<h1 class="icon icon-{{ header_icon }}">Workflows</h1>
</div>
</div>
<div class="right">
<div class="addbutton">
<a href="{% url 'wagtailadmin_reports:workflow' %}" class="button">By Workflow</a>
</div>
</div>
</div>
</header>
<div class="nice-padding">
{% if object_list %}
<table class="listing">
<thead>
<tr>
<th>
{% trans 'Task' %}
</th>
<th>
{% trans 'Page' %}
</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>
<td>
<b>{{ task_state.task }}</b>
</td>
<td>
{% with task_state.workflow_state.page as page %}
<a href="{% url 'wagtailadmin_pages:edit' page.id %}">
{{ page.get_admin_display_title }}
</a>
{% endwith %}
</td>
<td>
<div class="status-tag primary">
{{ task_state.get_status_display }}
</div>
</td>
<td>{{ task_state.started_at }}</td>
<td>{{ task_state.finished_at }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p>{% blocktrans %}No pages have been submitted for moderation yet{% endblocktrans %}</p>
{% endif %}
{% block actions %}
<div class="addbutton">
<a href="{% url 'wagtailadmin_reports:workflow' %}" class="button">By Workflow</a>
</div>
{{ block.super }}
{% endblock %}
{% block results %}
{% if object_list %}
<table class="listing">
<thead>
<tr>
<th>
{% trans 'Task' %}
</th>
<th>
{% trans 'Page' %}
</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>
<td>
<b>{{ task_state.task }}</b>
</td>
<td>
{% with task_state.workflow_state.page as page %}
<a href="{% url 'wagtailadmin_pages:edit' page.id %}">
{{ page.get_admin_display_title }}
</a>
{% endwith %}
</td>
<td>
<div class="status-tag primary">
{{ task_state.get_status_display }}
</div>
</td>
<td>{{ task_state.started_at }}</td>
<td>{{ task_state.finished_at }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p>{% blocktrans %}No pages have been submitted for moderation yet{% endblocktrans %}</p>
{% endif %}
{% endblock %}

Wyświetl plik

@ -275,7 +275,7 @@ class LockedPagesView(PageReportView):
class WorkflowView(ReportView):
template_name = 'wagtailadmin/reports/workflow.html'
title = _('Workflow')
title = _('Workflows')
header_icon = 'clipboard-list'
def get_queryset(self):
@ -285,7 +285,7 @@ class WorkflowView(ReportView):
class WorkflowTasksView(ReportView):
template_name = 'wagtailadmin/reports/workflow_tasks.html'
title = _('Workflow')
title = _('Workflows')
header_icon = 'clipboard-list'
def get_queryset(self):