workflows: add "bottom of page" position choice for alerts (#22034)
This commit is contained in:
parent
7e8b687816
commit
de1944df73
|
@ -3939,6 +3939,12 @@ def test_backoffice_display_message(pub):
|
||||||
assert 'message-to-submitter' not in resp.body
|
assert 'message-to-submitter' not in resp.body
|
||||||
assert 'message-to-receiver' in resp.body
|
assert 'message-to-receiver' in resp.body
|
||||||
|
|
||||||
|
# display first message at the bottom of the page
|
||||||
|
display1.position = 'bottom'
|
||||||
|
workflow.store()
|
||||||
|
resp = app.get(formdata.get_url(backoffice=True))
|
||||||
|
assert resp.body.index('message-to-all') > resp.body.index('message-to-receiver')
|
||||||
|
|
||||||
# display first message on top of actions
|
# display first message on top of actions
|
||||||
display1.position = 'actions'
|
display1.position = 'actions'
|
||||||
workflow.store()
|
workflow.store()
|
||||||
|
|
|
@ -3562,6 +3562,15 @@ def test_display_message(pub):
|
||||||
assert 'message-to-submitter' not in page.body
|
assert 'message-to-submitter' not in page.body
|
||||||
assert 'message-to-xxx-and-submitter' in page.body
|
assert 'message-to-xxx-and-submitter' in page.body
|
||||||
|
|
||||||
|
# change to always display at the bottom
|
||||||
|
display2.position = 'bottom'
|
||||||
|
workflow.store()
|
||||||
|
page = app.get(formdata.get_url())
|
||||||
|
assert 'message-to-all' in page.body
|
||||||
|
assert 'message-to-submitter' in page.body
|
||||||
|
assert 'message-to-xxx-and-submitter' in page.body
|
||||||
|
assert page.body.index('message-to-submitter') > page.body.index('message-to-xxx-and-submitter')
|
||||||
|
|
||||||
def test_session_cookie_flags(pub):
|
def test_session_cookie_flags(pub):
|
||||||
formdef = create_formdef()
|
formdef = create_formdef()
|
||||||
app = get_app(pub)
|
app = get_app(pub)
|
||||||
|
|
|
@ -178,6 +178,9 @@ class FormStatusPage(Directory):
|
||||||
def actions_workflow_messages(self):
|
def actions_workflow_messages(self):
|
||||||
return self.workflow_messages(position='actions')
|
return self.workflow_messages(position='actions')
|
||||||
|
|
||||||
|
def bottom_workflow_messages(self):
|
||||||
|
return self.workflow_messages(position='bottom')
|
||||||
|
|
||||||
def recorded_message(self):
|
def recorded_message(self):
|
||||||
r = TemplateIO(html=True)
|
r = TemplateIO(html=True)
|
||||||
# behaviour if workflow doesn't display any message
|
# behaviour if workflow doesn't display any message
|
||||||
|
@ -465,6 +468,8 @@ class FormStatusPage(Directory):
|
||||||
|
|
||||||
r += self.history()
|
r += self.history()
|
||||||
|
|
||||||
|
r += htmltext(self.bottom_workflow_messages())
|
||||||
|
|
||||||
locked = False
|
locked = False
|
||||||
if form:
|
if form:
|
||||||
all_visitors = get_publisher().get_object_visitors(object_key)
|
all_visitors = get_publisher().get_object_visitors(object_key)
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
{{ view.receipt|safe }}
|
{{ view.receipt|safe }}
|
||||||
{{ view.history|safe }}
|
{{ view.history|safe }}
|
||||||
|
{{ view.bottom_workflow_messages|safe }}
|
||||||
{% if workflow_form %}
|
{% if workflow_form %}
|
||||||
{{ view.actions_workflow_messages|safe }}
|
{{ view.actions_workflow_messages|safe }}
|
||||||
{{ workflow_form.render|safe }}
|
{{ workflow_form.render|safe }}
|
||||||
|
|
|
@ -2404,8 +2404,10 @@ class DisplayMessageWorkflowStatusItem(WorkflowStatusItem):
|
||||||
parts = []
|
parts = []
|
||||||
if self.position == 'top':
|
if self.position == 'top':
|
||||||
parts.append(_('top of page'))
|
parts.append(_('top of page'))
|
||||||
|
elif self.position == 'bottom':
|
||||||
|
parts.append(_('bottom of page'))
|
||||||
elif self.position == 'actions':
|
elif self.position == 'actions':
|
||||||
parts.append(_('top of actions'))
|
parts.append(_('with actions'))
|
||||||
if self.to:
|
if self.to:
|
||||||
parts.append(_('for %s') % self.render_list_of_roles(self.to))
|
parts.append(_('for %s') % self.render_list_of_roles(self.to))
|
||||||
return ', '.join(parts)
|
return ', '.join(parts)
|
||||||
|
@ -2448,7 +2450,9 @@ class DisplayMessageWorkflowStatusItem(WorkflowStatusItem):
|
||||||
if 'position' in parameters:
|
if 'position' in parameters:
|
||||||
form.add(SingleSelectWidget, '%sposition' % prefix, title=_('Position'),
|
form.add(SingleSelectWidget, '%sposition' % prefix, title=_('Position'),
|
||||||
value=self.position,
|
value=self.position,
|
||||||
options=[('top', _('Top of page')), ('actions', _('Top of actions'))])
|
options=[('top', _('Top of page')),
|
||||||
|
('bottom', _('Bottom of page')),
|
||||||
|
('actions', _('With actions'))])
|
||||||
if 'to' in parameters:
|
if 'to' in parameters:
|
||||||
form.add(WidgetList, '%sto' % prefix, title=_('To'),
|
form.add(WidgetList, '%sto' % prefix, title=_('To'),
|
||||||
element_type=SingleSelectWidget,
|
element_type=SingleSelectWidget,
|
||||||
|
|
Loading…
Reference in New Issue