From ada0c8d502e8b09bf9f9795777860b0e0ba0986e Mon Sep 17 00:00:00 2001 From: Dan Braghis Date: Mon, 29 Jun 2020 12:40:33 +0100 Subject: [PATCH] Update workflow/workflow task add/edit header to be consistent with other admin pages --- .../templates/wagtailadmin/workflows/create.html | 1 - .../wagtailadmin/workflows/create_task.html | 2 +- .../templates/wagtailadmin/workflows/edit.html | 13 +------------ .../wagtailadmin/workflows/edit_task.html | 3 +-- wagtail/admin/views/workflows.py | 14 +++++++++----- 5 files changed, 12 insertions(+), 21 deletions(-) diff --git a/wagtail/admin/templates/wagtailadmin/workflows/create.html b/wagtail/admin/templates/wagtailadmin/workflows/create.html index d18ecdb82e..441f1117c3 100644 --- a/wagtail/admin/templates/wagtailadmin/workflows/create.html +++ b/wagtail/admin/templates/wagtailadmin/workflows/create.html @@ -22,7 +22,6 @@ {% endblock %} {% block content %} - {% include "wagtailadmin/shared/header.html" with title=view.page_title icon=view.header_icon merged=1 %}
diff --git a/wagtail/admin/templates/wagtailadmin/workflows/create_task.html b/wagtail/admin/templates/wagtailadmin/workflows/create_task.html index 9e6679d528..7ea037bfb8 100644 --- a/wagtail/admin/templates/wagtailadmin/workflows/create_task.html +++ b/wagtail/admin/templates/wagtailadmin/workflows/create_task.html @@ -1,5 +1,5 @@ {% extends "wagtailadmin/base.html" %} -{% load i18n %} +{% load i18n wagtailadmin_tags %} {% block titletag %}{{ view.page_title }}{% endblock %} diff --git a/wagtail/admin/templates/wagtailadmin/workflows/edit.html b/wagtail/admin/templates/wagtailadmin/workflows/edit.html index e0af8a8d1b..ddaa9ed330 100644 --- a/wagtail/admin/templates/wagtailadmin/workflows/edit.html +++ b/wagtail/admin/templates/wagtailadmin/workflows/edit.html @@ -24,18 +24,7 @@ {% endblock %} {% block content %} - - - + {% include "wagtailadmin/shared/header.html" with title=view.page_title subtitle=object.name icon=view.header_icon merged=1 %} {% csrf_token %} diff --git a/wagtail/admin/templates/wagtailadmin/workflows/edit_task.html b/wagtail/admin/templates/wagtailadmin/workflows/edit_task.html index 8eaff47126..50004bcaf4 100644 --- a/wagtail/admin/templates/wagtailadmin/workflows/edit_task.html +++ b/wagtail/admin/templates/wagtailadmin/workflows/edit_task.html @@ -21,8 +21,7 @@ {% endblock %} {% block content %} - - {% include "wagtailadmin/shared/header.html" with title=view.page_title icon=view.header_icon merged=1 %} + {% include "wagtailadmin/shared/header.html" with title=view.page_title subtitle=object.name icon=view.header_icon merged=1 %} {% csrf_token %} diff --git a/wagtail/admin/views/workflows.py b/wagtail/admin/views/workflows.py index 70e7214593..5309efbf69 100644 --- a/wagtail/admin/views/workflows.py +++ b/wagtail/admin/views/workflows.py @@ -58,7 +58,7 @@ class Index(IndexView): class Create(CreateView): permission_policy = workflow_permission_policy model = Workflow - page_title = _("Create a new workflow") + page_title = _("New workflow") template_name = 'wagtailadmin/workflows/create.html' success_message = _("Workflow '{0}' created.") add_url_name = 'wagtailadmin_workflows:add' @@ -118,7 +118,7 @@ class Create(CreateView): class Edit(EditView): permission_policy = workflow_permission_policy model = Workflow - page_title = _("Edit workflow") + page_title = _("Editing workflow") template_name = 'wagtailadmin/workflows/edit.html' success_message = _("Workflow '{0}' updated.") add_url_name = 'wagtailadmin_workflows:add' @@ -308,7 +308,7 @@ class TaskIndex(IndexView): add_url_name = 'wagtailadmin_workflows:select_task_type' edit_url_name = 'wagtailadmin_workflows:edit_task' page_title = _("Workflow tasks") - add_item_label = _("Create a workflow task") + add_item_label = _("New workflow task") header_icon = 'thumbtack' def show_disabled(self): @@ -353,7 +353,7 @@ def select_task_type(request): class CreateTask(CreateView): permission_policy = task_permission_policy model = None - page_title = _("Create a workflow task") + page_title = _("New workflow task") template_name = 'wagtailadmin/workflows/create_task.html' success_message = _("Task '{0}' created.") add_url_name = 'wagtailadmin_workflows:add_task' @@ -387,7 +387,7 @@ class CreateTask(CreateView): class EditTask(EditView): permission_policy = task_permission_policy model = None - page_title = _("Edit workflow task") + page_title = _("Editing workflow task") template_name = 'wagtailadmin/workflows/edit_task.html' success_message = _("Task '{0}' updated.") add_url_name = 'wagtailadmin_workflows:select_task_type' @@ -403,6 +403,10 @@ class EditTask(EditView): def model(self): return type(self.get_object()) + @cached_property + def page_title(self): + return _("Editing {task_type}".format(task_type=self.get_object().content_type.name)) + def get_queryset(self): if self.queryset is None: return Task.objects.all()