Skip to content

Commit

Permalink
Merge pull request #116 from Crown-Commercial-Service/make-updates-fo…
Browse files Browse the repository at this point in the history
…r-dmp-frontend-v2

Update DMP Frontend to v2.0.0-beta.0 and update the node version
  • Loading branch information
tim-s-ccs authored Nov 6, 2024
2 parents f98016c + 2d208c7 commit 2ac922a
Show file tree
Hide file tree
Showing 18 changed files with 151 additions and 52 deletions.
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
lts/iron
lts/jod
Original file line number Diff line number Diff line change
@@ -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 %}
<div class="govuk-body">
{{ params.question.question_advice | safe }}
</div>
{% endif %}

<div class="dm-list-multiquestion__items">
{% for multi_question in params.question.questions %}
{% if multi_question.questions -%}
<div class="dm-list-multiquestion__item">
{% call govukFieldset({
"legend": {
"text": multi_question.question,
"classes": 'govuk-fieldset__legend--m'
}
}) %}
{% if multi_question.question_advice %}
<div class="govuk-body">
{{ multi_question.question_advice | safe }}
</div>
{% endif %}

<div class="govuk-grid-row">
{% for question in multi_question.questions %}
<div class="dm-multiquestion__item-input-column govuk-grid-column-{{ params.question.column_width | default('one-half') }}">
{{ digitalmarketplaceQuestion({
"type": question.type,
"question": question,
"data": params.data,
"errors": params.errors,
"frameworkReusedFrom": params.frameworkReusedFrom
}) }}
</div>
{% endfor %}
</div>
{% endcall %}
</div>
{%- endif %}
{% endfor %}
</div>

<div class="govuk-grid-row">
<div class="govuk-grid-column-full">
{{ govukButton({
"html": 'Remove item <span class="govuk-visually-hidden"><span class="dm-list-multiquestion__item-remove-counter">0</span></span>',
"classes": 'govuk-button--secondary dm-list-multiquestion__item-remove govuk-visually-hidden',
"type": 'button'
})}}
</div>
</div>

<div class="govuk-grid-row">
<div class="govuk-grid-column-full">
{{ govukButton({
"html": 'Add item (<span class="dm-list-multiquestion__item-add-counter">0</span> remaining)',
"classes": 'govuk-button--secondary dm-list-multiquestion__item-add govuk-visually-hidden',
"type": 'button'
})}}
</div>
</div>
{% endcall %}
{%- endif %}
{% endmacro %}
Original file line number Diff line number Diff line change
Expand Up @@ -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 -%}

<div
class="question {% if params.question.hidden %}js-hidden dm-question__related-information" aria-hidden="false{% endif %}"
Expand Down Expand Up @@ -45,6 +46,8 @@
{{ digitalmarketplaceQuestionSelect(params) }}
{% elif params.type == 'multiquestion' %}
{{ digitalmarketplaceQuestionMultiquestion(params) }}
{% elif params.type == 'list_multiquestion' %}
{{ digitalmarketplaceQuestionListMultiquestion(params) }}
{% endif %}
</div>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{% macro digitalmarketplaceSummaryContentBoolean(params) %}
{%- from "digitalmarketplace_frontend_jinja/components/summary-content/macros/text/macro.html" import digitalmarketplaceSummaryContentText -%}
{%- from "digitalmarketplace_frontend_jinja/components/summary-content-text/macro.html" import digitalmarketplaceSummaryContentText -%}

