2
0
Эх сурвалжийг харах

Update workflow state icon, add workflow state requested by user name (#8469). Fix #8464

Co-authored-by: Thibaud Colas <thibaudcolas@gmail.com>
Steve Stein 2 жил өмнө
parent
commit
43ebdbaea9

+ 15 - 12
wagtail/admin/templates/wagtailadmin/pages/side_panels/includes/page_workflow_status.html

@@ -64,7 +64,7 @@
 
 {% block action %}
     {% if workflow_state %}
-        {% include 'wagtailadmin/pages/side_panels/includes/side_panel_button.html' with attr='data-action-workflow-status' data_url=action_url text=action_text  %}
+        {% include 'wagtailadmin/pages/side_panels/includes/side_panel_button.html' with attr='data-action-workflow-status' data_url=action_url text=action_text %}
     {% else %}
         {% url 'wagtailadmin_pages:history' page.id as action_url %}
         {% trans 'View history' as action_text %}
@@ -77,20 +77,23 @@
     {% with workflow_state=page.current_workflow_state draft_revision=page.get_latest_revision %}
         {% if workflow_state %}
             <div class="w-flex w-space-x-3 w-mt-3">
-                {% icon name='warning' class_name='w-w-4 w-h-4 w-text-info-100 w-shrink-0' %}
+                {% icon name='info-circle' class_name='w-w-4 w-h-4 w-text-info-100 w-shrink-0' %}
                 <div class="w-label-3 w-flex-1">
                     {% if workflow_state.status == 'needs_changes' %}
-                        {% trans " Changes requested" %}
-                        {{ workflow_state.current_task_state.finished_at|naturaltime }}
+                        {% blocktrans trimmed with time_ago=workflow_state.current_task_state.finished_at|naturaltime %}
+                            Changes requested {{ time_ago }}
+                        {% endblocktrans %}
                     {% else %}
-                        {% if workflow_state.status == "in_progress" %}
-                            {% trans "Awaiting" %}
-                            {% trans "since" as since_text %}
-                        {% else %}
-                            {{ workflow_state.get_status_display }}
-                        {% endif %}
-                        {{ workflow_state.current_task_state.task.name }}
-                        {{ workflow_state.current_task_state.started_at|naturaltime }}
+                        {% with time_ago=workflow_state.current_task_state.started_at|naturaltime workflow_task=workflow_state.current_task_state.task.name %}
+                            {% if workflow_state.status == "in_progress" %}
+                                {% blocktrans trimmed %}Sent to {{ workflow_task }} {{ time_ago }}{% endblocktrans %}
+                            {% else %}
+                                {{ workflow_state.get_status_display }} {{ workflow_task }} {{ time_ago }}
+                            {% endif %}
+                        {% endwith %}
+                    {% endif %}
+                    {% if workflow_state.requested_by %}
+                        {% blocktrans trimmed with modified_by=workflow_state.requested_by|user_display_name %}by {{ modified_by }}{% endblocktrans %}
                     {% endif %}
                 </div>
             </div>

+ 7 - 7
wagtail/admin/tests/test_workflows.py

@@ -905,7 +905,7 @@ class TestSubmitToWorkflow(TestCase, WagtailTestUtils):
         self.assertEqual(task_state.task.specific, self.task_1)
         self.assertEqual(task_state.status, task_state.STATUS_IN_PROGRESS)
 
-    def test_submit_for_approval_changes_status_in_header_meta(self):
+    def test_submit_for_approval_changes_status_in_status_side_panel_meta(self):
         edit_url = reverse("wagtailadmin_pages:edit", args=(self.page.id,))
 
         response = self.client.get(edit_url)
@@ -921,7 +921,7 @@ class TestSubmitToWorkflow(TestCase, WagtailTestUtils):
         self.assertContains(response, workflow_status_url)
         self.assertRegex(
             response.content.decode("utf-8"),
-            r"Awaiting[\s|\n]+{}".format(self.page.current_workflow_task.name),
+            r"Sent to[\s|\n]+{}".format(self.page.current_workflow_task.name),
         )
         self.assertNotContains(response, "Draft")
 
@@ -2369,13 +2369,13 @@ class TestWorkflowStatus(TestCase, WagtailTestUtils):
         response = self.client.get(self.edit_url)
         self.assertRegex(
             response.content.decode("utf-8"),
-            r"Awaiting[\s|\n]+{}".format(self.task_1.name),
+            r"Sent to[\s|\n]+{}".format(self.task_1.name),
         )
 
         response = self.workflow_action("approve")
         self.assertRegex(
             response.content.decode("utf-8"),
-            r"Awaiting[\s|\n]+{}".format(self.task_2.name),
+            r"Sent to[\s|\n]+{}".format(self.task_2.name),
         )
 
         response = self.workflow_action("reject")
@@ -2386,7 +2386,7 @@ class TestWorkflowStatus(TestCase, WagtailTestUtils):
         response = self.client.get(self.edit_url)
         self.assertRegex(
             response.content.decode("utf-8"),
-            r"Awaiting[\s|\n]+{}".format(self.task_2.name),
+            r"Sent to[\s|\n]+{}".format(self.task_2.name),
         )
 
         response = self.workflow_action("approve")
@@ -2404,14 +2404,14 @@ class TestWorkflowStatus(TestCase, WagtailTestUtils):
         response = self.workflow_action("approve")
         self.assertRegex(
             response.content.decode("utf-8"),
-            r"Awaiting[\s|\n]+{}".format(self.task_2.name),
+            r"Sent to[\s|\n]+{}".format(self.task_2.name),
         )
         self.workflow_action("reject")
         self.submit("action-restart-workflow")
         response = self.client.get(self.edit_url)
         self.assertRegex(
             response.content.decode("utf-8"),
-            r"Awaiting[\s|\n]+{}".format(self.task_1.name),
+            r"Sent to[\s|\n]+{}".format(self.task_1.name),
         )
 
     def test_workflow_status_modal_task_comments(self):