diff --git a/README.md b/README.md index 6558f19..cee0859 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ The following table shows the version of Digital Marketplace Frontend Jinja that | Digital Marketplace Frontend Jinja Version | Target CCS Digital Marketplace GOV.UK Frontend Version | | ----------------------------- | ------------------------------ | +| [1.3.3](https://github.com/tim-s-ccs/ccs-digitalmarketplace-frontend-jinja/releases/tag/1.3.3) | [5.4.3](https://github.com/Crown-Commercial-Service/ccs-digitalmarketplace-govuk-frontend/releases/tag/5.4.3) | | [1.3.2](https://github.com/tim-s-ccs/ccs-digitalmarketplace-frontend-jinja/releases/tag/1.3.2) | [5.4.2](https://github.com/Crown-Commercial-Service/ccs-digitalmarketplace-govuk-frontend/releases/tag/5.4.2) | | [1.3.1](https://github.com/tim-s-ccs/ccs-digitalmarketplace-frontend-jinja/releases/tag/1.3.1) | [5.4.1](https://github.com/Crown-Commercial-Service/ccs-digitalmarketplace-govuk-frontend/releases/tag/5.4.1) | | [1.3.0](https://github.com/tim-s-ccs/ccs-digitalmarketplace-frontend-jinja/releases/tag/1.3.0) | [5.4.0](https://github.com/Crown-Commercial-Service/ccs-digitalmarketplace-govuk-frontend/releases/tag/5.4.0) | diff --git a/digitalmarketplace_frontend_jinja/__init__.py b/digitalmarketplace_frontend_jinja/__init__.py index e398332..07f744c 100644 --- a/digitalmarketplace_frontend_jinja/__init__.py +++ b/digitalmarketplace_frontend_jinja/__init__.py @@ -1 +1 @@ -__version__ = '1.3.2' +__version__ = '1.3.3' diff --git a/digitalmarketplace_frontend_jinja/templates/components/checkboxes-from-form/macro.html b/digitalmarketplace_frontend_jinja/templates/components/checkboxes-from-form/macro.html index 33a60a0..7d83a0f 100644 --- a/digitalmarketplace_frontend_jinja/templates/components/checkboxes-from-form/macro.html +++ b/digitalmarketplace_frontend_jinja/templates/components/checkboxes-from-form/macro.html @@ -6,17 +6,24 @@ {% set values = params.form.data or []%} {% if 'items' not in params %} - {% for item in params.form.options %} - {% set _ = item.__setitem__("text", item["label"]) %} + {% for option in params.form.options %} + {% set item = { + "value": option["value"], + "text": option["label"] + } %} - {% if item["value"] in values %} + {% if option["value"] in values %} {% set _ = item.__setitem__("checked", true) %} {% endif %} - {% if "description" in item %} - {% set _ = item.__setitem__("hint", { 'text': item["description"] }) %} + {% if "description" in option %} + {% set _ = item.__setitem__("hint", { 'text': option["description"] }) %} {% endif %} + {% for attribute in ["id", "divider", "conditional", "behaviour", "disabled", "attributes"] %} + {% set _ = item.__setitem__(attribute, option[attribute]) if attribute in option %} + {% endfor %} + {% set _ = items.append(item) %} {% endfor %} diff --git a/digitalmarketplace_frontend_jinja/templates/components/radios-from-form/macro.html b/digitalmarketplace_frontend_jinja/templates/components/radios-from-form/macro.html index 2bb8b39..91a5e46 100644 --- a/digitalmarketplace_frontend_jinja/templates/components/radios-from-form/macro.html +++ b/digitalmarketplace_frontend_jinja/templates/components/radios-from-form/macro.html @@ -6,17 +6,24 @@ {% if 'items' not in params %} - {% for item in params.form.options %} - {% set _ = item.__setitem__("text", item["label"]) %} + {% for option in params.form.options %} + {% set item = { + "value": option["value"], + "text": option["label"] + } %} - {% if params.form.data == item["value"] %} + {% if params.form.data == option["value"] %} {% set _ = item.__setitem__("checked", true) %} {% endif %} - {% if "description" in item %} - {% set _ = item.__setitem__("hint", { 'text': item["description"] }) %} + {% if "description" in option %} + {% set _ = item.__setitem__("hint", { 'text': option["description"] }) %} {% endif %} + {% for attribute in ["id", "divider", "conditional", "disabled", "attributes"] %} + {% set _ = item.__setitem__(attribute, option[attribute]) if attribute in option %} + {% endfor %} + {% set _ = items.append(item) %} {% endfor %} diff --git a/package-lock.json b/package-lock.json index 0feec50..ae1b9d6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "0.0.0", "license": "MIT", "devDependencies": { - "ccs-digitalmarketplace-govuk-frontend": "^5.4.2" + "ccs-digitalmarketplace-govuk-frontend": "^5.4.3" } }, "node_modules/accessible-autocomplete": { @@ -23,9 +23,9 @@ } }, "node_modules/ccs-digitalmarketplace-govuk-frontend": { - "version": "5.4.2", - "resolved": "https://registry.npmjs.org/ccs-digitalmarketplace-govuk-frontend/-/ccs-digitalmarketplace-govuk-frontend-5.4.2.tgz", - "integrity": "sha512-Eu055KWA1dBkq/PzN3paBe5o8fmeyQ0G/k4R9qDlLqVhQR/lFAzd9XViUEGISDB/+P+vlLReCNL0HnwqM+AlIg==", + "version": "5.4.3", + "resolved": "https://registry.npmjs.org/ccs-digitalmarketplace-govuk-frontend/-/ccs-digitalmarketplace-govuk-frontend-5.4.3.tgz", + "integrity": "sha512-OEl5EJ9WDVtMQrtBP506itFSWRHWsCf+HqWTzjvR0MvMZw8HOFcDFYcAAWwcMfNCiaDSWgFEpdFDQYG0hmyZwg==", "dev": true, "engines": { "node": ">= 20.9.0" diff --git a/package.json b/package.json index e365d12..74fde5c 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,6 @@ "author": "CCS", "license": "MIT", "devDependencies": { - "ccs-digitalmarketplace-govuk-frontend": "^5.4.2" + "ccs-digitalmarketplace-govuk-frontend": "^5.4.3" } }