From e34ca2a8ee96510f11dfce1787998faf0c6c604d Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Mon, 6 Aug 2018 11:20:50 +0100 Subject: [PATCH] =?UTF-8?q?Make=20it=20clear=20which=20template=20you?= =?UTF-8?q?=E2=80=99re=20sending?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The one downside of skipping the template page is that you no longer get such strong confirmation that you’ve picked the correct template. You still see the preview of the template, but it’s further down the page, and the name of the template has disappeared. This commit adds the name of the template to the page title, to: - have some continuity from the previous page - make it easier to double-check you’ve chosen the correct template --- app/main/views/send.py | 7 ++++--- app/templates/views/notifications/check.html | 4 ++-- tests/app/main/views/test_conversation.py | 2 +- tests/app/main/views/test_send.py | 10 +++++----- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/app/main/views/send.py b/app/main/views/send.py index 5bb7de3f2..e10b4f08d 100644 --- a/app/main/views/send.py +++ b/app/main/views/send.py @@ -451,7 +451,8 @@ def send_test_step(service_id, template_id, step_index): page_title=get_send_test_page_title( template.template_type, get_help_argument(), - entering_recipient=not session['recipient'] + entering_recipient=not session['recipient'], + name=template.name, ), template=template, form=form, @@ -751,13 +752,13 @@ def all_placeholders_in_session(placeholders): ) -def get_send_test_page_title(template_type, help_argument, entering_recipient): +def get_send_test_page_title(template_type, help_argument, entering_recipient, name=None): if help_argument: return 'Example text message' if template_type == 'letter': return 'Print a test letter' if entering_recipient: - return 'Who should this message be sent to?' + return 'Send ‘{}’'.format(name) return 'Personalise this message' diff --git a/app/templates/views/notifications/check.html b/app/templates/views/notifications/check.html index fc2aee128..dec854f0b 100644 --- a/app/templates/views/notifications/check.html +++ b/app/templates/views/notifications/check.html @@ -3,7 +3,7 @@ {% from "components/message-count-label.html" import message_count_label %} {% block service_page_title %} - {{ "Error" if error else "Preview of {}".format(template.name) }} + {{ "Error" if error else "Preview of ‘{}’".format(template.name) }} {% endblock %} {% block maincolumn_content %} @@ -35,7 +35,7 @@ {% else %}

- Preview of {{ template.name }} + Preview of ‘{{ template.name }}’

{% endif %} diff --git a/tests/app/main/views/test_conversation.py b/tests/app/main/views/test_conversation.py index ce55ad28e..533adcec6 100644 --- a/tests/app/main/views/test_conversation.py +++ b/tests/app/main/views/test_conversation.py @@ -295,7 +295,7 @@ def test_conversation_reply_redirects_with_phone_number_from_notification( ) for element, expected_text in [ - ('h1', 'Preview of Two week reminder'), + ('h1', 'Preview of ‘Two week reminder’'), ('.sms-message-recipient', 'To: 07123 456789'), ('.sms-message-wrapper', 'service one: Template content with & entity'), ]: diff --git a/tests/app/main/views/test_send.py b/tests/app/main/views/test_send.py index 4b2cfe3cb..c54da4007 100644 --- a/tests/app/main/views/test_send.py +++ b/tests/app/main/views/test_send.py @@ -919,7 +919,7 @@ def test_send_test_doesnt_show_file_contents( assert response.status_code == 200 page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser') - assert page.select('h1')[0].text.strip() == 'Preview of Two week reminder' + assert page.select('h1')[0].text.strip() == 'Preview of ‘Two week reminder’' assert len(page.select('table')) == 0 assert len(page.select('.banner-dangerous')) == 0 assert page.select_one('button[type=submit]').text.strip() == 'Send 1 text message' @@ -1039,7 +1039,7 @@ def test_send_one_off_does_not_send_without_the_correct_permissions( ( mock_get_service_template_with_placeholders, partial(url_for, 'main.send_one_off'), - 'Who should this message be sent to?', + 'Send ‘Two week reminder’', False, ), ( @@ -1063,7 +1063,7 @@ def test_send_one_off_does_not_send_without_the_correct_permissions( ( mock_get_service_email_template, partial(url_for, 'main.send_one_off'), - 'Who should this message be sent to?', + 'Send ‘Two week reminder’', False, ), ( @@ -1479,7 +1479,7 @@ def test_send_test_email_message_without_placeholders_redirects_to_check_page( ) assert response.status_code == 200 page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser') - assert page.select('h1')[0].text.strip() == 'Preview of Two week reminder' + assert page.select('h1')[0].text.strip() == 'Preview of ‘Two week reminder’' @pytest.mark.parametrize('user, expected_back_link_endpoint, extra_args', ( @@ -2755,7 +2755,7 @@ def test_check_notification_shows_preview( template_id=fake_uuid ) - assert page.h1.text.strip() == 'Preview of Two week reminder' + assert page.h1.text.strip() == 'Preview of ‘Two week reminder’' assert ( page.findAll('a', {'class': 'page-footer-back-link'})[0]['href'] ) == url_for(