diff --git a/tests/test_backoffice_pages.py b/tests/test_backoffice_pages.py index 2c5677dc6..6c0d57587 100644 --- a/tests/test_backoffice_pages.py +++ b/tests/test_backoffice_pages.py @@ -3939,6 +3939,12 @@ def test_backoffice_display_message(pub): assert 'message-to-submitter' not 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 display1.position = 'actions' workflow.store() diff --git a/tests/test_form_pages.py b/tests/test_form_pages.py index e40645c8d..540206df0 100644 --- a/tests/test_form_pages.py +++ b/tests/test_form_pages.py @@ -3562,6 +3562,15 @@ def test_display_message(pub): assert 'message-to-submitter' not 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): formdef = create_formdef() app = get_app(pub) diff --git a/wcs/forms/common.py b/wcs/forms/common.py index f53d89c2a..b77ac413f 100644 --- a/wcs/forms/common.py +++ b/wcs/forms/common.py @@ -178,6 +178,9 @@ class FormStatusPage(Directory): def actions_workflow_messages(self): return self.workflow_messages(position='actions') + def bottom_workflow_messages(self): + return self.workflow_messages(position='bottom') + def recorded_message(self): r = TemplateIO(html=True) # behaviour if workflow doesn't display any message @@ -465,6 +468,8 @@ class FormStatusPage(Directory): r += self.history() + r += htmltext(self.bottom_workflow_messages()) + locked = False if form: all_visitors = get_publisher().get_object_visitors(object_key) diff --git a/wcs/templates/wcs/formdata_status.html b/wcs/templates/wcs/formdata_status.html index 278106dc6..151979ac0 100644 --- a/wcs/templates/wcs/formdata_status.html +++ b/wcs/templates/wcs/formdata_status.html @@ -21,6 +21,7 @@ {{ view.receipt|safe }} {{ view.history|safe }} +{{ view.bottom_workflow_messages|safe }} {% if workflow_form %} {{ view.actions_workflow_messages|safe }} {{ workflow_form.render|safe }} diff --git a/wcs/workflows.py b/wcs/workflows.py index 433d2d618..f04e9f0a0 100644 --- a/wcs/workflows.py +++ b/wcs/workflows.py @@ -2404,8 +2404,10 @@ class DisplayMessageWorkflowStatusItem(WorkflowStatusItem): parts = [] if self.position == 'top': parts.append(_('top of page')) + elif self.position == 'bottom': + parts.append(_('bottom of page')) elif self.position == 'actions': - parts.append(_('top of actions')) + parts.append(_('with actions')) if self.to: parts.append(_('for %s') % self.render_list_of_roles(self.to)) return ', '.join(parts) @@ -2448,7 +2450,9 @@ class DisplayMessageWorkflowStatusItem(WorkflowStatusItem): if 'position' in parameters: form.add(SingleSelectWidget, '%sposition' % prefix, title=_('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: form.add(WidgetList, '%sto' % prefix, title=_('To'), element_type=SingleSelectWidget,