mirror of
https://github.com/wagtail/wagtail.git
synced 2024-12-01 11:41:20 +01:00
Reinstate link to 'by task' and 'by workflow' in workflow/task reports
This commit is contained in:
parent
9e93b66f13
commit
429cea7705
@ -1,9 +0,0 @@
|
||||
{% extends 'wagtailadmin/reports/base_report.html' %}
|
||||
{% load i18n wagtailadmin_tags %}
|
||||
|
||||
{% block actions %}
|
||||
<div>
|
||||
<a href="{% url 'wagtailadmin_reports:workflow_tasks' %}" class="button">{% trans "By Task" %}</a>
|
||||
</div>
|
||||
{{ block.super }}
|
||||
{% endblock %}
|
@ -1,9 +0,0 @@
|
||||
{% extends 'wagtailadmin/reports/base_report.html' %}
|
||||
{% load i18n wagtailadmin_tags %}
|
||||
|
||||
{% block actions %}
|
||||
<div>
|
||||
<a href="{% url 'wagtailadmin_reports:workflow' %}" class="button">{% trans 'By Workflow' %}</a>
|
||||
</div>
|
||||
{{ block.super }}
|
||||
{% endblock %}
|
@ -2931,6 +2931,14 @@ class TestPageWorkflowReport(BasePageWorkflowTests):
|
||||
[{"url": "", "label": "Workflows"}],
|
||||
response.content,
|
||||
)
|
||||
soup = self.get_soup(response.content)
|
||||
by_task_link = soup.select_one("#w-slim-header-buttons .w-header-button")
|
||||
self.assertIsNotNone(by_task_link)
|
||||
self.assertEqual(
|
||||
by_task_link.get("href"),
|
||||
reverse("wagtailadmin_reports:workflow_tasks"),
|
||||
)
|
||||
self.assertEqual(by_task_link.text.strip(), "By task")
|
||||
|
||||
response = self.client.get(reverse("wagtailadmin_reports:workflow_tasks"))
|
||||
self.assertEqual(response.status_code, 200)
|
||||
@ -2939,6 +2947,14 @@ class TestPageWorkflowReport(BasePageWorkflowTests):
|
||||
[{"url": "", "label": "Workflow tasks"}],
|
||||
response.content,
|
||||
)
|
||||
soup = self.get_soup(response.content)
|
||||
by_task_link = soup.select_one("#w-slim-header-buttons .w-header-button")
|
||||
self.assertIsNotNone(by_task_link)
|
||||
self.assertEqual(
|
||||
by_task_link.get("href"),
|
||||
reverse("wagtailadmin_reports:workflow"),
|
||||
)
|
||||
self.assertEqual(by_task_link.text.strip(), "By workflow")
|
||||
|
||||
def test_workflow_report_filtered(self):
|
||||
# the moderator can review the task, so the workflow state should show up even when reports are filtered by reviewable
|
||||
|
@ -7,6 +7,9 @@ from django.contrib.contenttypes.models import ContentType
|
||||
from django.core.exceptions import PermissionDenied
|
||||
from django.db.models import CharField, Q
|
||||
from django.db.models.functions import Cast
|
||||
from django.urls import reverse
|
||||
from django.utils.functional import cached_property
|
||||
from django.utils.translation import gettext
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from wagtail.admin.filters import (
|
||||
@ -15,6 +18,7 @@ from wagtail.admin.filters import (
|
||||
WagtailFilterSet,
|
||||
)
|
||||
from wagtail.admin.utils import get_latest_str
|
||||
from wagtail.admin.widgets.button import HeaderButton
|
||||
from wagtail.coreutils import get_content_type_label
|
||||
from wagtail.models import (
|
||||
Task,
|
||||
@ -135,7 +139,6 @@ class WorkflowTasksReportFilterSet(WagtailFilterSet):
|
||||
|
||||
|
||||
class WorkflowView(ReportView):
|
||||
template_name = "wagtailadmin/reports/workflow.html"
|
||||
results_template_name = "wagtailadmin/reports/workflow_results.html"
|
||||
title = _("Workflows")
|
||||
header_icon = "tasks"
|
||||
@ -173,6 +176,16 @@ class WorkflowView(ReportView):
|
||||
self.FORMAT_XLSX: get_content_type_label,
|
||||
}
|
||||
|
||||
@cached_property
|
||||
def header_buttons(self):
|
||||
return [
|
||||
HeaderButton(
|
||||
gettext("By task"),
|
||||
reverse("wagtailadmin_reports:workflow_tasks"),
|
||||
icon_name="thumbtack",
|
||||
)
|
||||
]
|
||||
|
||||
def get_title(self, content_object):
|
||||
return get_latest_str(content_object)
|
||||
|
||||
@ -210,7 +223,6 @@ class WorkflowView(ReportView):
|
||||
|
||||
|
||||
class WorkflowTasksView(ReportView):
|
||||
template_name = "wagtailadmin/reports/workflow_tasks.html"
|
||||
results_template_name = "wagtailadmin/reports/workflow_tasks_results.html"
|
||||
title = _("Workflow tasks")
|
||||
header_icon = "thumbtack"
|
||||
@ -250,6 +262,16 @@ class WorkflowTasksView(ReportView):
|
||||
self.FORMAT_XLSX: get_content_type_label,
|
||||
}
|
||||
|
||||
@cached_property
|
||||
def header_buttons(self):
|
||||
return [
|
||||
HeaderButton(
|
||||
gettext("By workflow"),
|
||||
reverse("wagtailadmin_reports:workflow"),
|
||||
icon_name="tasks",
|
||||
)
|
||||
]
|
||||
|
||||
def get_title(self, content_object):
|
||||
return get_latest_str(content_object)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user