diff --git a/.nvmrc b/.nvmrc index 9de2256..deed13c 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -lts/iron +lts/jod diff --git a/digitalmarketplace_frontend_jinja/templates/components/question-list-multiquestion/macro.html b/digitalmarketplace_frontend_jinja/templates/components/question-list-multiquestion/macro.html new file mode 100644 index 0000000..5cd48f0 --- /dev/null +++ b/digitalmarketplace_frontend_jinja/templates/components/question-list-multiquestion/macro.html @@ -0,0 +1,79 @@ +{% macro digitalmarketplaceQuestionListMultiquestion(params) %} +{%- from "govuk_frontend_jinja/components/fieldset/macro.html" import govukFieldset -%} +{%- from "govuk_frontend_jinja/components/button/macro.html" import govukButton -%} +{%- from "digitalmarketplace_frontend_jinja/components/question/macro.html" import digitalmarketplaceQuestion -%} + +{% if params.question.questions -%} + {% call govukFieldset({ + "legend": { + "text": params.question.question, + "classes": 'govuk-fieldset__legend--m' + }, + "attributes": { + 'data-module': "dm-question-list-multiquestion", + 'data-max-number-of-items': params.max_number_of_items + } + }) %} + {% if params.question.question_advice %} +
+ {{ params.question.question_advice | safe }} +
+ {% endif %} + +
+ {% for multi_question in params.question.questions %} + {% if multi_question.questions -%} +
+ {% call govukFieldset({ + "legend": { + "text": multi_question.question, + "classes": 'govuk-fieldset__legend--m' + } + }) %} + {% if multi_question.question_advice %} +
+ {{ multi_question.question_advice | safe }} +
+ {% endif %} + +
+ {% for question in multi_question.questions %} +
+ {{ digitalmarketplaceQuestion({ + "type": question.type, + "question": question, + "data": params.data, + "errors": params.errors, + "frameworkReusedFrom": params.frameworkReusedFrom + }) }} +
+ {% endfor %} +
+ {% endcall %} +
+ {%- endif %} + {% endfor %} +
+ +
+
+ {{ govukButton({ + "html": 'Remove item 0', + "classes": 'govuk-button--secondary dm-list-multiquestion__item-remove govuk-visually-hidden', + "type": 'button' + })}} +
+
+ +
+
+ {{ govukButton({ + "html": 'Add item (0 remaining)', + "classes": 'govuk-button--secondary dm-list-multiquestion__item-add govuk-visually-hidden', + "type": 'button' + })}} +
+
+ {% endcall %} +{%- endif %} +{% endmacro %} diff --git a/digitalmarketplace_frontend_jinja/templates/components/question/macro.html b/digitalmarketplace_frontend_jinja/templates/components/question/macro.html index d69443f..ec6728b 100644 --- a/digitalmarketplace_frontend_jinja/templates/components/question/macro.html +++ b/digitalmarketplace_frontend_jinja/templates/components/question/macro.html @@ -12,6 +12,7 @@ {%- from "digitalmarketplace_frontend_jinja/components/question-list/macro.html" import digitalmarketplaceQuestionList -%} {%- from "digitalmarketplace_frontend_jinja/components/question-select/macro.html" import digitalmarketplaceQuestionSelect -%} {%- from "digitalmarketplace_frontend_jinja/components/question-multiquestion/macro.html" import digitalmarketplaceQuestionMultiquestion -%} +{%- from "digitalmarketplace_frontend_jinja/components/question-list-multiquestion/macro.html" import digitalmarketplaceQuestionListMultiquestion -%}