From 6e790ec0ab820ec7e1ac7cc4552270a0fe919367 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 27 Jul 2023 14:14:18 +0100 Subject: [PATCH] Updates for GOV.UK Frontend v4.7.0 and GOV.UK Frontend Jinja 2.7.0 (#25) * Updates * Update GOVUK_FRONTEND_VERSION to v4.7.0 There's no govuk_frontend_jinja version yet * Update govuk frontend jinja to support the FE changes * Update version --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Cameron Lamb <cameron.lamb@digital.trade.gov.uk> --- README.md | 1 + .../components/exit_this_page.py | 34 +++++++++++++++++++ makefile | 4 +-- poetry.lock | 10 +++--- pyproject.toml | 4 +-- 5 files changed, 44 insertions(+), 9 deletions(-) create mode 100644 govuk_frontend_django/components/exit_this_page.py diff --git a/README.md b/README.md index aa7fc2d..8763e7b 100644 --- a/README.md +++ b/README.md @@ -41,3 +41,4 @@ Below is a list of the versions of this package and the versions of the GOV.UK F | --------------- | ----------------------- | | [0.2.0](https://github.com/uktrade/govuk-frontend-django/releases/tag/0.2.0) - [0.2.3](https://github.com/uktrade/govuk-frontend-django/releases/tag/0.2.3) | [v4.5.0](https://github.com/alphagov/govuk-frontend/releases/tag/v4.5.0) | | [0.3.0](https://github.com/uktrade/govuk-frontend-django/releases/tag/0.3.0) - [0.3.9](https://github.com/uktrade/govuk-frontend-django/releases/tag/0.3.9) | [v4.6.0](https://github.com/alphagov/govuk-frontend/releases/tag/v4.6.0) | +| [0.4.0](https://github.com/uktrade/govuk-frontend-django/releases/tag/0.4.0) - [0.4.0](https://github.com/uktrade/govuk-frontend-django/releases/tag/0.4.0) | [v4.7.0](https://github.com/alphagov/govuk-frontend/releases/tag/v4.7.0) | diff --git a/govuk_frontend_django/components/exit_this_page.py b/govuk_frontend_django/components/exit_this_page.py new file mode 100644 index 0000000..134038e --- /dev/null +++ b/govuk_frontend_django/components/exit_this_page.py @@ -0,0 +1,34 @@ +from dataclasses import dataclass +from typing import Optional + +from govuk_frontend_django.components import base as govuk_frontend_base +from govuk_frontend_django.components import ( + error_message as govuk_frontend_error_message, +) +from govuk_frontend_django.components import fieldset as govuk_frontend_fieldset +from govuk_frontend_django.components import hint as govuk_frontend_hint +from govuk_frontend_django.components import label as govuk_frontend_label +from govuk_frontend_django.components import tag as govuk_frontend_tag + + +@dataclass(kw_only=True) +class GovUKExitThisPage(govuk_frontend_base.GovUKComponent): + """GOV.UK Exit This Page + + See: https://design-system.service.gov.uk/components/exit-this-page/ + """ + + text: Optional[str] = None + html: Optional[str] = None + redirectUrl: Optional[str] = None + id: Optional[str] = None + activatedText: Optional[str] = None + timedOutText: Optional[str] = None + pressTwoMoreTimesText: Optional[str] = None + pressOneMoreTimeText: Optional[str] = None + + _jinja2_template = "govuk_frontend_jinja/components/exit-this-page/macro.html" + _macro_name = "govukExitThisPage" + + +COMPONENT = GovUKExitThisPage diff --git a/makefile b/makefile index 7c1b921..8be91e6 100644 --- a/makefile +++ b/makefile @@ -5,8 +5,8 @@ serve-docs: get-latest-release-tag: @gh release list -R $(REPO) | grep "Latest" | awk -F '\t' '{for(i=2; i<=NF; i++) {if($$i~/v?[0-9]+\.[0-9]+\.[0-9]+/) {print $$i; exit}}}' -GOVUK_FRONTEND_VERSION = "v4.6.0" -GOVUK_FRONTEND_JINJA_VERSION = "2.6.0" +GOVUK_FRONTEND_VERSION = "v4.7.0" +GOVUK_FRONTEND_JINJA_VERSION = "2.7.0" generate-components: poetry run python scripts/generate_components.py $(GOVUK_FRONTEND_VERSION) diff --git a/poetry.lock b/poetry.lock index b2f8d7b..4f2aedb 100644 --- a/poetry.lock +++ b/poetry.lock @@ -522,13 +522,13 @@ dev = ["flake8", "markdown", "twine", "wheel"] [[package]] name = "govuk-frontend-jinja" -version = "2.6.0" +version = "2.7.0" description = "GOV.UK Frontend Jinja Macros" optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "govuk-frontend-jinja-2.6.0.tar.gz", hash = "sha256:f8a4ae52897352b12c047acccbd9d5830123175f71edb22c93b70893803243c2"}, - {file = "govuk_frontend_jinja-2.6.0-py3-none-any.whl", hash = "sha256:68d7bc33188e7b62548feb8ff4c0def377eb2bfd698a7dfd90fcc4846e0119eb"}, + {file = "govuk-frontend-jinja-2.7.0.tar.gz", hash = "sha256:de797f6a1247da50c70677a9b50197e3198e0001dbabe9e17703f33e72818646"}, + {file = "govuk_frontend_jinja-2.7.0-py3-none-any.whl", hash = "sha256:94ee83e6c766922204c2b26005779cd4a44c2e9d6f1c7d9a0c2868a41785be39"}, ] [package.dependencies] @@ -1580,4 +1580,4 @@ testing = ["big-O", "flake8 (<5)", "jaraco.functools", "jaraco.itertools", "more [metadata] lock-version = "2.0" python-versions = "^3.8" -content-hash = "901b8123e076404def280cef3ce1ed0ce46cddd58a7aa58f100da3cba9f7bb3f" +content-hash = "dabd505c07e0c12995e47be57d3eb0152f0d7e08c2f75d642398ef45d428a86f" diff --git a/pyproject.toml b/pyproject.toml index ee3c1db..d153c32 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api" [tool.poetry] name = "govuk-frontend-django" -version = "0.3.9" +version = "0.4.0" description = "Django functionality to help when building a GOV.UK website." authors = [ "DBT Live Service Team <live.services@digital.trade.gov.uk>", @@ -25,7 +25,7 @@ packages = [ python = "^3.8" Django = "^4.1.9" jinja2 = "^3.1.2" -govuk-frontend-jinja = "2.6.0" +govuk-frontend-jinja = "2.7.0" [tool.poetry.group.dev.dependencies] black = "^23.3.0"