From 4c4b0b19873dbc4f31fdef3cb1cbe61a27b6f562 Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Fri, 9 Aug 2024 14:03:35 +0100 Subject: [PATCH 1/5] Bump to GOV.UK Frontend v5.4.0 --- build.py | 2 +- common/templates/common/base.html | 4 ++-- find/templates/find/base.html | 4 ++-- find/templates/find/main/help.html | 2 +- find/templates/find/main/login.html | 4 ++-- requirements-dev.txt | 6 +++--- requirements.in | 6 +++--- requirements.txt | 8 +++----- submit/templates/submit/base.html | 4 ++-- tests/common_tests/test_maintenance_mode.py | 2 +- 10 files changed, 20 insertions(+), 22 deletions(-) diff --git a/build.py b/build.py index feceee86d..184a08eba 100755 --- a/build.py +++ b/build.py @@ -8,7 +8,7 @@ def build_govuk_assets(static_dist_root="static/src"): - GOVUK_FRONTEND_VERSION = "4.7.0" + GOVUK_FRONTEND_VERSION = "5.4.0" DIST_ROOT = "./" + static_dist_root GOVUK_DIR = "/govuk-frontend" GOVUK_URL = ( diff --git a/common/templates/common/base.html b/common/templates/common/base.html index fa6914926..69026efec 100644 --- a/common/templates/common/base.html +++ b/common/templates/common/base.html @@ -12,7 +12,7 @@ - + {% assets "css" %}{% endassets %} {% endblock head %} @@ -75,7 +75,7 @@

Support links

{% block bodyEnd %} - + {% assets "js" %}{% endassets %} diff --git a/find/templates/find/base.html b/find/templates/find/base.html index 584b648be..feacbee7c 100644 --- a/find/templates/find/base.html +++ b/find/templates/find/base.html @@ -14,7 +14,7 @@ - + {% assets "css" %}{% endassets %} {% endblock head %} @@ -110,7 +110,7 @@

Support links

{% block bodyEnd %} - + {% assets "js" %}{% endassets %} diff --git a/find/templates/find/main/help.html b/find/templates/find/main/help.html index a755677f2..0525cc2c5 100644 --- a/find/templates/find/main/help.html +++ b/find/templates/find/main/help.html @@ -7,7 +7,7 @@ - + {% assets "css" %}{% endassets %} {% endblock head %} diff --git a/find/templates/find/main/login.html b/find/templates/find/main/login.html index d6bba915d..1b16e6945 100644 --- a/find/templates/find/main/login.html +++ b/find/templates/find/main/login.html @@ -8,7 +8,7 @@ - + {% assets "css" %}{% endassets %} {% endblock head %} @@ -46,7 +46,7 @@

Get help

{{ govukFooter({}) }} {% block bodyEnd %} - + {% assets "js" %}{% endassets %} {% endblock bodyEnd %} diff --git a/requirements-dev.txt b/requirements-dev.txt index e86ebd268..b82b43871 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -160,11 +160,11 @@ flask-wtf==1.1.1 # govuk-frontend-wtf funding-service-design-utils==5.0.1 # via -r requirements.txt -govuk-frontend-jinja==2.7.0 +govuk-frontend-jinja==3.1.0 # via # -r requirements.txt # govuk-frontend-wtf -govuk-frontend-wtf==2.5.0 +govuk-frontend-wtf==3.1.0 # via -r requirements.txt greenlet==3.0.3 # via playwright @@ -518,7 +518,7 @@ wrapt==1.16.0 # via # -r requirements.txt # pandera -wtforms==3.0.1 +wtforms==3.1.2 # via # -r requirements.txt # flask-wtf diff --git a/requirements.in b/requirements.in index fc33ade3f..d3e3b1018 100644 --- a/requirements.in +++ b/requirements.in @@ -52,9 +52,9 @@ sentry-sdk #----------------------------------- # GOV.UK Frontend #----------------------------------- -govuk-frontend-wtf==2.5.0 -govuk-frontend-jinja==2.7.0 # Specific for GOV.UK Frontend v4.7.0 -wtforms==3.0.1 # Pin this specific version until we bump to GOV.UK Frontend v5.x, then we must go to >=3.1.0 +govuk-frontend-wtf==3.1.0 +govuk-frontend-jinja==3.1.0 # Specific for GOV.UK Frontend v5.4.0 +wtforms==3.* #----------------------------------- # frontend assets diff --git a/requirements.txt b/requirements.txt index 1dd4d6ea2..930fd49fe 100644 --- a/requirements.txt +++ b/requirements.txt @@ -96,14 +96,12 @@ flask-wtf==1.1.1 # govuk-frontend-wtf funding-service-design-utils==5.0.1 # via -r requirements.in -govuk-frontend-jinja==2.7.0 +govuk-frontend-jinja==3.1.0 # via # -r requirements.in # govuk-frontend-wtf -govuk-frontend-wtf==2.5.0 +govuk-frontend-wtf==3.1.0 # via -r requirements.in -greenlet==3.0.3 - # via sqlalchemy gunicorn==22.0.0 # via funding-service-design-utils idna==3.7 @@ -257,7 +255,7 @@ werkzeug==2.3.8 # via flask wrapt==1.16.0 # via pandera -wtforms==3.0.1 +wtforms==3.1.2 # via # -r requirements.in # flask-wtf diff --git a/submit/templates/submit/base.html b/submit/templates/submit/base.html index d37ae3266..36ac232ff 100644 --- a/submit/templates/submit/base.html +++ b/submit/templates/submit/base.html @@ -14,7 +14,7 @@ content="GOV.UK, govuk, gov, government, uk, frontend, ui, user interface, jinja, python, flask, port, template, templating, macro, component, design system, html, forms, wtf, wtforms, widget, widgets, demo, example"> + href="{{ url_for('.static', filename='govuk-frontend/govuk-frontend-5.4.0.min.css') }}" /> {% assets "css" %} {% endassets %} @@ -83,7 +83,7 @@ {% block bodyEnd %} - + {% assets "js" %} diff --git a/tests/common_tests/test_maintenance_mode.py b/tests/common_tests/test_maintenance_mode.py index 589172b4e..4585a81f8 100644 --- a/tests/common_tests/test_maintenance_mode.py +++ b/tests/common_tests/test_maintenance_mode.py @@ -44,5 +44,5 @@ def test_maintenance_mode_healthcheck_available(test_client): ) def test_maintenance_mode_static_assets_available(test_client): test_client.application.config["MAINTENANCE_MODE"] = True - response = test_client.get("/static/govuk-frontend/govuk-frontend-4.7.0.min.css") + response = test_client.get("/static/govuk-frontend/govuk-frontend-5.4.0.min.css") assert response.status_code == 200 From 619b8481599d87d04f38e327510e7dd82f898e34 Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Fri, 9 Aug 2024 14:03:43 +0100 Subject: [PATCH 2/5] Remove redundant block --- find/templates/find/main/download.html | 4 ---- 1 file changed, 4 deletions(-) diff --git a/find/templates/find/main/download.html b/find/templates/find/main/download.html index de0f1c12e..9703c8684 100644 --- a/find/templates/find/main/download.html +++ b/find/templates/find/main/download.html @@ -10,10 +10,6 @@ {%- from "find/main/checkboxes.html" import checkboxItems -%} {%- from "find/main/select.html" import selectItems -%} -{% block beforeContent %} - {{ super() }} -{% endblock beforeContent %} - {% block content %}
From 9c8ad357a368a9cc00d84e72c75d39319f796595 Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Fri, 9 Aug 2024 14:34:51 +0100 Subject: [PATCH 3/5] Fix initialisation of GOV.UK Frontend 5.4.0 --- app.py | 3 +++ common/templates/common/base.html | 10 ++++++---- find/templates/find/base.html | 10 ++++++---- find/templates/find/main/login.html | 8 ++++++-- submit/templates/submit/base.html | 10 ++++++---- 5 files changed, 27 insertions(+), 14 deletions(-) diff --git a/app.py b/app.py index 6e4cd5f60..ecf35c9f0 100644 --- a/app.py +++ b/app.py @@ -130,6 +130,9 @@ def pop_host_from_current_request(endpoint, values): "'self'", "'sha256-+6WnXIl4mbFTCARd8N3COQmT3bJJmo32N8q8ZSQAIcU='", "'sha256-l1eTVSK8DTnK8+yloud7wZUqFrI0atVo6VlC6PJvYaQ='", + "'sha256-GUQ5ad8JK5KmEWmROf3LZd9ge94daqNvd8xy9YS1iDw='", + "'sha256-ndKdvEBfUn27+cpVrq2H697Dg88x3tsepe3veTUtsaA='", + "'sha256-oR+vHsLl1DMudaF9Ay6TIDK2lXwFka0z5sbdN5RZQxE='", ], } talisman.init_app(flask_app, content_security_policy=csp, force_https=False) diff --git a/common/templates/common/base.html b/common/templates/common/base.html index 69026efec..4ebdb2251 100644 --- a/common/templates/common/base.html +++ b/common/templates/common/base.html @@ -74,9 +74,11 @@

