From ef4d3d111fd119e8f1fa40c4b254dbaed1637fd7 Mon Sep 17 00:00:00 2001 From: Leo Hemsted Date: Fri, 30 Jun 2017 11:49:03 +0100 Subject: [PATCH] help (aka tour) now works correctly throughout the notification flow --- app/main/views/send.py | 16 ++--- app/templates/views/jobs/job.html | 10 ++-- app/templates/views/notifications/check.html | 8 ++- .../views/notifications/notification.html | 10 ++-- tests/app/main/views/test_send.py | 58 ++++++++++++++----- 5 files changed, 64 insertions(+), 38 deletions(-) diff --git a/app/main/views/send.py b/app/main/views/send.py index 5572b7036..ea681bc60 100644 --- a/app/main/views/send.py +++ b/app/main/views/send.py @@ -183,6 +183,8 @@ def get_notification_check_endpoint(service_id, template): 'main.check_notification', service_id=service_id, template_id=template.id, + # at check phase we should move to help stage 2 ("the template pulls in the data you provide") + help='2' if 'help' in request.args else None )) @@ -381,15 +383,8 @@ def _check_messages(service_id, template_type, upload_id, letters_as_pdf=False): ) if request.args.get('from_test'): - extra_args = {'help': 1} if request.args.get('help', '0') != '0' else {} - if len(template.placeholders) or template.template_type == 'letter': - back_link = url_for( - '.send_test', service_id=service_id, template_id=template.id, **extra_args - ) - else: - back_link = url_for( - '.view_template', service_id=service_id, template_id=template.id, **extra_args - ) + # only happens if generating a letter preview test + back_link = url_for('.send_test', service_id=service_id, template_id=template.id) choose_time_form = None else: back_link = url_for('.send_messages', service_id=service_id, template_id=template.id) @@ -689,5 +684,6 @@ def send_notification(service_id, template_id): return redirect(url_for( '.view_notification', service_id=service_id, - notification_id=noti['id'] + notification_id=noti['id'], + help=request.args.get('help') )) diff --git a/app/templates/views/jobs/job.html b/app/templates/views/jobs/job.html index 14aa297bf..9483766d4 100644 --- a/app/templates/views/jobs/job.html +++ b/app/templates/views/jobs/job.html @@ -19,11 +19,9 @@ {{ ajax_block(partials, updates_url, 'counts', finished=finished) }} {{ ajax_block(partials, updates_url, 'notifications', finished=finished) }} - {% if not help %} - {{ page_footer( - secondary_link=url_for('.view_template', service_id=current_service.id, template_id=template.id), - secondary_link_text='Back to {}'.format(template.name) - ) }} - {% endif %} + {{ page_footer( + secondary_link=url_for('.view_template', service_id=current_service.id, template_id=template.id), + secondary_link_text='Back to {}'.format(template.name) + ) }} {% endblock %} diff --git a/app/templates/views/notifications/check.html b/app/templates/views/notifications/check.html index 02656faae..fb336b631 100644 --- a/app/templates/views/notifications/check.html +++ b/app/templates/views/notifications/check.html @@ -28,9 +28,13 @@ {{ template|string }}
-