Remove unnecessary workflow_name/task_name variables

pull/6257/head
Karl Hobley 2020-02-18 12:12:16 +00:00 zatwierdzone przez Matt Westcott
rodzic d7b2e06ece
commit 8487742df8
2 zmienionych plików z 14 dodań i 11 usunięć

Wyświetl plik

@ -1,10 +1,15 @@
{% load wagtailui_tags i18n %} {% load wagtailui_tags i18n %}
{% if workflow_tasks %} {% if workflow_tasks %}
<h2>{{ workflow_name }}</h2> {% with current_task_state.workflow_state as current_workflow_state %}
{% with current_workflow_state.workflow as workflow %}
{% with current_task_state.task as task %}
<h2>{{ workflow.name }}</h2>
{% if current_task_number %} {% if current_task_number %}
{% blocktrans %} Task {{ current_task_number }} of {{ workflow_tasks.count }}{% endblocktrans %}: {{ task_name }} {% blocktrans %} Task {{ current_task_number }} of {{ workflow_tasks.count }}{% endblocktrans %}: {{ task.name }}
{% else %} {% else %}
{% trans 'Task' %}: {{ task_name }} {% trans 'Task' %}: {{ task.name }}
{% endif %} {% endif %}
<div> <div>
{% trans 'Approved task' as approved_title %} {% trans 'Approved task' as approved_title %}
@ -17,4 +22,8 @@
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</div> </div>
{% endwith %}
{% endwith %}
{% endwith %}
{% endif %} {% endif %}

Wyświetl plik

@ -413,8 +413,6 @@ def edit(request, page_id):
workflow_tasks = [] workflow_tasks = []
workflow_state = page.current_workflow_state workflow_state = page.current_workflow_state
workflow_name = ''
task_name = ''
current_task_number = None current_task_number = None
if workflow_state: if workflow_state:
workflow = workflow_state.workflow workflow = workflow_state.workflow
@ -424,8 +422,6 @@ def edit(request, page_id):
except WorkflowTask.DoesNotExist: except WorkflowTask.DoesNotExist:
# The Task has been removed from the Workflow # The Task has been removed from the Workflow
pass pass
task_name = task.name
workflow_name = workflow.name
workflow_tasks = workflow_state.all_tasks_with_status() workflow_tasks = workflow_state.all_tasks_with_status()
@ -447,9 +443,9 @@ def edit(request, page_id):
# If only one task in workflow, show simple message # If only one task in workflow, show simple message
workflow_info = _("This page is currently awaiting moderation") workflow_info = _("This page is currently awaiting moderation")
elif current_task_number: elif current_task_number:
workflow_info = format_html(_("<b>Page '{}'</b> is on <b>Task {} of {}: '{}'</b> in <b>Workflow '{}'</b>. "), page.get_admin_display_title(), current_task_number, workflow_tasks.count(), task_name, workflow_name) workflow_info = format_html(_("<b>Page '{}'</b> is on <b>Task {} of {}: '{}'</b> in <b>Workflow '{}'</b>. "), page.get_admin_display_title(), current_task_number, workflow_tasks.count(), task.name, workflow.name)
else: else:
workflow_info = format_html(_("<b>Page '{}'</b> is on <b>Task '{}'</b> in <b>Workflow '{}'</b>. "), page.get_admin_display_title(), current_task_number, workflow_tasks.count(), task_name, workflow_name) workflow_info = format_html(_("<b>Page '{}'</b> is on <b>Task '{}'</b> in <b>Workflow '{}'</b>. "), page.get_admin_display_title(), current_task_number, workflow_tasks.count(), task.name, workflow.name)
if task_has_been_approved and getattr(settings, 'WAGTAIL_WORKFLOW_REQUIRE_REAPPROVAL_ON_EDIT', True): if task_has_been_approved and getattr(settings, 'WAGTAIL_WORKFLOW_REQUIRE_REAPPROVAL_ON_EDIT', True):
messages.warning(request, mark_safe(workflow_info + _("Editing this Page will cause completed Tasks to need re-approval.")), buttons=buttons, extra_tags="workflow") messages.warning(request, mark_safe(workflow_info + _("Editing this Page will cause completed Tasks to need re-approval.")), buttons=buttons, extra_tags="workflow")
@ -672,8 +668,6 @@ def edit(request, page_id):
'current_task_state': page.current_workflow_task_state, 'current_task_state': page.current_workflow_task_state,
'workflow_tasks': workflow_tasks, 'workflow_tasks': workflow_tasks,
'current_task_number': current_task_number, 'current_task_number': current_task_number,
'task_name': task_name,
'workflow_name': workflow_name,
}) })