mirror of
https://github.com/wagtail/wagtail.git
synced 2024-12-01 11:41:20 +01:00
Improve UI styling of workflow info panel. Implement icons using wagtail_icon tag for accessibility. Add further comments.
This commit is contained in:
parent
02232ff5f0
commit
3a768fc7d8
@ -17,10 +17,12 @@
|
||||
{% blocktrans with title=page.get_admin_display_title page_type=content_type.model_class.get_verbose_name %}Editing {{ page_type }} <span>{{ title }}</span>{% endblocktrans %}
|
||||
</h1>
|
||||
</div>
|
||||
{% if task_statuses %}
|
||||
<div class="center col3">
|
||||
{% include "wagtailadmin/shared/workflow_status.html" with page=page_for_status %}
|
||||
</div>
|
||||
<div class="right col3">
|
||||
{% endif %}
|
||||
<div class="right col{% if task_statuses %}3{% else %}6{% endif %}">
|
||||
{% trans "Status" %}
|
||||
{% include "wagtailadmin/shared/page_status_tag.html" with page=page_for_status %}
|
||||
|
||||
|
@ -1,11 +1,14 @@
|
||||
{% load wagtailui_tags %}
|
||||
{% if task_statuses %}
|
||||
<h2>{{ workflow_name }}</h2>
|
||||
Task {{ current_task_number }} of {{ total_tasks }}: {{ task_name }}
|
||||
<div>
|
||||
{% for status in task_statuses %}
|
||||
{% if status == 'approved' %}
|
||||
<i class="icon icon-success"></i>
|
||||
{% else %}
|
||||
<i class="icon icon-radio-empty"></i>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
Task {% if current_task_number %}{{ current_task_number }} of {{ total_tasks }}{% endif %}: {{ task_name }}
|
||||
<div>
|
||||
{% for status in task_statuses %}
|
||||
{% if status == 'approved' %}
|
||||
{% wagtail_icon name="success" title="Approved task" %}
|
||||
{% else %}
|
||||
{% wagtail_icon name="radio-empty" title="Incomplete task" %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
@ -422,20 +422,26 @@ def edit(request, page_id):
|
||||
workflow_tasks = WorkflowTask.objects.filter(workflow=workflow)
|
||||
try:
|
||||
current_task_number = workflow_tasks.get(task=task).sort_order+1
|
||||
except Task.DoesNotExist:
|
||||
except WorkflowTask.DoesNotExist:
|
||||
# The Task has been removed from the Workflow
|
||||
pass
|
||||
task_name = task.name
|
||||
workflow_name = workflow.name
|
||||
|
||||
states = TaskState.objects.filter(workflow_state=workflow_state, page_revision=page.get_latest_revision()).values('task', 'status')
|
||||
total_tasks = len(workflow_tasks)
|
||||
total_tasks = len(workflow_tasks) # len used as queryset is to be iterated over
|
||||
|
||||
# create a list of task statuses to be passed into the template to show workflow progress
|
||||
for workflow_task in workflow_tasks:
|
||||
try:
|
||||
status = states.get(task=workflow_task.task)['status']
|
||||
except TaskState.DoesNotExist:
|
||||
status = 'not_started'
|
||||
task_statuses.append(status)
|
||||
approved_task = True if 'approved' in task_statuses else False
|
||||
|
||||
# add a warning message if tasks have been approved and may need to be re-approved
|
||||
approved_task = True if 'approved' in task_statuses else False
|
||||
# TODO: allow this warning message to be adapted based on whether tasks will auto-re-approve when an edit is made on a later task or not
|
||||
# TODO: add icon to message when we have added a workflows icon
|
||||
if 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, total_tasks, task_name, workflow_name)
|
||||
|
Loading…
Reference in New Issue
Block a user