Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDCSRM 782 rh components update #63

Merged
merged 5 commits into from
Feb 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion load_templates.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

cd "${DIR}"/

DESIGN_SYSTEM_VERSION="70.0.2"
DESIGN_SYSTEM_VERSION="72.3.0"

TEMP_DIR=$(mktemp -d)

Expand Down
2 changes: 2 additions & 0 deletions rh_ui/app_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from flask import Flask, g, request
from flask_babel import Babel
from flask_talisman import Talisman
from jinja2 import ChainableUndefined
from structlog import wrap_logger

from rh_ui.logger_config import logger_initial_config
Expand All @@ -28,6 +29,7 @@ def get_locale() -> str:
app.secret_key = app.config.get('SECRET_KEY') # required to enable the flash function
app.session_cookie_name = 'RH2_SESSION' # Use a custom session cookie name to avoid ambiguity and clashes
app.session_cookie_secure = app.config.get('SESSION_COOKIE_SECURE')
app.jinja_env.undefined = ChainableUndefined # This is needed to prevent jinja from throwing an error when chained parameters are undefined # noqa: E501

# Configure logger
logger_initial_config(log_level=app.config.get("LOGGING_LEVEL", "INFO"))
Expand Down
9 changes: 5 additions & 4 deletions rh_ui/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
'lang': g.lang_code,
'statementTitle': _('Cookies'),
'serviceName': '',
'settingsLinkTextURL': cookiesPageURL,
'settingsLinkUrl': cookiesPageURL,
'statementText': _("To collect information about how you use this website, we use%(open_cookies_link)s cookies.%(close_link)s</br>
This information helps us improve our services and make sure that the website works as well as possible.",
open_cookies_link='<a href="%s">' % cookiesPageURL, close_link='</a>'),
Expand All @@ -44,13 +44,13 @@
[
{
"url": '/en/' + '/'.join(request.path.split('/')[2:]),
"ISOCode": "en",
"isoCode": "en",
"text": "English",
"current": g.lang_code == 'en'
},
{
"url": '/cy/' + '/'.join(request.path.split('/')[2:]),
"ISOCode": "cy",
"isoCode": "cy",
"text": "Cymraeg",
"current": g.lang_code == 'cy'
}
Expand Down Expand Up @@ -97,7 +97,8 @@
}
],
'copyrightDeclaration': {
'copyright': _('Crown copyright and database rights 2020 OS 100019153.')
'copyright': _('Crown copyright and database rights 2020 OS 100019153.'),
'text': ""
}
}-%}

