hof 20.0.0-beta.1 → 20.0.0-beta.4
Sign up to get free protection for your applications and to get access to all the features.
- package/components/date/index.js +3 -1
- package/components/date/templates/date.html +3 -3
- package/frontend/template-mixins/mixins/template-mixins.js +1 -1
- package/frontend/template-mixins/partials/forms/checkbox-group.html +1 -1
- package/frontend/template-mixins/partials/forms/input-text-group.html +1 -1
- package/frontend/template-mixins/partials/forms/option-group.html +1 -1
- package/frontend/template-mixins/partials/mixins/panel.html +4 -4
- package/frontend/themes/gov-uk/styles/_cookie-banner.scss +51 -1
- package/lib/settings.js +17 -2
- package/package.json +2 -2
- package/sandbox/.env +1 -1
- package/sandbox/apps/sandbox/fields.js +12 -6
- package/sandbox/apps/sandbox/translations/en/default.json +4 -13
- package/sandbox/apps/sandbox/translations/src/en/fields.json +3 -2
- package/sandbox/apps/sandbox/translations/src/en/pages.json +2 -12
- package/sandbox/assets/scss/app.scss +0 -4
- package/sandbox/public/css/app.css +50 -5
package/components/date/index.js
CHANGED
@@ -40,6 +40,7 @@ const conditionalTranslate = (key, translate) => {
|
|
40
40
|
};
|
41
41
|
|
42
42
|
const getLegendClassName = field => field && field.legend && field.legend.className || '';
|
43
|
+
const getNoHeading = field => field && field.noHeading || '';
|
43
44
|
|
44
45
|
module.exports = (key, opts) => {
|
45
46
|
if (!key) {
|
@@ -113,8 +114,9 @@ module.exports = (key, opts) => {
|
|
113
114
|
const legend = conditionalTranslate(`fields.${key}.legend`, req.translate);
|
114
115
|
const hint = conditionalTranslate(`fields.${key}.hint`, req.translate);
|
115
116
|
const legendClassName = getLegendClassName(options);
|
117
|
+
const noHeading = getNoHeading(options);
|
116
118
|
const error = req.form.errors && req.form.errors[key];
|
117
|
-
res.render(template, { key, legend, legendClassName, hint, error }, (err, html) => {
|
119
|
+
res.render(template, { key, legend, legendClassName, noHeading, hint, error }, (err, html) => {
|
118
120
|
if (err) {
|
119
121
|
next(err);
|
120
122
|
} else {
|
@@ -1,9 +1,9 @@
|
|
1
1
|
<div class="govuk-form-group {{#error}}govuk-form-group--error{{/error}}">
|
2
2
|
<fieldset id="{{key}}-group" class="govuk-fieldset{{#className}} {{className}}{{/className}}" role="group">
|
3
|
-
<legend class="govuk-fieldset__legend govuk-fieldset__legend--l{{#legendClassName}} {{legendClassName}}{{/legendClassName}}">
|
4
|
-
<h1 class="govuk-fieldset__heading">
|
3
|
+
<legend class="govuk-fieldset__legend {{^noHeading}}govuk-fieldset__legend--l{{/noHeading}}{{#legendClassName}} {{legendClassName}}{{/legendClassName}}">
|
4
|
+
{{^noHeading}}<h1 class="govuk-fieldset__heading">{{/noHeading}}
|
5
5
|
{{legend}}
|
6
|
-
</h1>
|
6
|
+
{{^noHeading}}</h1>{{/noHeading}}
|
7
7
|
</legend>
|
8
8
|
{{#hint}}
|
9
9
|
<span id="{{key}}-hint" class="govuk-hint">{{hint}}</span>
|
@@ -240,7 +240,6 @@ module.exports = function (options) {
|
|
240
240
|
legend: t(legendValue),
|
241
241
|
legendClassName: legendClassName,
|
242
242
|
role: opts.type === 'radio' ? 'radiogroup' : 'group',
|
243
|
-
ariaRequired: opts.type === 'radio',
|
244
243
|
noHeading: field.noHeading,
|
245
244
|
detail: detail ? detail : '',
|
246
245
|
hint: conditionalTranslate(getTranslationKey(field, key, 'hint')),
|
@@ -276,6 +275,7 @@ module.exports = function (options) {
|
|
276
275
|
value: value,
|
277
276
|
type: opts.type,
|
278
277
|
selected: selected,
|
278
|
+
radioOption: opts.type === 'radio',
|
279
279
|
toggle: toggle,
|
280
280
|
child: child,
|
281
281
|
optionHint: conditionalTranslate(optionHint) || ''
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<div id="{{key}}-group" class="govuk-form-group{{#className}} {{className}} {{/className}}{{#formGroupClassName}} {{formGroupClassName}}{{/formGroupClassName}}{{#error}} govuk-form-group--error{{/error}}">
|
2
2
|
<fieldset class="govuk-fieldset" {{#hint}} aria-describedby="{{key}}-hint"{{/hint}}>
|
3
|
-
<legend class="govuk-fieldset__legend govuk-fieldset__legend--l{{#legendClassName}} {{legendClassName}}{{/legendClassName}}">
|
3
|
+
<legend class="govuk-fieldset__legend {{^noHeading}}govuk-fieldset__legend--l{{/noHeading}}{{#legendClassName}} {{legendClassName}}{{/legendClassName}}">
|
4
4
|
{{^noHeading}}<h1 class="govuk-fieldset__heading">{{/noHeading}}
|
5
5
|
{{legend}}
|
6
6
|
{{^noHeading}}</h1>{{/noHeading}}
|
@@ -19,7 +19,7 @@
|
|
19
19
|
type="{{type}}"
|
20
20
|
name="{{id}}"
|
21
21
|
id="{{id}}"
|
22
|
-
class="govuk-input{{#className}}
|
22
|
+
class="{{^className}}govuk-input{{/className}}{{#className}}{{className}}{{/className}}{{#error}} invalid-input{{/error}}"
|
23
23
|
aria-required="{{required}}"
|
24
24
|
{{#value}} value="{{value}}"{{/value}}
|
25
25
|
{{#min}} min="{{min}}"{{/min}}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<div id="{{key}}-group" class="govuk-form-group{{#className}} {{className}} {{/className}}{{#formGroupClassName}} {{formGroupClassName}}{{/formGroupClassName}}{{#error}} govuk-form-group--error{{/error}}">
|
2
2
|
<fieldset class="govuk-fieldset" {{#hint}} aria-describedby="{{key}}-hint"{{/hint}}>
|
3
|
-
<legend class="govuk-fieldset__legend govuk-fieldset__legend--l{{#legendClassName}} {{legendClassName}}{{/legendClassName}}">
|
3
|
+
<legend class="govuk-fieldset__legend {{^noHeading}}govuk-fieldset__legend--l{{/noHeading}}{{#legendClassName}} {{legendClassName}}{{/legendClassName}}">
|
4
4
|
{{^noHeading}}<h1 class="govuk-fieldset__heading">{{/noHeading}}
|
5
5
|
{{legend}}
|
6
6
|
{{^noHeading}}</h1>{{/noHeading}}
|
@@ -1,5 +1,5 @@
|
|
1
|
-
<div id="{{toggle}}-panel"
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
<div id="{{toggle}}-panel"
|
2
|
+
class="{{#radioOption}}govuk-radios__conditional govuk-radios__conditional--hidden{{/radioOption}}
|
3
|
+
{{^radioOption}}govuk-checkboxes__conditional govuk-checkboxes__conditional--hidden{{/radioOption}}">
|
4
|
+
{{#renderMixin}}{{/renderMixin}}
|
5
5
|
</div>
|
@@ -10,7 +10,6 @@
|
|
10
10
|
}
|
11
11
|
|
12
12
|
#cookie-banner {
|
13
|
-
max-width: 960px;
|
14
13
|
margin: 0 15px;
|
15
14
|
p {
|
16
15
|
margin: 0;
|
@@ -62,3 +61,54 @@
|
|
62
61
|
height: fit-content;
|
63
62
|
}
|
64
63
|
}
|
64
|
+
|
65
|
+
// the following are additional hof specific govuk cookie banner styling
|
66
|
+
.govuk-banner--success {
|
67
|
+
border-color: #00703c;
|
68
|
+
color: #00703c;
|
69
|
+
}
|
70
|
+
|
71
|
+
.govuk-banner {
|
72
|
+
border: 5px solid #1d70b8;
|
73
|
+
font-size: 0;
|
74
|
+
margin-bottom: 30px;
|
75
|
+
padding: 10px;
|
76
|
+
}
|
77
|
+
|
78
|
+
.govuk-banner__icon{
|
79
|
+
display: inline-block;
|
80
|
+
}
|
81
|
+
|
82
|
+
.govuk-banner__message {
|
83
|
+
font-family: "GDS Transport", Arial, sans-serif;
|
84
|
+
-webkit-font-smoothing: antialiased;
|
85
|
+
font-weight: 400;
|
86
|
+
font-size: 1rem;
|
87
|
+
line-height: 1.25;
|
88
|
+
color: #0b0c0c;
|
89
|
+
display: block;
|
90
|
+
overflow: hidden;
|
91
|
+
display: inline-block;
|
92
|
+
margin-left: 10px;
|
93
|
+
}
|
94
|
+
|
95
|
+
.govuk-banner__assistive {
|
96
|
+
position: absolute !important;
|
97
|
+
width: 1px !important;
|
98
|
+
height: 1px !important;
|
99
|
+
margin: 0 !important;
|
100
|
+
padding: 0 !important;
|
101
|
+
overflow: hidden !important;
|
102
|
+
clip: rect(0 0 0 0) !important;
|
103
|
+
clip-path: inset(50%) !important;
|
104
|
+
border: 0 !important;
|
105
|
+
white-space: nowrap !important;
|
106
|
+
}
|
107
|
+
|
108
|
+
.cookie-table-holder > table > tbody > tr > td:first-child{
|
109
|
+
font-weight:bold;
|
110
|
+
}
|
111
|
+
|
112
|
+
.js-enabled #global-cookie-message {
|
113
|
+
display: none;
|
114
|
+
}
|
package/lib/settings.js
CHANGED
@@ -7,7 +7,21 @@ const hoganExpressStrict = require('hogan-express-strict');
|
|
7
7
|
const expressPartialTemplates = require('express-partial-templates');
|
8
8
|
const bodyParser = require('body-parser');
|
9
9
|
|
10
|
-
|
10
|
+
const filterEmptyViews = (views) => {
|
11
|
+
return views.filter(view => dirExists(view))
|
12
|
+
}
|
13
|
+
|
14
|
+
const dirExists = (dir) => {
|
15
|
+
try {
|
16
|
+
if (fs.existsSync(dir)) {
|
17
|
+
return true;
|
18
|
+
}
|
19
|
+
} catch(err) {
|
20
|
+
throw new Error(`${err}: Cannot check if the directory path exists`)
|
21
|
+
}
|
22
|
+
}
|
23
|
+
|
24
|
+
module.exports = async (app, config) => {
|
11
25
|
const viewEngine = config.viewEngine || 'html';
|
12
26
|
|
13
27
|
app.use((req, res, next) => {
|
@@ -17,7 +31,8 @@ module.exports = (app, config) => {
|
|
17
31
|
|
18
32
|
app.use(config.theme());
|
19
33
|
|
20
|
-
const
|
34
|
+
const filteredViews = filterEmptyViews(config.theme.views)
|
35
|
+
const viewPaths = [].concat(filteredViews);
|
21
36
|
app.set('view engine', viewEngine);
|
22
37
|
app.enable('view cache');
|
23
38
|
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "hof",
|
3
3
|
"description": "A bootstrap for HOF projects",
|
4
|
-
"version": "20.0.0-beta.
|
4
|
+
"version": "20.0.0-beta.4",
|
5
5
|
"license": "MIT",
|
6
6
|
"main": "index.js",
|
7
7
|
"author": "HomeOffice",
|
@@ -57,7 +57,7 @@
|
|
57
57
|
"findup": "^0.1.5",
|
58
58
|
"glob": "^7.2.0",
|
59
59
|
"govuk-elements-sass": "^3.1.3",
|
60
|
-
"govuk-frontend": "
|
60
|
+
"govuk-frontend": "^4.1.0",
|
61
61
|
"govuk_template_mustache": "^0.26.0",
|
62
62
|
"helmet": "^3.22.0",
|
63
63
|
"hogan-express-strict": "^0.5.4",
|
package/sandbox/.env
CHANGED
@@ -1 +1 @@
|
|
1
|
-
GA_TAG=UA-215558609-1
|
1
|
+
// GA_TAG=UA-215558609-1
|
@@ -8,9 +8,9 @@ module.exports = {
|
|
8
8
|
'landing-page-radio': {
|
9
9
|
mixin: 'radio-group',
|
10
10
|
validate: ['required'],
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
noHeading: true,
|
12
|
+
// Design system says to avoid in-line unless it's two options,
|
13
|
+
// so just added as an example below but by default it isn't
|
14
14
|
className: ['govuk-radios--inline'],
|
15
15
|
options: ['basic-form', 'complex-form', 'build-your-own-form']
|
16
16
|
},
|
@@ -20,6 +20,7 @@ module.exports = {
|
|
20
20
|
// noHeading: 'true'
|
21
21
|
},
|
22
22
|
'dateOfBirth': dateComponent('dateOfBirth', {
|
23
|
+
// noHeading: 'true',
|
23
24
|
controlType: 'date-input',
|
24
25
|
validate: [
|
25
26
|
'required',
|
@@ -28,23 +29,28 @@ module.exports = {
|
|
28
29
|
]
|
29
30
|
}),
|
30
31
|
building: {
|
32
|
+
noHeading: 'true',
|
31
33
|
validate: ['required', 'notUrl', { type: 'maxlength', arguments: 100 }]
|
32
34
|
},
|
33
35
|
street: {
|
36
|
+
noHeading: 'true',
|
34
37
|
validate: ['notUrl', { type: 'maxlength', arguments: 50 }],
|
35
38
|
labelClassName: 'visuallyhidden'
|
36
39
|
},
|
37
40
|
townOrCity: {
|
41
|
+
noHeading: 'true',
|
38
42
|
validate: ['required', 'notUrl',
|
39
43
|
{ type: 'regex', arguments: /^([^0-9]*)$/ },
|
40
44
|
{ type: 'maxlength', arguments: 100 }
|
41
45
|
]
|
42
46
|
},
|
43
47
|
postcode: {
|
48
|
+
noHeading: 'true',
|
44
49
|
validate: ['required', 'postcode'],
|
45
50
|
formatter: ['removespaces', 'uppercase']
|
46
51
|
},
|
47
52
|
incomeTypes: {
|
53
|
+
// noHeading: 'true',
|
48
54
|
mixin: 'checkbox-group',
|
49
55
|
labelClassName: 'visuallyhidden',
|
50
56
|
validate: ['required'],
|
@@ -57,11 +63,9 @@ module.exports = {
|
|
57
63
|
]
|
58
64
|
},
|
59
65
|
countryOfHearing: {
|
66
|
+
// noHeading: 'true',
|
60
67
|
mixin: 'radio-group',
|
61
68
|
validate: ['required'],
|
62
|
-
legend: {
|
63
|
-
className: 'visuallyhidden'
|
64
|
-
},
|
65
69
|
options: [
|
66
70
|
'englandAndWales',
|
67
71
|
'scotland',
|
@@ -69,6 +73,8 @@ module.exports = {
|
|
69
73
|
]
|
70
74
|
},
|
71
75
|
email: {
|
76
|
+
// noHeading: 'true',
|
77
|
+
labelClassName: ['govuk-label--l'],
|
72
78
|
validate: ['required', 'email']
|
73
79
|
},
|
74
80
|
phone: {
|
@@ -2,6 +2,7 @@
|
|
2
2
|
"fields": {
|
3
3
|
"landing-page-radio": {
|
4
4
|
"legend": "Which form would you like to explore?",
|
5
|
+
"hint": "Choose one of the options below and press continue.",
|
5
6
|
"options": {
|
6
7
|
"basic-form": {
|
7
8
|
"label": "Basic form"
|
@@ -56,7 +57,7 @@
|
|
56
57
|
}
|
57
58
|
},
|
58
59
|
"countryOfHearing": {
|
59
|
-
"
|
60
|
+
"legend": "What country was the appeal lodged?",
|
60
61
|
"options": {
|
61
62
|
"englandAndWales": {
|
62
63
|
"label": "England and Wales"
|
@@ -70,7 +71,7 @@
|
|
70
71
|
}
|
71
72
|
},
|
72
73
|
"email": {
|
73
|
-
"label": "
|
74
|
+
"label": "Enter your email address"
|
74
75
|
},
|
75
76
|
"phone": {
|
76
77
|
"label": "Phone number",
|
@@ -103,8 +104,7 @@
|
|
103
104
|
},
|
104
105
|
"pages": {
|
105
106
|
"landing-page": {
|
106
|
-
"header": "Landing page"
|
107
|
-
"intro": "Choose one of the options below and press continue."
|
107
|
+
"header": "Landing page"
|
108
108
|
},
|
109
109
|
"build-your-own-form": {
|
110
110
|
"title": "Build your own form",
|
@@ -114,15 +114,6 @@
|
|
114
114
|
"header": "What is your address in the UK?",
|
115
115
|
"intro": "If you have no fixed address, enter an address where we can contact you."
|
116
116
|
},
|
117
|
-
"checkboxes": {
|
118
|
-
"header": "Where does your money come from each month?"
|
119
|
-
},
|
120
|
-
"radio": {
|
121
|
-
"header": "What country was the appeal lodged?"
|
122
|
-
},
|
123
|
-
"email": {
|
124
|
-
"header": "Enter your email address"
|
125
|
-
},
|
126
117
|
"phone-number": {
|
127
118
|
"header": "Enter your phone number"
|
128
119
|
},
|
@@ -1,6 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"landing-page-radio": {
|
3
3
|
"legend": "Which form would you like to explore?",
|
4
|
+
"hint": "Choose one of the options below and press continue.",
|
4
5
|
"options": {
|
5
6
|
"basic-form": {
|
6
7
|
"label": "Basic form"
|
@@ -55,7 +56,7 @@
|
|
55
56
|
}
|
56
57
|
},
|
57
58
|
"countryOfHearing": {
|
58
|
-
"
|
59
|
+
"legend": "What country was the appeal lodged?",
|
59
60
|
"options": {
|
60
61
|
"englandAndWales": {
|
61
62
|
"label": "England and Wales"
|
@@ -69,7 +70,7 @@
|
|
69
70
|
}
|
70
71
|
},
|
71
72
|
"email" : {
|
72
|
-
"label": "
|
73
|
+
"label": "Enter your email address"
|
73
74
|
},
|
74
75
|
"phone": {
|
75
76
|
"label": "Phone number",
|
@@ -1,7 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"landing-page": {
|
3
|
-
"header": "Landing page"
|
4
|
-
"intro": "Choose one of the options below and press continue."
|
3
|
+
"header": "Landing page"
|
5
4
|
},
|
6
5
|
"build-your-own-form": {
|
7
6
|
"title": "Build your own form",
|
@@ -11,15 +10,6 @@
|
|
11
10
|
"header": "What is your address in the UK?",
|
12
11
|
"intro": "If you have no fixed address, enter an address where we can contact you."
|
13
12
|
},
|
14
|
-
"checkboxes": {
|
15
|
-
"header": "Where does your money come from each month?"
|
16
|
-
},
|
17
|
-
"radio": {
|
18
|
-
"header": "What country was the appeal lodged?"
|
19
|
-
},
|
20
|
-
"email": {
|
21
|
-
"header": "Enter your email address"
|
22
|
-
},
|
23
13
|
"phone-number": {
|
24
14
|
"header": "Enter your phone number"
|
25
15
|
},
|
@@ -55,4 +45,4 @@
|
|
55
45
|
"subheader": "What happens next",
|
56
46
|
"content": "We’ll contact you with the decision of your application or if we need more information from you."
|
57
47
|
}
|
58
|
-
}
|
48
|
+
}
|
@@ -2239,7 +2239,6 @@ strong {
|
|
2239
2239
|
}
|
2240
2240
|
|
2241
2241
|
#cookie-banner {
|
2242
|
-
max-width: 960px;
|
2243
2242
|
margin: 0 15px;
|
2244
2243
|
}
|
2245
2244
|
#cookie-banner p {
|
@@ -2294,6 +2293,56 @@ strong {
|
|
2294
2293
|
height: fit-content;
|
2295
2294
|
}
|
2296
2295
|
|
2296
|
+
.govuk-banner--success {
|
2297
|
+
border-color: #00703c;
|
2298
|
+
color: #00703c;
|
2299
|
+
}
|
2300
|
+
|
2301
|
+
.govuk-banner {
|
2302
|
+
border: 5px solid #1d70b8;
|
2303
|
+
font-size: 0;
|
2304
|
+
margin-bottom: 30px;
|
2305
|
+
padding: 10px;
|
2306
|
+
}
|
2307
|
+
|
2308
|
+
.govuk-banner__icon {
|
2309
|
+
display: inline-block;
|
2310
|
+
}
|
2311
|
+
|
2312
|
+
.govuk-banner__message {
|
2313
|
+
font-family: "GDS Transport", Arial, sans-serif;
|
2314
|
+
-webkit-font-smoothing: antialiased;
|
2315
|
+
font-weight: 400;
|
2316
|
+
font-size: 1rem;
|
2317
|
+
line-height: 1.25;
|
2318
|
+
color: #0b0c0c;
|
2319
|
+
display: block;
|
2320
|
+
overflow: hidden;
|
2321
|
+
display: inline-block;
|
2322
|
+
margin-left: 10px;
|
2323
|
+
}
|
2324
|
+
|
2325
|
+
.govuk-banner__assistive {
|
2326
|
+
position: absolute !important;
|
2327
|
+
width: 1px !important;
|
2328
|
+
height: 1px !important;
|
2329
|
+
margin: 0 !important;
|
2330
|
+
padding: 0 !important;
|
2331
|
+
overflow: hidden !important;
|
2332
|
+
clip: rect(0 0 0 0) !important;
|
2333
|
+
clip-path: inset(50%) !important;
|
2334
|
+
border: 0 !important;
|
2335
|
+
white-space: nowrap !important;
|
2336
|
+
}
|
2337
|
+
|
2338
|
+
.cookie-table-holder > table > tbody > tr > td:first-child {
|
2339
|
+
font-weight: bold;
|
2340
|
+
}
|
2341
|
+
|
2342
|
+
.js-enabled #global-cookie-message {
|
2343
|
+
display: none;
|
2344
|
+
}
|
2345
|
+
|
2297
2346
|
#cookie-settings .js-enabled {
|
2298
2347
|
display: none;
|
2299
2348
|
}
|
@@ -9392,8 +9441,4 @@ x:-moz-any-link {
|
|
9392
9441
|
|
9393
9442
|
.js-enabled #global-cookie-message {
|
9394
9443
|
display: none;
|
9395
|
-
}
|
9396
|
-
|
9397
|
-
#cookie-banner {
|
9398
|
-
max-width: none;
|
9399
9444
|
}
|