{% if params.value == true %}
{{ digitalmarketplaceSummaryContentText({
"text": "Yes"
"value": "Yes"
}) }}
{% elif params.value == false %}
{{ digitalmarketplaceSummaryContentText({
"text": "No"
"value": "No"
}) }}
{% else %}
{{ digitalmarketplaceSummaryContentText({
"text": params.value
"value": params.value
}) }}
{% endif %}
{% endmacro %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{% macro digitalmarketplaceSummaryContentListMultiquestion(params) %}
{%- from "digitalmarketplace_frontend_jinja/components/summary-content-multiquestion/macro.html" import digitalmarketplaceSummaryContentMultiquestion -%}

{% if params.value -%}
<div class="list-multiquestion govuk-body-s">
{% for multi_question in params.value %}
<div class="list-multiquestion__item govuk-body-s">
<p class="govuk-body govuk-!-margin-bottom-2">{{ multi_question.name }}</p>
{{ digitalmarketplaceSummaryContentMultiquestion({
"value": multi_question.value
}) }}
</div>
{% endfor %}
</div>
{%- endif %}
{% endmacro %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{% macro digitalmarketplaceSummaryContentList(params) %}
{%- from "digitalmarketplace_frontend_jinja/components/summary-content-text/macro.html" import digitalmarketplaceSummaryContentText -%}

{% if params.value | length == 0 %}
{{ digitalmarketplaceSummaryContentText({
"value": ''
}) }}
{% elif params.value | length == 1 %}
{{ digitalmarketplaceSummaryContentText({
"value": params.value[0]
}) }}
{% elif params.value | length > 1 %}
<ul class="govuk-list govuk-list--bullet govuk-body-s">
{% for item in params.value %}
<li>{{ item }}</li>
{% endfor %}
</ul>
{% endif %}
{% endmacro %}
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{% macro digitalmarketplaceSummaryContentNumber(params) %}
{%- from "digitalmarketplace_frontend_jinja/components/summary-content/macros/text/macro.html" import digitalmarketplaceSummaryContentText -%}
{%- from "digitalmarketplace_frontend_jinja/components/summary-content-text/macro.html" import digitalmarketplaceSummaryContentText -%}

{% if params.value or params.value == 0 %}
{{ digitalmarketplaceSummaryContentText({
"text": params.value
"value": params.value
}) }}
{% else %}
{{ digitalmarketplaceSummaryContentText({
"text": ""
"value": ""
}) }}
{% endif %}
{% endmacro %}
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{% macro digitalmarketplaceSummaryContentRadios(params) %}
{%- from "digitalmarketplace_frontend_jinja/components/summary-content/macros/text/macro.html" import digitalmarketplaceSummaryContentText -%}
{%- from "digitalmarketplace_frontend_jinja/components/summary-content/macros/list/macro.html" import digitalmarketplaceSummaryContentList -%}
{%- from "digitalmarketplace_frontend_jinja/components/summary-content-text/macro.html" import digitalmarketplaceSummaryContentText -%}
{%- from "digitalmarketplace_frontend_jinja/components/summary-content-list/macro.html" import digitalmarketplaceSummaryContentList -%}

{% if params.value is string %}
{{ digitalmarketplaceSummaryContentText({
"text": params.value
"value": params.value
}) }}
{% else %}
{{ digitalmarketplaceSummaryContentList({
"items": params.value
"value": params.value
}) }}
{% endif %}
{% endmacro %}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% macro digitalmarketplaceSummaryContentText(params) %}
<p class="govuk-body-s">
{{ params.text }}
{{ params.value }}
</p>
{% endmacro %}
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
{% macro digitalmarketplaceSummaryContent(params) %}
{%- from "digitalmarketplace_frontend_jinja/components/summary-content/macros/text/macro.html" import digitalmarketplaceSummaryContentText -%}
{%- from "digitalmarketplace_frontend_jinja/components/summary-content/macros/list/macro.html" import digitalmarketplaceSummaryContentList -%}
{%- from "digitalmarketplace_frontend_jinja/components/summary-content/macros/upload/macro.html" import digitalmarketplaceSummaryContentUpload -%}
{%- from "digitalmarketplace_frontend_jinja/components/summary-content/macros/service-id/macro.html" import digitalmarketplaceSummaryContentServiceId -%}
{%- from "digitalmarketplace_frontend_jinja/components/summary-content/macros/radios/macro.html" import digitalmarketplaceSummaryContentRadios -%}
{%- from "digitalmarketplace_frontend_jinja/components/summary-content/macros/boolean/macro.html" import digitalmarketplaceSummaryContentBoolean -%}
{%- from "digitalmarketplace_frontend_jinja/components/summary-content/macros/number/macro.html" import digitalmarketplaceSummaryContentNumber -%}
{%- from "digitalmarketplace_frontend_jinja/components/summary-content/macros/checkbox-tree/macro.html" import digitalmarketplaceSummaryContentCheckboxTree -%}
{%- from "digitalmarketplace_frontend_jinja/components/summary-content/macros/multiquestion/macro.html" import digitalmarketplaceSummaryContentMultiquestion -%}
{%- from "digitalmarketplace_frontend_jinja/components/summary-content-text/macro.html" import digitalmarketplaceSummaryContentText -%}
{%- from "digitalmarketplace_frontend_jinja/components/summary-content-list/macro.html" import digitalmarketplaceSummaryContentList -%}
{%- from "digitalmarketplace_frontend_jinja/components/summary-content-upload/macro.html" import digitalmarketplaceSummaryContentUpload -%}
{%- from "digitalmarketplace_frontend_jinja/components/summary-content-service-id/macro.html" import digitalmarketplaceSummaryContentServiceId -%}
{%- from "digitalmarketplace_frontend_jinja/components/summary-content-radios/macro.html" import digitalmarketplaceSummaryContentRadios -%}
{%- from "digitalmarketplace_frontend_jinja/components/summary-content-boolean/macro.html" import digitalmarketplaceSummaryContentBoolean -%}
{%- from "digitalmarketplace_frontend_jinja/components/summary-content-number/macro.html" import digitalmarketplaceSummaryContentNumber -%}
{%- from "digitalmarketplace_frontend_jinja/components/summary-content-checkbox-tree/macro.html" import digitalmarketplaceSummaryContentCheckboxTree -%}
{%- from "digitalmarketplace_frontend_jinja/components/summary-content-multiquestion/macro.html" import digitalmarketplaceSummaryContentMultiquestion -%}
{%- from "digitalmarketplace_frontend_jinja/components/summary-content-list-multiquestion/macro.html" import digitalmarketplaceSummaryContentListMultiquestion -%}

{% set textOptions = ['text', 'text_bold', 'textbox', 'textbox_large', 'pricing', 'date'] %}

{% if params.type in textOptions %}
{{ digitalmarketplaceSummaryContentText({
"text": params.value
"value": params.value
}) }}
{% elif params.type == 'list' or params.type == 'checkboxes'%}
{{ digitalmarketplaceSummaryContentList({
"items": params.value
"value": params.value
}) }}
{% elif params.type == 'upload' %}
{{ digitalmarketplaceSummaryContentUpload({
Expand Down Expand Up @@ -47,5 +48,9 @@
{{ digitalmarketplaceSummaryContentMultiquestion({
'value': params.value
}) }}
{% elif params.type == 'list_multiquestion' %}
{{ digitalmarketplaceSummaryContentListMultiquestion({
'value': params.value
}) }}
{% endif %}
{% endmacro %}

This file was deleted.

This file was deleted.

8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
"author": "CCS",
"license": "MIT",
"devDependencies": {
"digitalmarketplace-frontend": "^1.3.1"
"digitalmarketplace-frontend": "^2.0.0-beta.0"
}
}

0 comments on commit 2ac922a

Please sign in to comment.