Support links

{% endblock footer %} {% block bodyEnd %} - - - - + {% set govukFrontendJsURI %}{{ url_for('static', filename='govuk-frontend/govuk-frontend-5.4.0.min.js') }}{% endset %} + + {% assets "js" %}{% endassets %} {% endblock bodyEnd %} diff --git a/find/templates/find/base.html b/find/templates/find/base.html index feacbee7c..7c5b8f114 100644 --- a/find/templates/find/base.html +++ b/find/templates/find/base.html @@ -109,9 +109,11 @@

Support links

{% endblock footer %} {% block bodyEnd %} - - - - + {% set govukFrontendJsURI %}{{ url_for('static', filename='govuk-frontend/govuk-frontend-5.4.0.min.js') }}{% endset %} + + {% assets "js" %}{% endassets %} {% endblock bodyEnd %} diff --git a/find/templates/find/main/login.html b/find/templates/find/main/login.html index 1b16e6945..598daa6a9 100644 --- a/find/templates/find/main/login.html +++ b/find/templates/find/main/login.html @@ -46,7 +46,11 @@

Get help

{{ govukFooter({}) }} {% block bodyEnd %} - - + {% set govukFrontendJsURI %}{{ url_for('static', filename='govuk-frontend/govuk-frontend-5.4.0.min.js') }}{% endset %} + + {% assets "js" %}{% endassets %} {% endblock bodyEnd %} diff --git a/submit/templates/submit/base.html b/submit/templates/submit/base.html index 36ac232ff..97e5d87bb 100644 --- a/submit/templates/submit/base.html +++ b/submit/templates/submit/base.html @@ -82,10 +82,12 @@ {% endblock footer %} {% block bodyEnd %} - - - - + {% set govukFrontendJsURI %}{{ url_for('static', filename='govuk-frontend/govuk-frontend-5.4.0.min.js') }}{% endset %} + + {% assets "js" %} {% endassets %} {% endblock bodyEnd %} From ff6940db2b1d1a50fe3e189662b9f5e0f6423d2b Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Fri, 9 Aug 2024 14:57:15 +0100 Subject: [PATCH 4/5] Fix asset path for manifest.json --- find/templates/find/base.html | 2 +- submit/templates/submit/base.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/find/templates/find/base.html b/find/templates/find/base.html index 7c5b8f114..68f56c15b 100644 --- a/find/templates/find/base.html +++ b/find/templates/find/base.html @@ -6,7 +6,7 @@ {%- from 'govuk_frontend_jinja/components/phase-banner/macro.html' import govukPhaseBanner -%} {%- from 'govuk_frontend_jinja/components/header/macro.html' import govukHeader -%} -{% set assetPath = url_for('static', filename='').rstrip('/') %} +{% set assetPath = url_for('static', filename='govuk-frontend').rstrip('/') %} {% block pageTitle %}{{ config['FIND_SERVICE_NAME'] }} – GOV.UK{% endblock pageTitle %} diff --git a/submit/templates/submit/base.html b/submit/templates/submit/base.html index 97e5d87bb..2077a6f89 100644 --- a/submit/templates/submit/base.html +++ b/submit/templates/submit/base.html @@ -4,7 +4,7 @@ {%- from 'govuk_frontend_jinja/components/phase-banner/macro.html' import govukPhaseBanner -%} {%- from 'govuk_frontend_jinja/components/header/macro.html' import govukHeader -%} -{% set assetPath = url_for('static', filename='').rstrip('/') %} +{% set assetPath = url_for('static', filename='govuk-frontend').rstrip('/') %} {% block pageTitle %}{{ config['SUBMIT_SERVICE_NAME'] }} – GOV.UK{% endblock pageTitle %} From 25c6a7e66be5031f61690b57dae3f65f696ca748 Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Mon, 12 Aug 2024 09:27:46 +0100 Subject: [PATCH 5/5] Be more specific about wtforms version govuk-frontend-wtf requires 3.1+, so we need that as a minimum, but should be forwards compatible. --- requirements.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.in b/requirements.in index d3e3b1018..fc13c683b 100644 --- a/requirements.in +++ b/requirements.in @@ -54,7 +54,7 @@ sentry-sdk #----------------------------------- govuk-frontend-wtf==3.1.0 govuk-frontend-jinja==3.1.0 # Specific for GOV.UK Frontend v5.4.0 -wtforms==3.* +wtforms~=3.1 #----------------------------------- # frontend assets