Expand Down
10 changes: 5 additions & 5 deletions rh_ui/templates/info_pages/cookies.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ <h2>{{ _('Your cookie settings have been saved') }}</h2>
banner.') }}</p>
<a class="ons-js-return-link ons-u-mt-s ons-u-dib" href="#0">{{ _('Return to previous page') }}</a>
{% endcall %}
<h1 class="ons-u-fs-xxl">{{ _('Cookies on start.surveys.ons.gov.uk') }}</h1>
<h1 class="ons-u-fs-2xl">{{ _('Cookies on start.surveys.ons.gov.uk') }}</h1>
<p>{{ _('Cookies are small files saved on your device when you visit a website.') }}</p>
<p>{{ _('We use cookies to store information about how you use this service, such as the pages you visit.') }}</p>
<h2>{{ _('Cookie settings') }}</h2>
Expand Down Expand Up @@ -70,7 +70,7 @@ <h3>{{ _("Cookies that measure website use") }}</h3>
"id": "cookies-measure-website-use-details",
"classes": "ons-u-mb-s",
"title": _("Learn more about these Google Analytics cookies"),
"titleTag": 'h4',
"headingLevel": '4',
"button": {
"close": _("Hide this")
}
Expand Down Expand Up @@ -177,7 +177,7 @@ <h3>{{ _('Cookies that help with our communications') }}</h3>
}
]
}) }}
<h3 class="ons-u-mt-l">{{ _('Cookies that remember your settings') }}</h3>
<h3 class="ons-u-mt-xl">{{ _('Cookies that remember your settings') }}</h3>
<p>{{ _('These cookies personalise your experience of using the site,
by doing things like remembering your preferences and the choices you make.') }}</p>
{{ onsRadios({
Expand All @@ -202,7 +202,7 @@ <h3 class="ons-u-mt-l">{{ _('Cookies that remember your settings') }}</h3>
}
]
}) }}
<h3 class="ons-u-mt-l">{{ _('Strictly necessary cookies') }}</h3>
<h3 class="ons-u-mt-xl">{{ _('Strictly necessary cookies') }}</h3>
<p>{{ _('These essential cookies do things like:') }}</p>
{{ onsList({
"itemsList": [
Expand Down Expand Up @@ -374,7 +374,7 @@ <h4>{{ _('Cookie message') }}</h4>

{{ onsDetails({
"id": "essential-cookies-details",
"classes": "ons-u-mb-l",
"classes": "ons-u-mb-2xl",
"title": _("Learn more about these essential cookies"),
"content": essential_cookies_content
}) }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ <h2>{{ _('Access to information') }}</h2>

{%- autoescape false -%}

<h2 class="ons-u-fs-xl ons-u-mt-l">{{ _('Further information') }}</h2>
<h2 class="ons-u-fs-xl ons-u-mt-xl">{{ _('Further information') }}</h2>
<p>{{ _('If you have a question about how we process your data or want to find out more about your rights
under data protection legislation, see our <a href="https://www.ons.gov.uk/aboutus/transparencyandgovernance/dataprotection" target="_blank">protection page</a>.') }}
</p>
Expand Down
8 changes: 4 additions & 4 deletions rh_ui/templates/start.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
{% block main %}
{% include 'partials/uac_error_message_list.html' with context %}

<h1 class="ons-u-fs-xxl ons-u-mt-l">{{ _('Start study') }}</h1>
<h1 class="ons-u-fs-2xl ons-u-mt-3xl">{{ _('Start study') }}</h1>

<form method="POST" action={{ url_for('i18n.start_bp.start_post')}}>
{{ onsAccessCode({
Expand All @@ -72,14 +72,14 @@ <h1 class="ons-u-fs-xxl ons-u-mt-l">{{ _('Start study') }}</h1>
{{ onsButton({
'id': 'submit_uac_btn',
'text': _('Access study'),
'classes': 'ons-u-mb-xl',
'classes': 'ons-u-mb-3xl',
'name': 'action[save_continue]',
"variants": 'loader'
}) }}
</form>


<h2 class="ons-u-fs-xl ons-u-mt-l" id="find_access_code">{{ _('Where to find your access code') }}</h2>
<h2 class="ons-u-fs-xl ons-u-mt-xl" id="find_access_code">{{ _('Where to find your access code') }}</h2>
<p>{{ _('Your access code can be found in the invitation letter or email you received.
Your 16-character access code will be a combination of letters and numbers.') }}</p>

Expand All @@ -90,7 +90,7 @@ <h2 class="ons-u-fs-xl ons-u-mt-l" id="find_access_code">{{ _('Where to find you
{%- endset -%}

{{ onsDetails({
"titleTag": "h3",
"headingLevel": "3",
"id": "details",
"title": _('Who can I contact for further information?'),
"content": further_info_content
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/views/test_info_pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ def test_cookies_endpoint_success(test_client):
response = test_client.get('/en/cookies', follow_redirects=True)

assert response.status_code == 200
assert '<h1 class="ons-u-fs-xxl">Cookies on start.surveys.ons.gov.uk</h1>' in response.text
assert 'Cookies on start.surveys.ons.gov.uk' in response.text


def test_cy_cookies_endpoint_success(test_client):
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/views/test_start.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def test_en_start_endpoint_success(test_client):
response = test_client.get(EN_START_ROUTE, follow_redirects=True)

assert response.status_code == 200
assert '<div class="ons-header__title">ONS Surveys</div>' in response.text
assert 'ONS Surveys' in response.text
assert 'Enter your 16-character access code' in response.text


Expand Down
20 changes: 11 additions & 9 deletions whitelist.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,28 @@
EQ_URL # unused variable (config.py:28)
SECRET_KEY # unused variable (config.py:32)
SESSION_COOKIE_SECURE # unused variable (config.py:33)
ACCOUNT_SERVICE_URL # unused variable (config.py:35)
RH_SVC_URL # unused variable (config.py:36)
DEBUG # unused variable (config.py:40)
RH_SVC_URL # unused variable (config.py:41)
GOOGLE_TAG_ID # unused variable (config.py:34)
ACCOUNT_SERVICE_URL # unused variable (config.py:36)
RH_SVC_URL # unused variable (config.py:37)
DEBUG # unused variable (config.py:41)
RH_SVC_URL # unused variable (config.py:42)
wsgi_app # unused variable (gunicorn.conf.py:9)
bind # unused variable (gunicorn.conf.py:12)
worker_class # unused variable (gunicorn.conf.py:14)
threads # unused variable (gunicorn.conf.py:16)
access_log_format # unused variable (gunicorn.conf.py:20)
accesslog # unused variable (gunicorn.conf.py:24)
logconfig # unused variable (gunicorn.conf.py:27)
_.secret_key # unused attribute (rh_ui/app_setup.py:28)
_.session_cookie_name # unused attribute (rh_ui/app_setup.py:29)
_.session_cookie_secure # unused attribute (rh_ui/app_setup.py:30)
TestingConfig # unused class (config.py:39)
_.secret_key # unused attribute (rh_ui/app_setup.py:29)
_.session_cookie_name # unused attribute (rh_ui/app_setup.py:30)
_.session_cookie_secure # unused attribute (rh_ui/app_setup.py:31)
_.undefined # unused attribute (rh_ui/app_setup.py:32)
TestingConfig # unused class (config.py:40)
add_language_code # unused function (rh_ui/views/i18n.py:19)
pull_lang_code # unused function (rh_ui/views/i18n.py:24)
cookies # unused function (rh_ui/views/info_pages.py:11)
privacy_and_data_protection # unused function (rh_ui/views/info_pages.py:16)
start_get # unused function (rh_ui/views/start.py:22)
add_security_headers # unused function (rh_ui/security.py:61)
add_security_headers # unused function (rh_ui/security.py:68)
info_healthcheck # unused function (rh_ui/views/healthcheck.py:6)
start_post # unused function (rh_ui/views/start.py:27)