From 6dc81ad3fe243ede01f64e0aff76af451b27c0e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Mon, 16 May 2016 18:35:44 +0200 Subject: [PATCH] backoffice: include formdata sidebar in edit mode (#10946) --- tests/test_backoffice_pages.py | 6 ++++++ wcs/backoffice/submission.py | 12 ++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/tests/test_backoffice_pages.py b/tests/test_backoffice_pages.py index f877fb2..d1f925a 100644 --- a/tests/test_backoffice_pages.py +++ b/tests/test_backoffice_pages.py @@ -1554,6 +1554,10 @@ def test_backoffice_wfedit(pub): form_class = formdef.data_class() number31 = [x for x in form_class.select() if x.data['1'] == 'FOO BAR 30'][0] + number31.submission_context = { + 'mail_url': 'http://www.example.com/test.pdf', + } + number31.store() # attach a custom workflow workflow = Workflow(name='wfedit') @@ -1575,6 +1579,8 @@ def test_backoffice_wfedit(pub): assert (' with the number %s.' % number31.get_display_id()) in resp.body resp = resp.form.submit('button_wfedit') resp = resp.follow() + assert 'http://www.example.com/test.pdf' in resp.body # make sure sidebar has details + assert not 'Tracking Code' in resp.body # make sure it doesn't display a tracking code assert resp.form['f1'].value == number31.data['1'] assert resp.form['f2'].value == number31.data['2'] assert resp.form['f3'].value == number31.data['3'] diff --git a/wcs/backoffice/submission.py b/wcs/backoffice/submission.py index 819a7f3..6b55876 100644 --- a/wcs/backoffice/submission.py +++ b/wcs/backoffice/submission.py @@ -94,10 +94,14 @@ class FormFillPage(PublicFormFillPage): r = TemplateIO(html=True) formdata = None - draft_formdata_id = data.get('draft_formdata_id') - if draft_formdata_id: - formdata = self.formdef.data_class().get(draft_formdata_id) - if self.formdef.enable_tracking_codes: + if self.edit_mode: + formdata = self.edited_data + else: + draft_formdata_id = data.get('draft_formdata_id') + if draft_formdata_id: + formdata = self.formdef.data_class().get(draft_formdata_id) + + if self.formdef.enable_tracking_codes and not self.edit_mode: r += htmltext('

%s

') % _('Tracking Code') if formdata and formdata.tracking_code: r += htmltext('

%s

') % formdata.tracking_code -- 2.8.1