hof 20.0.0-beta.14 → 20.0.0-beta.15
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +2 -0
- package/frontend/template-mixins/mixins/template-mixins.js +3 -0
- package/frontend/template-mixins/partials/forms/checkbox-group.html +9 -0
- package/frontend/template-mixins/partials/forms/option-group.html +9 -0
- package/package.json +1 -1
- package/sandbox/server.js +1 -2
- package/.nyc_output/e2fdc3eb-4fd2-47e0-a392-fe5f665776a4.json +0 -1
- package/.nyc_output/processinfo/e2fdc3eb-4fd2-47e0-a392-fe5f665776a4.json +0 -1
- package/.nyc_output/processinfo/index.json +0 -1
- package/.vscode/settings.json +0 -6
- package/frontend/govuk-template/govuk_template_generated.html +0 -104
- package/sandbox/.env +0 -1
- package/sandbox/apps/sandbox/translations/en/default.json +0 -203
- package/sandbox/dump.rdb +0 -0
- package/sandbox/public/css/app.css +0 -9389
- package/sandbox/public/images/icons/icon-caret-left.png +0 -0
- package/sandbox/public/images/icons/icon-complete.png +0 -0
- package/sandbox/public/images/icons/icon-cross-remove-sign.png +0 -0
- package/sandbox/public/js/bundle.js +0 -35658
package/README.md
CHANGED
@@ -1471,6 +1471,8 @@ To render a specific fields in your templates use the mixin name (matching those
|
|
1471
1471
|
- `toggle`: Can be used to toggle the display of the HTML element with a matching `id`. See [hof-frontend-toolkit](https://github.com/UKHomeOfficeForms/hof-frontend-toolkit/blob/master/assets/javascript/progressive-reveal.js) for details.
|
1472
1472
|
- `attributes`: A hash of key/value pairs applicable to a HTML `textarea` field. Each key/value is assigned as an attribute of the `textarea`. For example `spellcheck="true"`.
|
1473
1473
|
- `child`: Render a child partial beneath each option in an `optionGroup`. Accepts a custom mustache template string, a custom partial in the format `partials/{your-partial-name}`, `'html'` which is used to specify the html for the field has already been prerendered, such as in [hof-component-date](https://github.com/UKHomeOfficeForms/hof-component-date) or a template mixin key which will be rendered within a panel element partial.
|
1474
|
+
- `isPageHeading`: Applicable to `checkbox` and `radio` controls. Sets the legend as the page heading on single page questions.
|
1475
|
+
- `isWarning`: Applicable to `checkbox` and `radio` controls. Allows warning text to be placed after page headings on single page questions if required.
|
1474
1476
|
|
1475
1477
|
|
1476
1478
|
# HOF-template-partials
|
@@ -224,6 +224,7 @@ module.exports = function (options) {
|
|
224
224
|
const field = Object.assign({}, this.options.fields[key] || options.fields[key]);
|
225
225
|
const legend = field.legend;
|
226
226
|
const detail = field.detail;
|
227
|
+
const warningValue = 'fields.' + key + '.warning';
|
227
228
|
let legendClassName;
|
228
229
|
let legendValue = 'fields.' + key + '.legend';
|
229
230
|
if (legend) {
|
@@ -241,6 +242,8 @@ module.exports = function (options) {
|
|
241
242
|
legendClassName: legendClassName,
|
242
243
|
role: opts.type === 'radio' ? 'radiogroup' : 'group',
|
243
244
|
isPageHeading: field.isPageHeading,
|
245
|
+
isWarning: field.isWarning,
|
246
|
+
warning: t(warningValue),
|
244
247
|
detail: detail ? detail : '',
|
245
248
|
hint: conditionalTranslate(getTranslationKey(field, key, 'hint')),
|
246
249
|
options: _.map(field.options, function (obj) {
|
@@ -5,6 +5,15 @@
|
|
5
5
|
{{legend}}
|
6
6
|
{{#isPageHeading}}</h1>{{/isPageHeading}}
|
7
7
|
</legend>
|
8
|
+
{{#isWarning}}
|
9
|
+
<div class="govuk-warning-text">
|
10
|
+
<span class="govuk-warning-text__icon" aria-hidden="true">!</span>
|
11
|
+
<strong class="govuk-warning-text__text">
|
12
|
+
<span class="govuk-warning-text__assistive">Warning</span>
|
13
|
+
{{warning}}
|
14
|
+
</strong>
|
15
|
+
</div>
|
16
|
+
{{/isWarning}}
|
8
17
|
{{#hint}}<div id="{{key}}-hint" class="govuk-hint">{{hint}}</div>{{/hint}}
|
9
18
|
{{#error}}
|
10
19
|
<p id="{{key}}-error" class="govuk-error-message">
|
@@ -5,6 +5,15 @@
|
|
5
5
|
{{legend}}
|
6
6
|
{{#isPageHeading}}</h1>{{/isPageHeading}}
|
7
7
|
</legend>
|
8
|
+
{{#isWarning}}
|
9
|
+
<div class="govuk-warning-text">
|
10
|
+
<span class="govuk-warning-text__icon" aria-hidden="true">!</span>
|
11
|
+
<strong class="govuk-warning-text__text">
|
12
|
+
<span class="govuk-warning-text__assistive">Warning</span>
|
13
|
+
{{warning}}
|
14
|
+
</strong>
|
15
|
+
</div>
|
16
|
+
{{/isWarning}}
|
8
17
|
{{#hint}}<div id="{{key}}-hint" class="govuk-hint">{{hint}}</div>{{/hint}}
|
9
18
|
{{#error}}<p id="{{key}}-error" class="govuk-error-message"><span class="govuk-visually-hidden">Error:</span> {{error.message}}</p>{{/error}}
|
10
19
|
{{{detail}}}
|
package/package.json
CHANGED