Skip to content

Commit f1d419d

Browse files
authored
Move post submission warning panel to footer (#398)
1 parent 6d2d12c commit f1d419d

18 files changed

+78
-53
lines changed

app/routes/questionnaire.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ def send_confirmation_email(session_store, schema):
334334
return render_template(
335335
template="confirmation-email",
336336
content=confirmation_email.get_context(),
337-
hide_signout_button=True,
337+
hide_sign_out_button=True,
338338
page_title=confirmation_email.get_page_title(),
339339
)
340340

@@ -358,11 +358,12 @@ def get_confirmation_email_sent(session_store, schema):
358358
return render_template(
359359
template="confirmation-email-sent",
360360
content={
361+
"show_sign_out_warning": True,
361362
"email": email,
362363
"send_confirmation_email_url": url_for(
363364
"post_submission.send_confirmation_email"
364365
),
365-
"hide_signout_button": False,
366+
"hide_sign_out_button": False,
366367
"show_send_another_email_guidance": show_send_another_email_guidance,
367368
"sign_out_url": url_for("session.get_sign_out"),
368369
"show_feedback_call_to_action": show_feedback_call_to_action,
@@ -399,7 +400,8 @@ def get_feedback_sent(session_store):
399400
return render_template(
400401
template="feedback-sent",
401402
content={
402-
"hide_signout_button": False,
403+
"show_sign_out_warning": True,
404+
"hide_sign_out_button": False,
403405
"sign_out_url": url_for("session.get_sign_out"),
404406
},
405407
)

app/translations/messages.pot

+17-17
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ msgid ""
88
msgstr ""
99
"Project-Id-Version: PROJECT VERSION\n"
1010
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
11-
"POT-Creation-Date: 2020-11-05 14:44+0000\n"
11+
"POT-Creation-Date: 2020-11-06 08:05+0000\n"
1212
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1313
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1414
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -938,46 +938,52 @@ msgstr ""
938938
msgid "Choose another section and return to this later"
939939
msgstr ""
940940

941-
#: templates/layouts/configs/_footer.html:6
941+
#: templates/layouts/configs/_footer.html:5
942942
msgid "The following links open in a new tab"
943943
msgstr ""
944944

945-
#: templates/layouts/configs/_footer.html:12
945+
#: templates/layouts/configs/_footer.html:11
946946
msgid "Help"
947947
msgstr ""
948948

949-
#: templates/layouts/configs/_footer.html:17
949+
#: templates/layouts/configs/_footer.html:16
950950
msgid "Contact us"
951951
msgstr ""
952952

953-
#: templates/layouts/configs/_footer.html:26
953+
#: templates/layouts/configs/_footer.html:25
954954
msgid "Cookies"
955955
msgstr ""
956956

957-
#: templates/layouts/configs/_footer.html:31
957+
#: templates/layouts/configs/_footer.html:30
958958
msgid "Accessibility statement"
959959
msgstr ""
960960

961-
#: templates/layouts/configs/_footer.html:36
961+
#: templates/layouts/configs/_footer.html:35
962962
msgid "Privacy and data protection"
963963
msgstr ""
964964

965-
#: templates/layouts/configs/_footer.html:41
965+
#: templates/layouts/configs/_footer.html:40
966966
msgid "Terms and conditions"
967967
msgstr ""
968968

969-
#: templates/layouts/configs/_footer.html:49
969+
#: templates/layouts/configs/_footer.html:48
970970
msgid "Crown copyright and database rights 2020 OS 100019153."
971971
msgstr ""
972972

973-
#: templates/layouts/configs/_footer.html:50
973+
#: templates/layouts/configs/_footer.html:49
974974
msgid "Use of address data is subject to the"
975975
msgstr ""
976976

977-
#: templates/layouts/configs/_footer.html:51
977+
#: templates/layouts/configs/_footer.html:50
978978
msgid "terms and conditions"
979979
msgstr ""
980980

981+
#: templates/layouts/configs/_footer.html:57
982+
msgid ""
983+
"Make sure you <a href={sign_out_url}>leave this page</a> or close your "
984+
"browser if using a shared device"
985+
msgstr ""
986+
981987
#: templates/layouts/configs/_save-sign-out-button.html:5
982988
msgid "Save and sign out"
983989
msgstr ""
@@ -1060,12 +1066,6 @@ msgstr ""
10601066
msgid "Or"
10611067
msgstr ""
10621068

1063-
#: templates/partials/sign-out-pre-footer-panel.html:8
1064-
msgid ""
1065-
"Make sure you <a href='{sign_out_url}'>leave this page</a> or close your "
1066-
"browser if using a shared device"
1067-
msgstr ""
1068-
10691069
#: templates/partials/answers/address.html:10
10701070
msgid "Address line 1"
10711071
msgstr ""

app/views/contexts/email_form_context.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33

44
def build_confirmation_email_form_context(email_confirmation_form):
55
context = {
6-
"hide_signout_button": False,
6+
"show_sign_out_warning": True,
7+
"hide_sign_out_button": False,
78
"sign_out_url": url_for("session.get_sign_out"),
89
}
910
context.update(build_email_form_context(email_confirmation_form))

app/views/contexts/feedback_form_context.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33

44
def build_feedback_context(question_schema, form):
55
context = {
6+
"show_sign_out_warning": True,
67
"form": {
78
"errors": form.errors,
89
"mapped_errors": form.map_errors(),
910
"answer_errors": {},
1011
"fields": {},
1112
},
12-
"hide_signout_button": False,
13+
"hide_sign_out_button": False,
1314
"question": question_schema,
1415
"sign_out_url": url_for("session.get_sign_out"),
1516
}

app/views/contexts/thank_you_context.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@
1010
def build_default_thank_you_context(session_data: SessionData) -> Mapping:
1111

1212
context = {
13+
"show_sign_out_warning": True,
1314
"submitted_time": session_data.submitted_time,
1415
"tx_id": convert_tx_id(session_data.tx_id),
1516
"ru_ref": session_data.ru_ref,
1617
"trad_as": session_data.trad_as,
1718
"account_service_url": session_data.account_service_url,
18-
"hide_signout_button": True,
19+
"hide_sign_out_button": True,
1920
}
2021

2122
if session_data.period_str:
@@ -31,9 +32,10 @@ def build_census_thank_you_context(
3132
) -> Mapping:
3233

3334
context = {
35+
"show_sign_out_warning": True,
3436
"display_address": session_data.display_address,
3537
"form_type": form_type,
36-
"hide_signout_button": False,
38+
"hide_sign_out_button": False,
3739
"sign_out_url": url_for("session.get_sign_out"),
3840
}
3941
if confirmation_email_form:

templates/census-thank-you.html

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{% extends 'layouts/_base.html' %}
22
{% from 'components/panel/_macro.njk' import onsPanel %}
3-
{% set hide_signout_button = content.hide_signout_button %}
3+
{% set hide_sign_out_button = content.hide_sign_out_button %}
44
{% set sign_out_url = content.sign_out_url %}
55

66
{% block main %}
@@ -61,6 +61,4 @@ <h2 class="u-mt-m">{{ _("Get confirmation email") }}</h2>
6161
{% include 'partials/feedback-call-to-action.html' %}
6262
{% endif %}
6363

64-
{% include 'partials/sign-out-pre-footer-panel.html' %}
65-
6664
{% endblock %}

templates/confirmation-email-sent.html

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{% extends 'layouts/_base.html' %}
22
{% from 'components/panel/_macro.njk' import onsPanel %}
33
{% set page_title = _("Confirmation email sent") %}
4-
{% set hide_signout_button = content.hide_signout_button %}
4+
{% set hide_sign_out_button = content.hide_sign_out_button %}
55
{% set sign_out_url = content.sign_out_url %}
66

77
{% block main %}
@@ -34,6 +34,4 @@ <h1 data-qa="confirmation-text">{{ _("A confirmation email has been sent to {ema
3434
{% include 'partials/feedback-call-to-action.html' %}
3535
{% endif %}
3636

37-
{% include 'partials/sign-out-pre-footer-panel.html' %}
38-
3937
{% endblock %}

templates/confirmation-email.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{% extends 'layouts/_base.html' %}
2-
{% set hide_signout_button = content.hide_signout_button %}
2+
{% set hide_sign_out_button = content.hide_sign_out_button %}
33
{% set sign_out_url = content.sign_out_url %}
44

55
{% block main %}

templates/errors/submission-failed.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{% extends 'layouts/_base.html' %}
22

3-
{% set hide_signout_button = True %}
3+
{% set hide_sign_out_button = True %}
44

55
{% set page_title = _("Sorry, there is a problem") %}
66

templates/feedback-sent.html

+1-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
{% from 'components/panel/_macro.njk' import onsPanel %}
33
{% from 'components/button/_macro.njk' import onsButton %}
44

5-
{% set hide_signout_button = content.hide_signout_button %}
5+
{% set hide_sign_out_button = content.hide_sign_out_button %}
66
{% set page_title = _("Feedback sent") %}
77
{% set sign_out_url = content.sign_out_url %}
88

@@ -31,6 +31,4 @@ <h1 data-qa="feedback-thank-you-text">{{ _("Thank you for your feedback") }}</h1
3131
})
3232
}}
3333

34-
{% include 'partials/sign-out-pre-footer-panel.html' %}
35-
3634
{% endblock %}

templates/feedback.html

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{% from "components/button/_macro.njk" import onsButton %}
44
{% from 'components/panel/_macro.njk' import onsPanel %}
55

6-
{% set hide_signout_button = content.hide_signout_button %}
6+
{% set hide_sign_out_button = content.hide_sign_out_button %}
77
{% set question = content.question %}
88
{% set sign_out_url = content.sign_out_url %}
99
{% set breadcrumbs = {
@@ -47,6 +47,4 @@ <h1 class="question__title u-fs-xxl" data-qa="feedback-title">{{ content.questio
4747
}}
4848
<br><br>
4949

50-
{% include 'partials/sign-out-pre-footer-panel.html' %}
51-
5250
{% endblock %}

templates/layouts/configs/_footer.html

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{% from "components/footer/_macro.njk" import onsFooter %}
22

3-
{{
4-
onsFooter({
3+
{% set config = {
54
"crest": true,
65
"newTabWarning": _("The following links open in a new tab"),
76
"assetsURL": assetsURL,
@@ -52,5 +51,10 @@
5251
"url": footer_urls.terms_and_conditions,
5352
"target": "_blank"
5453
}
55-
})
56-
}}
54+
} %}
55+
56+
{% if content and content.show_sign_out_warning %}
57+
{% set config = config | setAttribute("footerWarning", _("Make sure you <a href={sign_out_url}>leave this page</a> or close your browser if using a shared device").format(sign_out_url = content.sign_out_url)) %}
58+
{% endif %}
59+
60+
{{ onsFooter(config) }}

templates/layouts/configs/_save-sign-out-button.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{% if current_user.is_authenticated and not hide_signout_button %}
1+
{% if current_user.is_authenticated and not hide_sign_out_button %}
22

33
{% if save_on_signout %}
44
{% if account_service_log_out_url %}

templates/partials/sign-out-pre-footer-panel.html

-9
This file was deleted.

templates/thank-you.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
{% from 'components/panel/_macro.njk' import onsPanel %}
33

44
{% set page_title = _("We’ve received your answers") %}
5-
{% set hide_signout_button = content.hide_signout_button %}
5+
{% set hide_sign_out_button = content.hide_sign_out_button %}
66

77
{% block main %}
88

tests/integration/questionnaire/test_questionnaire_schema_theme_thank_you.py

+3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ def test_census_individual(self):
1313
self.assertInBody(
1414
"Your individual census has been submitted for <strong>68 Abingdon Road, Goathill</strong>"
1515
)
16+
self.assertInBody(
17+
'Make sure you <a href="/sign-out">leave this page</a> or close your browser if using a shared device'
18+
)
1619

1720
def test_census_household(self):
1821
self.launchSurvey(

tests/integration/routes/test_confirmation_email.py

+13
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,19 @@ def test_thank_you_page_confirmation_email(self):
111111
self.assertInUrl("confirmation-email/sent")
112112
self.assertInBody("A confirmation email has been sent")
113113

114+
def test_thank_you_page_confirmation_email_show_warning(self):
115+
# Given I launch and complete the test_confirmation_email questionnaire
116+
self._launch_and_complete_questionnaire()
117+
118+
# When I enter a valid email and submit
119+
self.post({"email": "email@example.com"})
120+
121+
# Then I get a sign out warning
122+
self.assertInUrl("confirmation-email/sent")
123+
self.assertInBody(
124+
'Make sure you <a href="/sign-out">leave this page</a> or close your browser if using a shared device'
125+
)
126+
114127
def test_thank_you_missing_email(self):
115128
# Given I launch and complete the test_confirmation_email questionnaire
116129
self._launch_and_complete_questionnaire()

tests/integration/routes/test_feedback.py

+16
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,22 @@ def test_valid_feedback(self):
6767
self.assertInUrl(self.SENT_FEEDBACK_URL)
6868
self.assertInBody("Thank you for your feedback")
6969

70+
def _test_feedback_show_warning(self):
71+
# Given I launch and complete the test_feedback questionnaire
72+
self._launch_and_complete_questionnaire()
73+
self.get(self.SEND_FEEDBACK_URL)
74+
75+
# When I enter a valid feedback and submit
76+
self.post(
77+
{"feedback-type": "Page design and structure", "feedback-text": "Feedback"}
78+
)
79+
80+
# Then I get a sign out warning
81+
self.assertInUrl(self.SENT_FEEDBACK_URL)
82+
self.assertInBody(
83+
'Make sure you <a href="/sign-out">leave this page</a> or close your browser if using a shared device'
84+
)
85+
7086
def test_feedback_error_message_on_get_when_limit_reached(self):
7187
# Given I launch and complete the test_feedback questionnaire, and provide
7288
# feedback the maximum number of times

0 commit comments

Comments
 (0)