hof 20.0.3 → 20.0.4
Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,22 @@
|
|
1
|
+
|
2
|
+
const _ = require('lodash');
|
3
|
+
const componentDefaults = require('../../config/component-defaults');
|
4
|
+
|
5
|
+
module.exports = superclass => class extends superclass {
|
6
|
+
configure(req, res, next) {
|
7
|
+
const homeOfficeCountries = [''].concat(require('homeoffice-countries').allCountries);
|
8
|
+
|
9
|
+
const nationalityFields = componentDefaults.homeOfficeCountries;
|
10
|
+
|
11
|
+
nationalityFields.forEach(field => {
|
12
|
+
if (_.get(req, `form.options.fields[${field}].options`)) {
|
13
|
+
req.form.options.fields[field].options = homeOfficeCountries.map(country => {
|
14
|
+
const labelString = country !== '' ? country : 'Please select a country';
|
15
|
+
return { label: labelString, value: country };
|
16
|
+
});
|
17
|
+
}
|
18
|
+
});
|
19
|
+
|
20
|
+
next();
|
21
|
+
}
|
22
|
+
};
|
@@ -0,0 +1,15 @@
|
|
1
|
+
|
2
|
+
module.exports = {
|
3
|
+
componentDefaults: {
|
4
|
+
homeOfficeCountries: [
|
5
|
+
'nationality',
|
6
|
+
'former-nationality',
|
7
|
+
'dual-nationality',
|
8
|
+
'nominated-nationality',
|
9
|
+
'nationality-error',
|
10
|
+
'country',
|
11
|
+
'country-of-birth',
|
12
|
+
'someone-else-nationality'
|
13
|
+
]
|
14
|
+
}
|
15
|
+
};
|