admin: display workflow functions in alphabetical order (#35618)

This commit is contained in:
Frédéric Péters 2019-08-27 19:41:42 +02:00 committed by Thomas NOEL
parent 0bfff4a3a8
commit aec1c32c9c
2 changed files with 6 additions and 2 deletions

View File

@ -477,7 +477,9 @@ class FormDefPage(Directory):
if self.formdef.workflow.roles:
if not self.formdef.workflow_roles:
self.formdef.workflow_roles = {}
for (wf_role_id, wf_role_label) in self.formdef.workflow.roles.items():
workflow_roles = (self.formdef.workflow.roles or {}).items()
workflow_roles.sort(key=lambda x: -1 if x[0] == '_receiver' else misc.simplify(x[1]))
for (wf_role_id, wf_role_label) in workflow_roles:
role_id = self.formdef.workflow_roles.get(wf_role_id)
if role_id:
try:

View File

@ -1435,7 +1435,9 @@ class WorkflowPage(Directory):
r += htmltext(' <span class="change">(<a rel="popup" href="functions/new">%s</a>)</span>') % _('add function')
r += htmltext('</h3>')
r += htmltext('<ul id="roles-list" class="biglist">')
for key, label in (self.workflow.roles or {}).items():
workflow_roles = (self.workflow.roles or {}).items()
workflow_roles.sort(key=lambda x: -1 if x[0] == '_receiver' else misc.simplify(x[1]))
for key, label in workflow_roles:
r += htmltext('<li class="biglistitem">')
if not str(self.workflow.id).startswith('_'):
r += htmltext('<a rel="popup" href="functions/%s">%s</a>') % (key[1:], label)