backoffice: regroup status options in a single popup (#7165) #565
|
@ -336,14 +336,14 @@ def test_workflows_edit_status(pub):
|
|||
resp = app.get('/backoffice/workflows/1/')
|
||||
resp = resp.click('baz')
|
||||
|
||||
resp = resp.click('Change Status Name')
|
||||
resp = resp.click('Change Name')
|
||||
resp.forms[0]['name'] = 'bza'
|
||||
resp = resp.forms[0].submit()
|
||||
assert resp.location == 'http://example.net/backoffice/workflows/1/status/1/'
|
||||
resp = resp.follow()
|
||||
assert Workflow.get(1).possible_status[0].name == 'bza'
|
||||
|
||||
resp = resp.click('Change Display Settings')
|
||||
resp = resp.click('Options')
|
||||
resp.forms[0]['hide_status_from_user'].checked = True
|
||||
resp = resp.forms[0].submit()
|
||||
assert resp.location == 'http://example.net/backoffice/workflows/1/status/1/'
|
||||
|
@ -351,20 +351,20 @@ def test_workflows_edit_status(pub):
|
|||
assert Workflow.get(1).possible_status[0].visibility == ['_receiver']
|
||||
|
||||
assert 'This status has been automatically evaluated as being terminal.' in resp.text
|
||||
resp = resp.click('Force Terminal Status')
|
||||
resp = resp.click('Options')
|
||||
resp.forms[0]['force_terminal_status'].checked = True
|
||||
resp = resp.forms[0].submit()
|
||||
assert resp.location == 'http://example.net/backoffice/workflows/1/status/1/'
|
||||
resp = resp.follow()
|
||||
assert Workflow.get(1).possible_status[0].forced_endpoint is True
|
||||
assert 'This status has been manually set to be considered as terminal.' in resp.text
|
||||
resp = resp.click('Unforce Terminal Status')
|
||||
resp = resp.click('Options')
|
||||
resp.forms[0]['force_terminal_status'].checked = False
|
||||
resp = resp.forms[0].submit()
|
||||
assert resp.location == 'http://example.net/backoffice/workflows/1/status/1/'
|
||||
resp = resp.follow()
|
||||
|
||||
resp = resp.click('Change Display Settings')
|
||||
resp = resp.click('Options')
|
||||
assert resp.forms[0]['colour'].value == 'FFFFFF'
|
||||
assert resp.forms[0]['extra_css_class'].value == ''
|
||||
resp.forms[0]['colour'] = 'FF0000'
|
||||
|
@ -375,7 +375,7 @@ def test_workflows_edit_status(pub):
|
|||
assert Workflow.get(1).possible_status[0].colour == 'FF0000'
|
||||
assert Workflow.get(1).possible_status[0].extra_css_class == 'plop'
|
||||
|
||||
resp = resp.click('Change Display Settings')
|
||||
resp = resp.click('Options')
|
||||
assert resp.forms[0]['colour'].value == 'FF0000'
|
||||
assert resp.forms[0]['extra_css_class'].value == 'plop'
|
||||
resp.forms[0]['extra_css_class'] = 'xxx'
|
||||
|
@ -384,7 +384,8 @@ def test_workflows_edit_status(pub):
|
|||
assert resp.location == 'http://example.net/backoffice/workflows/1/status/1/'
|
||||
resp = resp.follow()
|
||||
|
||||
resp = resp.click('Change Backoffice Information Text')
|
||||
resp = resp.click('Options')
|
||||
assert resp.forms[0]['colour'].value == 'FF0000'
|
||||
assert resp.forms[0]['backoffice_info_text'].value == ''
|
||||
resp.forms[0]['backoffice_info_text'] = '<p>Hello</p>'
|
||||
resp = resp.forms[0].submit()
|
||||
|
@ -1645,6 +1646,9 @@ def test_workflows_edit_choice_action(pub):
|
|||
|
||||
|
||||
def test_workflows_edit_choice_action_functions_only(pub):
|
||||
pub.role_class.wipe()
|
||||
role = pub.role_class(name='foobar')
|
||||
role.store()
|
||||
create_superuser(pub)
|
||||
Workflow.wipe()
|
||||
workflow = Workflow(name='foo')
|
||||
|
@ -2348,7 +2352,7 @@ def test_workflows_functions_vs_visibility(pub):
|
|||
app = login(get_app(pub))
|
||||
resp = app.get('/backoffice/workflows/%s/' % workflow.id)
|
||||
resp = resp.click('Just Submitted')
|
||||
resp = resp.click('Change Display Settings')
|
||||
resp = resp.click('Options')
|
||||
resp.forms[0]['hide_status_from_user'].checked = True
|
||||
resp = resp.forms[0].submit()
|
||||
assert Workflow.get(workflow.id).possible_status[0].visibility == ['_receiver']
|
||||
|
@ -2366,7 +2370,7 @@ def test_workflows_functions_vs_visibility(pub):
|
|||
# functions
|
||||
resp = app.get('/backoffice/workflows/%s/' % workflow.id)
|
||||
resp = resp.click('Rejected')
|
||||
resp = resp.click('Change Display Settings')
|
||||
resp = resp.click('Options')
|
||||
resp.forms[0]['hide_status_from_user'].checked = True
|
||||
resp = resp.forms[0].submit()
|
||||
assert set(Workflow.get(workflow.id).possible_status[2].visibility) == {'_receiver', '_other-function'}
|
||||
|
|
|
@ -656,9 +656,7 @@ class WorkflowStatusPage(Directory):
|
|||
'update_order',
|
||||
'edit',
|
||||
'reassign',
|
||||
'endpoint',
|
||||
'display',
|
||||
('backoffice-info-text', 'backoffice_info_text'),
|
||||
'options',
|
||||
'fullscreen',
|
||||
('schema.svg', 'svg'),
|
||||
'svg',
|
||||
|
@ -848,10 +846,10 @@ class WorkflowStatusPage(Directory):
|
|||
self.workflow.store(comment=_('Change name of status %s') % new_name)
|
||||
return redirect('.')
|
||||
|
||||
get_response().set_title(_('Edit Workflow Status'))
|
||||
get_response().set_title(_('Edit Status Name'))
|
||||
get_response().breadcrumb.append(('edit', _('Edit')))
|
||||
r = TemplateIO(html=True)
|
||||
r += htmltext('<h2>%s</h2>') % _('Edit Workflow Status')
|
||||
r += htmltext('<h2>%s</h2>') % _('Edit Status Name')
|
||||
r += form.render()
|
||||
return r.getvalue()
|
||||
|
||||
|
@ -935,7 +933,7 @@ class WorkflowStatusPage(Directory):
|
|||
get_response().add_after_job(job)
|
||||
return redirect(job.get_processing_url())
|
||||
|
||||
def display(self):
|
||||
def options(self):
|
||||
form = Form(enctype='multipart/form-data')
|
||||
form.add(
|
||||
CheckboxWidget,
|
||||
|
@ -943,7 +941,6 @@ class WorkflowStatusPage(Directory):
|
|||
title=_('Hide status from user'),
|
||||
value=bool(self.status.get_visibility_restricted_roles()),
|
||||
)
|
||||
|
||||
form.add(ColourWidget, 'colour', title=_('Colour in backoffice'), value=self.status.colour)
|
||||
form.add(
|
||||
StringWidget,
|
||||
|
@ -951,6 +948,18 @@ class WorkflowStatusPage(Directory):
|
|||
title=_('Extra CSS for frontoffice style'),
|
||||
value=self.status.extra_css_class,
|
||||
)
|
||||
form.add(
|
||||
CheckboxWidget,
|
||||
'force_terminal_status',
|
||||
title=_('Force Terminal Status'),
|
||||
value=(self.status.forced_endpoint is True),
|
||||
)
|
||||
form.add(
|
||||
WysiwygTextWidget,
|
||||
'backoffice_info_text',
|
||||
title=_('Information text for backoffice'),
|
||||
value=self.status.backoffice_info_text,
|
||||
)
|
||||
|
||||
form.add_submit('submit', _('Submit'))
|
||||
form.add_submit('cancel', _('Cancel'))
|
||||
|
@ -965,60 +974,18 @@ class WorkflowStatusPage(Directory):
|
|||
self.status.visibility = None
|
||||
self.status.colour = form.get_widget('colour').parse() or 'ffffff'
|
||||
self.status.extra_css_class = form.get_widget('extra_css_class').parse()
|
||||
self.workflow.store(comment=_('Change in display options'))
|
||||
self.status.forced_endpoint = form.get_widget('force_terminal_status').parse()
|
||||
self.status.backoffice_info_text = form.get_widget('backoffice_info_text').parse()
|
||||
self.workflow.store(comment=_('Change in "%s" status options') % self.status.name)
|
||||
return redirect('.')
|
||||
|
||||
get_response().set_title(_('Change Display Settings'))
|
||||
get_response().breadcrumb.append(('display', _('Display Settings')))
|
||||
get_response().set_title(_('Status Options'))
|
||||
get_response().breadcrumb.append(('options', _('Status Options')))
|
||||
r = TemplateIO(html=True)
|
||||
r += htmltext('<h2>%s</h2>') % _('Change Display Settings')
|
||||
r += htmltext('<h2>%s</h2>') % _('Change Status Options')
|
||||
r += form.render()
|
||||
return r.getvalue()
|
||||
|
||||
def endpoint(self):
|
||||
form = Form(enctype='multipart/form-data')
|
||||
form.add(
|
||||
CheckboxWidget,
|
||||
'force_terminal_status',
|
||||
title=_('Force Terminal Status'),
|
||||
value=(self.status.forced_endpoint is True),
|
||||
)
|
||||
form.add_submit('submit', _('Submit'))
|
||||
form.add_submit('cancel', _('Cancel'))
|
||||
if form.get_widget('cancel').parse():
|
||||
return redirect('.')
|
||||
|
||||
if form.is_submitted() and not form.has_errors():
|
||||
self.status.forced_endpoint = form.get_widget('force_terminal_status').parse()
|
||||
self.workflow.store(comment=_('Change of terminal status option'))
|
||||
return redirect('.')
|
||||
|
||||
get_response().set_title(_('Edit Terminal Status'))
|
||||
get_response().breadcrumb.append(('endpoint', _('Terminal Status')))
|
||||
return form.render()
|
||||
|
||||
def backoffice_info_text(self):
|
||||
form = Form(enctype='multipart/form-data')
|
||||
form.add(
|
||||
WysiwygTextWidget,
|
||||
'backoffice_info_text',
|
||||
title=_('Information text for backoffice'),
|
||||
value=self.status.backoffice_info_text,
|
||||
)
|
||||
form.add_submit('submit', _('Submit'))
|
||||
form.add_submit('cancel', _('Cancel'))
|
||||
if form.get_widget('cancel').parse():
|
||||
return redirect('.')
|
||||
|
||||
if form.is_submitted() and not form.has_errors():
|
||||
self.status.backoffice_info_text = form.get_widget('backoffice_info_text').parse()
|
||||
self.workflow.store(comment=_('Change in backoffice info text'))
|
||||
return redirect('.')
|
||||
|
||||
get_response().set_title(_('Edit Backoffice Information Text'))
|
||||
get_response().breadcrumb.append(('backoffice_info_text', _('Backoffice Information Text')))
|
||||
return form.render()
|
||||
|
||||
|
||||
class WorkflowStatusDirectory(Directory):
|
||||
_q_exports = ['', ('new-status', 'new')]
|
||||
|
|
|
@ -3,6 +3,19 @@
|
|||
|
||||
{% block appbar-title %}{{ status.name }}{% endblock %}
|
||||
|
||||
{% block appbar-actions %}
|
||||
<a class="extra-actions-menu-opener"></a>
|
||||
<ul class="extra-actions-menu">
|
||||
{% if not workflow.is_readonly %}
|
||||
<li><a href="delete" rel="popup">{% trans "Delete" %}</a></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
{% if not workflow.is_readonly %}
|
||||
<a rel="popup" href="options">{% trans "Options" %}</a>
|
||||
<a rel="popup" href="edit">{% trans "Change Name" %}</a>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{{ block.super }}
|
||||
|
||||
|
@ -98,16 +111,7 @@
|
|||
</div>
|
||||
{% endif %}
|
||||
|
||||
<ul id="sidebar-actions">
|
||||
<li><a href="edit" rel="popup">{% trans "Change Status Name" %}</a></li>
|
||||
<li><a href="display" rel="popup">{% trans "Change Display Settings" %}</a></li>
|
||||
{% if not status.forced_endpoint %}
|
||||
<li><a href="endpoint" rel="popup">{% trans "Force Terminal Status" %}</a></li>
|
||||
{% endif %}
|
||||
<li><a href="backoffice-info-text" rel="popup">{% trans "Change Backoffice Information Text" %}</a></li>
|
||||
<li><a href="delete" rel="popup">{% trans "Delete" %}</a></li>
|
||||
</ul>
|
||||
<div id="new-field">
|
||||
<div>
|
||||
<h3>{% trans "New Action" %}</h3>
|
||||
{{ view.get_new_item_form.render|safe }}
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue