hof 22.9.0-beta → 22.9.0-beta.v2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (313) hide show
  1. package/package.json +1 -1
  2. package/hof-22.9.0.tgz +0 -0
  3. package/package/.eslintignore +0 -1
  4. package/package/CHANGELOG.md +0 -232
  5. package/package/LICENSE +0 -21
  6. package/package/README.md +0 -1887
  7. package/package/bin/hof-build +0 -10
  8. package/package/bin/hof-transpiler +0 -12
  9. package/package/build/helpers/importer.js +0 -29
  10. package/package/build/helpers/local.js +0 -35
  11. package/package/build/helpers/resolver/import.js +0 -32
  12. package/package/build/helpers/resolver/nearest-package-root.js +0 -33
  13. package/package/build/helpers/resolver/package.js +0 -29
  14. package/package/build/helpers/resolver.js +0 -16
  15. package/package/build/index.js +0 -49
  16. package/package/build/lib/env.js +0 -36
  17. package/package/build/lib/mkdir.js +0 -9
  18. package/package/build/lib/run.js +0 -17
  19. package/package/build/lib/spawn.js +0 -18
  20. package/package/build/tasks/browserify/compress.js +0 -15
  21. package/package/build/tasks/browserify/index.js +0 -48
  22. package/package/build/tasks/build/index.js +0 -6
  23. package/package/build/tasks/images/index.js +0 -27
  24. package/package/build/tasks/index.js +0 -8
  25. package/package/build/tasks/sass/index.js +0 -67
  26. package/package/build/tasks/translate/index.js +0 -20
  27. package/package/build/tasks/watch/index.js +0 -161
  28. package/package/components/address-lookup/default-model.js +0 -76
  29. package/package/components/address-lookup/defaults.js +0 -25
  30. package/package/components/address-lookup/index.js +0 -251
  31. package/package/components/address-lookup/templates/address-lookup.html +0 -14
  32. package/package/components/address-lookup/templates/address.html +0 -22
  33. package/package/components/address-lookup/templates/postcode.html +0 -9
  34. package/package/components/clear-session/Readme.md +0 -46
  35. package/package/components/clear-session/index.js +0 -26
  36. package/package/components/combine-and-loop-fields/Readme.md +0 -42
  37. package/package/components/combine-and-loop-fields/index.js +0 -156
  38. package/package/components/date/fields.js +0 -16
  39. package/package/components/date/index.js +0 -172
  40. package/package/components/date/templates/date.html +0 -20
  41. package/package/components/emailer/assets/images/govuk_logotype_email.png +0 -0
  42. package/package/components/emailer/assets/images/ho_crest_27px.png +0 -0
  43. package/package/components/emailer/assets/images/spacer.gif +0 -0
  44. package/package/components/emailer/email-service.js +0 -51
  45. package/package/components/emailer/emailer.js +0 -53
  46. package/package/components/emailer/index.js +0 -74
  47. package/package/components/emailer/transports/debug.js +0 -74
  48. package/package/components/emailer/transports/index.js +0 -8
  49. package/package/components/emailer/transports/ses.js +0 -36
  50. package/package/components/emailer/transports/smtp.js +0 -26
  51. package/package/components/emailer/transports/stub.js +0 -5
  52. package/package/components/emailer/views/layout.html +0 -63
  53. package/package/components/homeoffice-countries/index.js +0 -22
  54. package/package/components/index.js +0 -13
  55. package/package/components/notify/index.js +0 -62
  56. package/package/components/notify/notify.js +0 -51
  57. package/package/components/session-timeout-warning/index.js +0 -67
  58. package/package/components/summary/index.js +0 -237
  59. package/package/config/builder-defaults.js +0 -45
  60. package/package/config/component-defaults.js +0 -13
  61. package/package/config/hof-defaults.js +0 -65
  62. package/package/config/rate-limits.js +0 -20
  63. package/package/config/sanitisation-rules.js +0 -32
  64. package/package/controller/base-controller.js +0 -296
  65. package/package/controller/behaviour-hooks.js +0 -51
  66. package/package/controller/behaviour-session.js +0 -64
  67. package/package/controller/controller.js +0 -258
  68. package/package/controller/deprecate-error.js +0 -10
  69. package/package/controller/formatting/formatters.js +0 -70
  70. package/package/controller/formatting/index.js +0 -32
  71. package/package/controller/index.js +0 -17
  72. package/package/controller/validation/email.js +0 -30
  73. package/package/controller/validation/index.js +0 -101
  74. package/package/controller/validation/validators.js +0 -181
  75. package/package/controller/validation-error.js +0 -14
  76. package/package/frontend/govuk-template/build/config.js +0 -24
  77. package/package/frontend/govuk-template/build/govuk_template.html +0 -102
  78. package/package/frontend/govuk-template/build/index.js +0 -23
  79. package/package/frontend/govuk-template/govuk_template_generated.html +0 -102
  80. package/package/frontend/govuk-template/index.js +0 -29
  81. package/package/frontend/index.js +0 -9
  82. package/package/frontend/template-mixins/mixins/helpers.js +0 -103
  83. package/package/frontend/template-mixins/mixins/index.js +0 -37
  84. package/package/frontend/template-mixins/mixins/render.js +0 -12
  85. package/package/frontend/template-mixins/mixins/template-mixins.js +0 -520
  86. package/package/frontend/template-mixins/partials/forms/checkbox-group.html +0 -47
  87. package/package/frontend/template-mixins/partials/forms/checkbox.html +0 -16
  88. package/package/frontend/template-mixins/partials/forms/input-submit.html +0 -1
  89. package/package/frontend/template-mixins/partials/forms/input-text-date.html +0 -37
  90. package/package/frontend/template-mixins/partials/forms/input-text-group.html +0 -45
  91. package/package/frontend/template-mixins/partials/forms/option-group.html +0 -43
  92. package/package/frontend/template-mixins/partials/forms/select.html +0 -17
  93. package/package/frontend/template-mixins/partials/forms/textarea-group.html +0 -37
  94. package/package/frontend/template-mixins/partials/mixins/panel.html +0 -4
  95. package/package/frontend/template-partials/index.js +0 -9
  96. package/package/frontend/template-partials/translations/index.js +0 -26
  97. package/package/frontend/template-partials/translations/src/cy/base.json +0 -4
  98. package/package/frontend/template-partials/translations/src/cy/buttons.json +0 -6
  99. package/package/frontend/template-partials/translations/src/cy/cookies.json +0 -104
  100. package/package/frontend/template-partials/translations/src/cy/errorlist.json +0 -6
  101. package/package/frontend/template-partials/translations/src/cy/errors.json +0 -18
  102. package/package/frontend/template-partials/translations/src/cy/terms.json +0 -28
  103. package/package/frontend/template-partials/translations/src/en/accessibility.json +0 -43
  104. package/package/frontend/template-partials/translations/src/en/base.json +0 -5
  105. package/package/frontend/template-partials/translations/src/en/buttons.json +0 -10
  106. package/package/frontend/template-partials/translations/src/en/cookies.json +0 -116
  107. package/package/frontend/template-partials/translations/src/en/errorlist.json +0 -7
  108. package/package/frontend/template-partials/translations/src/en/errors.json +0 -35
  109. package/package/frontend/template-partials/translations/src/en/exit.json +0 -5
  110. package/package/frontend/template-partials/translations/src/en/fields.json +0 -5
  111. package/package/frontend/template-partials/translations/src/en/journey.json +0 -6
  112. package/package/frontend/template-partials/translations/src/en/save-and-exit.json +0 -4
  113. package/package/frontend/template-partials/translations/src/en/terms.json +0 -28
  114. package/package/frontend/template-partials/views/404.html +0 -9
  115. package/package/frontend/template-partials/views/accessibility.html +0 -55
  116. package/package/frontend/template-partials/views/confirm.html +0 -8
  117. package/package/frontend/template-partials/views/confirmation.html +0 -19
  118. package/package/frontend/template-partials/views/content/en/what-happens-next.md +0 -0
  119. package/package/frontend/template-partials/views/cookie-error.html +0 -1
  120. package/package/frontend/template-partials/views/cookies.html +0 -84
  121. package/package/frontend/template-partials/views/email/data-row.html +0 -4
  122. package/package/frontend/template-partials/views/email/formatted.html +0 -12
  123. package/package/frontend/template-partials/views/email/layout.html +0 -63
  124. package/package/frontend/template-partials/views/email/raw.html +0 -11
  125. package/package/frontend/template-partials/views/email/section-row.html +0 -3
  126. package/package/frontend/template-partials/views/error.html +0 -20
  127. package/package/frontend/template-partials/views/exit.html +0 -9
  128. package/package/frontend/template-partials/views/feedback-submitted.html +0 -11
  129. package/package/frontend/template-partials/views/layout.html +0 -55
  130. package/package/frontend/template-partials/views/partials/analytics-table.html +0 -25
  131. package/package/frontend/template-partials/views/partials/back.html +0 -5
  132. package/package/frontend/template-partials/views/partials/bullet-list.html +0 -7
  133. package/package/frontend/template-partials/views/partials/confirmation-alert.html +0 -6
  134. package/package/frontend/template-partials/views/partials/continue.html +0 -5
  135. package/package/frontend/template-partials/views/partials/cookie-banner.html +0 -29
  136. package/package/frontend/template-partials/views/partials/cookie-notification.html +0 -4
  137. package/package/frontend/template-partials/views/partials/cookie-settings-button.html +0 -1
  138. package/package/frontend/template-partials/views/partials/cookie-settings-radio.html +0 -8
  139. package/package/frontend/template-partials/views/partials/details-summary.html +0 -8
  140. package/package/frontend/template-partials/views/partials/external-link.html +0 -1
  141. package/package/frontend/template-partials/views/partials/form.html +0 -10
  142. package/package/frontend/template-partials/views/partials/gatag.html +0 -60
  143. package/package/frontend/template-partials/views/partials/head.html +0 -31
  144. package/package/frontend/template-partials/views/partials/heading.html +0 -11
  145. package/package/frontend/template-partials/views/partials/items-table.html +0 -32
  146. package/package/frontend/template-partials/views/partials/maincontent-left.html +0 -10
  147. package/package/frontend/template-partials/views/partials/navigation.html +0 -8
  148. package/package/frontend/template-partials/views/partials/page.html +0 -23
  149. package/package/frontend/template-partials/views/partials/panel-indent.html +0 -3
  150. package/package/frontend/template-partials/views/partials/session-cookies-table.html +0 -28
  151. package/package/frontend/template-partials/views/partials/session-timeout-warning.html +0 -38
  152. package/package/frontend/template-partials/views/partials/summary-table-row.html +0 -14
  153. package/package/frontend/template-partials/views/partials/summary-table.html +0 -8
  154. package/package/frontend/template-partials/views/partials/table.html +0 -18
  155. package/package/frontend/template-partials/views/partials/validation-list.html +0 -3
  156. package/package/frontend/template-partials/views/partials/validation-summary.html +0 -25
  157. package/package/frontend/template-partials/views/partials/warn.html +0 -7
  158. package/package/frontend/template-partials/views/rate-limit-error.html +0 -10
  159. package/package/frontend/template-partials/views/save-and-exit.html +0 -17
  160. package/package/frontend/template-partials/views/service-unavailable.html +0 -13
  161. package/package/frontend/template-partials/views/session-timeout.html +0 -7
  162. package/package/frontend/template-partials/views/step.html +0 -14
  163. package/package/frontend/template-partials/views/terms.html +0 -26
  164. package/package/frontend/themes/gov-uk/client-js/cookieSettings.js +0 -145
  165. package/package/frontend/themes/gov-uk/client-js/govuk-cookies.js +0 -121
  166. package/package/frontend/themes/gov-uk/client-js/index.js +0 -27
  167. package/package/frontend/themes/gov-uk/client-js/session-timeout-dialog.js +0 -348
  168. package/package/frontend/themes/gov-uk/client-js/skip-to-main.js +0 -19
  169. package/package/frontend/themes/gov-uk/index.js +0 -9
  170. package/package/frontend/themes/gov-uk/styles/_base.scss +0 -17
  171. package/package/frontend/themes/gov-uk/styles/_check_your_answers.scss +0 -155
  172. package/package/frontend/themes/gov-uk/styles/_cookie-banner.scss +0 -111
  173. package/package/frontend/themes/gov-uk/styles/_cookie-settings.scss +0 -33
  174. package/package/frontend/themes/gov-uk/styles/_govuk_frontend_toolkit.scss +0 -23
  175. package/package/frontend/themes/gov-uk/styles/_helpers.scss +0 -5
  176. package/package/frontend/themes/gov-uk/styles/_layout.scss +0 -125
  177. package/package/frontend/themes/gov-uk/styles/_panel-indent.scss +0 -27
  178. package/package/frontend/themes/gov-uk/styles/_pdf.scss +0 -42
  179. package/package/frontend/themes/gov-uk/styles/_session-timeout-dialog.scss +0 -121
  180. package/package/frontend/themes/gov-uk/styles/_typography.scss +0 -27
  181. package/package/frontend/themes/gov-uk/styles/_variables.scss +0 -11
  182. package/package/frontend/themes/gov-uk/styles/govuk.scss +0 -43
  183. package/package/frontend/themes/gov-uk/styles/mixins.scss +0 -16
  184. package/package/frontend/themes/gov-uk/styles/modules/_alerts.scss +0 -73
  185. package/package/frontend/themes/gov-uk/styles/modules/_buttons.scss +0 -5
  186. package/package/frontend/themes/gov-uk/styles/modules/_character-count.scss +0 -8
  187. package/package/frontend/themes/gov-uk/styles/modules/_confirm-page.scss +0 -20
  188. package/package/frontend/themes/gov-uk/styles/modules/_lists.scss +0 -5
  189. package/package/frontend/themes/gov-uk/styles/modules/_progressive-reveal.scss +0 -17
  190. package/package/frontend/themes/gov-uk/styles/modules/_validation.scss +0 -51
  191. package/package/frontend/themes/index.js +0 -5
  192. package/package/frontend/toolkit/assets/images/passports/new-window-link-blue.png +0 -0
  193. package/package/frontend/toolkit/assets/images/passports/new-window-link.png +0 -0
  194. package/package/frontend/toolkit/assets/images/spinner.gif +0 -0
  195. package/package/frontend/toolkit/assets/javascript/character-count.js +0 -99
  196. package/package/frontend/toolkit/assets/javascript/form-focus.js +0 -101
  197. package/package/frontend/toolkit/assets/javascript/helpers.js +0 -177
  198. package/package/frontend/toolkit/assets/javascript/progressive-reveal.js +0 -72
  199. package/package/frontend/toolkit/assets/javascript/validation.js +0 -71
  200. package/package/frontend/toolkit/assets/javascript/vendor/details.polyfill.js +0 -189
  201. package/package/frontend/toolkit/assets/javascript/vendor/indexof.polyfill.js +0 -39
  202. package/package/frontend/toolkit/assets/javascript/vendor/safari-cachebuster.js +0 -6
  203. package/package/frontend/toolkit/assets/stylesheets/_base.scss +0 -17
  204. package/package/frontend/toolkit/assets/stylesheets/_helpers.scss +0 -5
  205. package/package/frontend/toolkit/assets/stylesheets/_layout.scss +0 -118
  206. package/package/frontend/toolkit/assets/stylesheets/_typography.scss +0 -27
  207. package/package/frontend/toolkit/assets/stylesheets/_variables.scss +0 -11
  208. package/package/frontend/toolkit/assets/stylesheets/app.scss +0 -30
  209. package/package/frontend/toolkit/assets/stylesheets/govuk-elements/_buttons.scss +0 -47
  210. package/package/frontend/toolkit/assets/stylesheets/govuk-elements/_details.scss +0 -38
  211. package/package/frontend/toolkit/assets/stylesheets/govuk-elements/_elements-typography.scss +0 -175
  212. package/package/frontend/toolkit/assets/stylesheets/govuk-elements/_forms.scss +0 -167
  213. package/package/frontend/toolkit/assets/stylesheets/govuk-elements/_helpers.scss +0 -39
  214. package/package/frontend/toolkit/assets/stylesheets/govuk-elements/_layout.scss +0 -67
  215. package/package/frontend/toolkit/assets/stylesheets/govuk-elements/_lists.scss +0 -40
  216. package/package/frontend/toolkit/assets/stylesheets/govuk-elements/_panels.scss +0 -29
  217. package/package/frontend/toolkit/assets/stylesheets/govuk-elements/_reset.scss +0 -33
  218. package/package/frontend/toolkit/assets/stylesheets/govuk-elements/_tables.scss +0 -33
  219. package/package/frontend/toolkit/assets/stylesheets/govuk-elements/forms/_form-block-labels.scss +0 -63
  220. package/package/frontend/toolkit/assets/stylesheets/govuk-elements/forms/_form-date.scss +0 -39
  221. package/package/frontend/toolkit/assets/stylesheets/govuk-elements/forms/_form-validation.scss +0 -63
  222. package/package/frontend/toolkit/assets/stylesheets/mixins.scss +0 -16
  223. package/package/frontend/toolkit/assets/stylesheets/modules/_alerts.scss +0 -73
  224. package/package/frontend/toolkit/assets/stylesheets/modules/_buttons.scss +0 -5
  225. package/package/frontend/toolkit/assets/stylesheets/modules/_confirm-page.scss +0 -20
  226. package/package/frontend/toolkit/assets/stylesheets/modules/_lists.scss +0 -5
  227. package/package/frontend/toolkit/assets/stylesheets/modules/_progressive-reveal.scss +0 -17
  228. package/package/frontend/toolkit/assets/stylesheets/modules/_validation.scss +0 -51
  229. package/package/frontend/toolkit/index.js +0 -10
  230. package/package/index.js +0 -351
  231. package/package/lib/deindex.js +0 -18
  232. package/package/lib/encryption.js +0 -23
  233. package/package/lib/ga-tag.js +0 -89
  234. package/package/lib/health.js +0 -26
  235. package/package/lib/helpers.js +0 -66
  236. package/package/lib/logger.js +0 -65
  237. package/package/lib/markdown.js +0 -46
  238. package/package/lib/router.js +0 -111
  239. package/package/lib/serve-static.js +0 -12
  240. package/package/lib/sessions.js +0 -82
  241. package/package/lib/settings.js +0 -74
  242. package/package/lib/which.js +0 -28
  243. package/package/middleware/cookies.js +0 -43
  244. package/package/middleware/deep-translate.js +0 -32
  245. package/package/middleware/errors.js +0 -119
  246. package/package/middleware/index.js +0 -10
  247. package/package/middleware/not-found.js +0 -38
  248. package/package/middleware/rate-limiter.js +0 -98
  249. package/package/middleware/service-unavailable.js +0 -64
  250. package/package/model/apis/axios-settings.js +0 -21
  251. package/package/model/apis/html-to-pdf-converter.js +0 -35
  252. package/package/model/apis/index.js +0 -5
  253. package/package/model/index.js +0 -348
  254. package/package/package.json +0 -147
  255. package/package/sandbox/README.md +0 -66
  256. package/package/sandbox/apps/sandbox/behaviours/clear-session.js +0 -8
  257. package/package/sandbox/apps/sandbox/behaviours/country-select.js +0 -10
  258. package/package/sandbox/apps/sandbox/behaviours/international-number.js +0 -22
  259. package/package/sandbox/apps/sandbox/fields.js +0 -128
  260. package/package/sandbox/apps/sandbox/index.js +0 -99
  261. package/package/sandbox/apps/sandbox/lib/staticAppealStages.js +0 -189
  262. package/package/sandbox/apps/sandbox/sections/summary-data-sections.js +0 -43
  263. package/package/sandbox/apps/sandbox/translations/src/en/errors.json +0 -5
  264. package/package/sandbox/apps/sandbox/translations/src/en/exit.json +0 -4
  265. package/package/sandbox/apps/sandbox/translations/src/en/fields.json +0 -101
  266. package/package/sandbox/apps/sandbox/translations/src/en/journey.json +0 -7
  267. package/package/sandbox/apps/sandbox/translations/src/en/pages.json +0 -72
  268. package/package/sandbox/apps/sandbox/translations/src/en/validation.json +0 -54
  269. package/package/sandbox/apps/sandbox/views/form-guidance-link.html +0 -8
  270. package/package/sandbox/apps/sandbox/views/save-and-exit.html +0 -19
  271. package/package/sandbox/assets/images/icons/icon-caret-left.png +0 -0
  272. package/package/sandbox/assets/images/icons/icon-complete.png +0 -0
  273. package/package/sandbox/assets/images/icons/icon-cross-remove-sign.png +0 -0
  274. package/package/sandbox/assets/js/index.js +0 -70
  275. package/package/sandbox/assets/scss/app.scss +0 -27
  276. package/package/sandbox/codecept.conf.js +0 -15
  277. package/package/sandbox/config.js +0 -17
  278. package/package/sandbox/package.json +0 -26
  279. package/package/sandbox/server.js +0 -23
  280. package/package/sandbox/yarn.lock +0 -262
  281. package/package/transpiler/index.js +0 -2
  282. package/package/transpiler/lib/aggregate.js +0 -32
  283. package/package/transpiler/lib/build.js +0 -15
  284. package/package/transpiler/lib/compile.js +0 -12
  285. package/package/transpiler/lib/expand-dirs.js +0 -14
  286. package/package/transpiler/lib/write-files.js +0 -24
  287. package/package/utilities/autofill/index.js +0 -189
  288. package/package/utilities/autofill/inputs.js +0 -60
  289. package/package/utilities/countries.js +0 -12
  290. package/package/utilities/helpers/index.js +0 -189
  291. package/package/utilities/index.js +0 -9
  292. package/package/utilities/reqres/index.js +0 -18
  293. package/package/utilities/test-data/data/domain.json +0 -7
  294. package/package/utilities/test-data/data/firstname.json +0 -16
  295. package/package/utilities/test-data/data/lastname.json +0 -10
  296. package/package/utilities/test-data/data/postcode.json +0 -12
  297. package/package/utilities/test-data/data/streetname.json +0 -8
  298. package/package/utilities/test-data/data/streetsuffix.json +0 -7
  299. package/package/utilities/test-data/data/town.json +0 -9
  300. package/package/utilities/test-data/index.js +0 -67
  301. package/package/wizard/behaviours/complete.js +0 -20
  302. package/package/wizard/behaviours/index.js +0 -5
  303. package/package/wizard/index.js +0 -124
  304. package/package/wizard/middleware/back-links.js +0 -68
  305. package/package/wizard/middleware/check-complete.js +0 -13
  306. package/package/wizard/middleware/check-progress.js +0 -139
  307. package/package/wizard/middleware/check-session.js +0 -17
  308. package/package/wizard/middleware/csrf.js +0 -47
  309. package/package/wizard/middleware/session-model.js +0 -11
  310. package/package/wizard/middleware/session.js +0 -9
  311. package/package/wizard/model.js +0 -29
  312. package/package/wizard/util/constants.js +0 -5
  313. package/package/wizard/util/helpers.js +0 -19
@@ -1,14 +0,0 @@
1
- 'use strict';
2
-
3
- module.exports = class ValidationError {
4
- constructor(key, opts) {
5
- const options = Object.assign({
6
- type: 'default',
7
- arguments: []
8
- }, opts);
9
- this.key = key;
10
- this.type = options.type;
11
- this.redirect = options.redirect;
12
- this.arguments = options.arguments.filter(a => a);
13
- }
14
- };
@@ -1,24 +0,0 @@
1
- 'use strict';
2
- /* eslint max-len: 0 */
3
- module.exports = {
4
- htmlLang: '{{htmlLang}}',
5
- assetPath: '{{govukAssetPath}}',
6
- afterHeader: '{{$afterHeader}}{{/afterHeader}}',
7
- bodyClasses: '{{$bodyClasses}}{{/bodyClasses}}',
8
- bodyStart: '{{$bodyStart}}{{/bodyStart}}',
9
- bodyEnd: '{{$bodyEnd}}{{/bodyEnd}}',
10
- content: '{{$main}}{{/main}}',
11
- cookieMessage: '{{$cookieMessage}}{{/cookieMessage}}',
12
- footerSupportLinks: '{{$footerSupportLinks}}{{/footerSupportLinks}}',
13
- footerTop: '{{$footerTop}}{{/footerTop}}',
14
- head: '{{$head}}{{/head}}',
15
- headerClass: '{{$headerClass}}{{/headerClass}}',
16
- homepageUrl: '{{$homepageUrl}}https://www.gov.uk{{/homepageUrl}}',
17
- logoLinkTitle: '{{$logoLinkTitle}}Go to the GOV.UK homepage{{/logoLinkTitle}}',
18
- insideHeader: '{{$insideHeader}}{{/insideHeader}}',
19
- pageTitle: '{{$pageTitle}}{{/pageTitle}}',
20
- propositionHeader: '{{$propositionHeader}}{{/propositionHeader}}',
21
- globalHeaderText: '{{$globalHeaderText}}GOV.UK{{/globalHeaderText}}',
22
- licenceMessage: '{{$licenceMessage}}All content is available under the <a href="https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/" id="open-government-licence" class="govuk-footer__link" target="_blank" rel="license">Open Government Licence v3.0</a>, except where otherwise stated{{/licenceMessage}}',
23
- crownCopyrightMessage: '{{$crownCopyrightMessage}}© Crown copyright{{/crownCopyrightMessage}}'
24
- };
@@ -1,102 +0,0 @@
1
-
2
- <!DOCTYPE html>
3
- <!--[if lt IE 9]><html class="lte-ie8" lang="{{ htmlLang }}"><![endif]-->
4
- <!--[if gt IE 8]><!--><html lang="{{ htmlLang }}" class="govuk-template"><!--<![endif]-->
5
- <head>
6
- <meta charset="utf-8" />
7
- <title>{{ pageTitle }}</title>
8
- {{{ head }}}
9
-
10
- <link rel="shortcut icon" sizes="16x16 32x32 48x48" href="{{assetPath}}images/favicon.ico" type="image/x-icon">
11
- <link rel="mask-icon" href="{{assetPath}}images/govuk-mask-icon.svg" color="#0b0c0c">
12
- <link rel="apple-touch-icon" sizes="180x180" href="{{assetPath}}images/govuk-apple-touch-icon-180x180.png">
13
- <link rel="apple-touch-icon" sizes="167x167" href="{{assetPath}}images/govuk-apple-touch-icon-167x167.png">
14
- <link rel="apple-touch-icon" sizes="152x152" href="{{assetPath}}images/govuk-apple-touch-icon-152x152.png">
15
- <link rel="apple-touch-icon" href="{{assetPath}}images/govuk-apple-touch-icon.png">
16
-
17
-
18
- <meta name="theme-color" content="#0b0c0c" />
19
-
20
- <meta name="viewport" content="width=device-width, initial-scale=1">
21
-
22
-
23
- <meta property="og:image" content="{{assetPath}}images/opengraph-image.png">
24
- </head>
25
-
26
- <body class="{{ bodyClasses }} govuk-template__body js-enabled" >
27
- <script>document.body.className = ((document.body.className) ? document.body.className + ' js-enabled' : 'js-enabled');</script>
28
-
29
-
30
-
31
- <div id="global-cookie-message" class="gem-c-cookie-banner govuk-clearfix" data-module="cookie-banner" role="region" aria-label="cookie banner" data-nosnippet="">
32
- {{{ cookieMessage }}}
33
- </div>
34
-
35
- {{{ bodyStart }}}
36
-
37
- <header role="banner" id="govuk-header" class="{{{ headerClass }}}">
38
- <div class="govuk-header__container govuk-width-container">
39
-
40
- <div class="govuk-header__logo">
41
- <a href="{{{ homepageUrl }}}" title="{{ logoLinkTitle }}" id="logo" class="govuk-header__link govuk-header__link--homepage" target="_blank" data-module="track-click" data-track-category="homeLinkClicked" data-track-action="homeHeader">
42
- <span class="govuk-header__logotype">
43
- <!--[if gt IE 8]><!-->
44
- <svg aria-hidden="true" focusable="false" class="govuk-header__logotype-crown" xmlns="http://www.w3.org/2000/svg\" viewBox="0 0 32 30" height="30" width="32">
45
- <path fill="currentColor" fill-rule="evenodd" d="M22.6 10.4c-1 .4-2-.1-2.4-1-.4-.9.1-2 1-2.4.9-.4 2 .1 2.4 1s-.1 2-1 2.4m-5.9 6.7c-.9.4-2-.1-2.4-1-.4-.9.1-2 1-2.4.9-.4 2 .1 2.4 1s-.1 2-1 2.4m10.8-3.7c-1 .4-2-.1-2.4-1-.4-.9.1-2 1-2.4.9-.4 2 .1 2.4 1s0 2-1 2.4m3.3 4.8c-1 .4-2-.1-2.4-1-.4-.9.1-2 1-2.4.9-.4 2 .1 2.4 1s-.1 2-1 2.4M17 4.7l2.3 1.2V2.5l-2.3.7-.2-.2.9-3h-3.4l.9 3-.2.2c-.1.1-2.3-.7-2.3-.7v3.4L15 4.7c.1.1.1.2.2.2l-1.3 4c-.1.2-.1.4-.1.6 0 1.1.8 2 1.9 2.2h.7c1-.2 1.9-1.1 1.9-2.1 0-.2 0-.4-.1-.6l-1.3-4c-.1-.2 0-.2.1-.3m-7.6 5.7c.9.4 2-.1 2.4-1 .4-.9-.1-2-1-2.4-.9-.4-2 .1-2.4 1s0 2 1 2.4m-5 3c.9.4 2-.1 2.4-1 .4-.9-.1-2-1-2.4-.9-.4-2 .1-2.4 1s.1 2 1 2.4m-3.2 4.8c.9.4 2-.1 2.4-1 .4-.9-.1-2-1-2.4-.9-.4-2 .1-2.4 1s0 2 1 2.4m14.8 11c4.4 0 8.6.3 12.3.8 1.1-4.5 2.4-7 3.7-8.8l-2.5-.9c.2 1.3.3 1.9 0 2.7-.4-.4-.8-1.1-1.1-2.3l-1.2 4c.7-.5 1.3-.8 2-.9-1.1 2.5-2.6 3.1-3.5 3-1.1-.2-1.7-1.2-1.5-2.1.3-1.2 1.5-1.5 2.1-.1 1.1-2.3-.8-3-2-2.3 1.9-1.9 2.1-3.5.6-5.6-2.1 1.6-2.1 3.2-1.2 5.5-1.2-1.4-3.2-.6-2.5 1.6.9-1.4 2.1-.5 1.9.8-.2 1.1-1.7 2.1-3.5 1.9-2.7-.2-2.9-2.1-2.9-3.6.7-.1 1.9.5 2.9 1.9l.4-4.3c-1.1 1.1-2.1 1.4-3.2 1.4.4-1.2 2.1-3 2.1-3h-5.4s1.7 1.9 2.1 3c-1.1 0-2.1-.2-3.2-1.4l.4 4.3c1-1.4 2.2-2 2.9-1.9-.1 1.5-.2 3.4-2.9 3.6-1.9.2-3.4-.8-3.5-1.9-.2-1.3 1-2.2 1.9-.8.7-2.3-1.2-3-2.5-1.6.9-2.2.9-3.9-1.2-5.5-1.5 2-1.3 3.7.6 5.6-1.2-.7-3.1 0-2 2.3.6-1.4 1.8-1.1 2.1.1.2.9-.3 1.9-1.5 2.1-.9.2-2.4-.5-3.5-3 .6 0 1.2.3 2 .9l-1.2-4c-.3 1.1-.7 1.9-1.1 2.3-.3-.8-.2-1.4 0-2.7l-2.9.9C1.3 23 2.6 25.5 3.7 30c3.7-.5 7.9-.8 12.3-.8"></path>
46
- </svg>
47
- <!--<![endif]-->
48
- <!--[if IE 8]>
49
- <img src="{{ assetPath }}images/govuk-logotype-tudor-crown.png" class="govuk-header__logotype-crown-fallback-image" width="32" height="30" alt="">
50
- <![endif]-->
51
- </span>
52
- <span class="govuk-header__logotype-text">
53
- {{{ globalHeaderText }}}
54
- </span>
55
- </a>
56
- </div>
57
- {{{ insideHeader }}}
58
-
59
- {{{ propositionHeader }}}
60
- </div>
61
- </header>
62
-
63
-
64
- {{{ afterHeader }}}
65
-
66
-
67
- {{{ content }}}
68
-
69
- <footer class="govuk-footer" id="footer" role="contentinfo">
70
-
71
- <div class="govuk-width-container">
72
- {{{ footerTop }}}
73
-
74
- <div class="govuk-footer__meta">
75
- <div class="govuk-footer__meta-item govuk-footer__meta-item--grow">
76
- <h2 class="govuk-visually-hidden">Support links</h2>
77
- {{{ footerSupportLinks }}}
78
-
79
- <svg aria-hidden="true" focusable="false" class="govuk-footer__licence-logo" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 483.2 195.7" height="17" width="41">
80
- <path fill="currentColor" d="M421.5 142.8V.1l-50.7 32.3v161.1h112.4v-50.7zm-122.3-9.6A47.12 47.12 0 0 1 221 97.8c0-26 21.1-47.1 47.1-47.1 16.7 0 31.4 8.7 39.7 21.8l42.7-27.2A97.63 97.63 0 0 0 268.1 0c-36.5 0-68.3 20.1-85.1 49.7A98 98 0 0 0 97.8 0C43.9 0 0 43.9 0 97.8s43.9 97.8 97.8 97.8c36.5 0 68.3-20.1 85.1-49.7a97.76 97.76 0 0 0 149.6 25.4l19.4 22.2h3v-87.8h-80l24.3 27.5zM97.8 145c-26 0-47.1-21.1-47.1-47.1s21.1-47.1 47.1-47.1 47.2 21 47.2 47S123.8 145 97.8 145"></path>
81
- </svg>
82
-
83
- <span class="govuk-footer__licence-description">{{{ licenceMessage }}}</span>
84
- </div>
85
-
86
- <div class="govuk-footer__meta-item">
87
- <a class="govuk-footer__link govuk-footer__copyright-logo" id="copyright-logo" target="_blank" href="https://www.nationalarchives.gov.uk/information-management/re-using-public-sector-information/uk-government-licensing-framework/crown-copyright/">{{{ crownCopyrightMessage }}}</a>
88
- </div>
89
- </div>
90
- </div>
91
- </footer>
92
-
93
- <div id="global-app-error" class="app-error hidden"></div>
94
-
95
-
96
- {{{ bodyEnd }}}
97
-
98
-
99
- <script {{#nonce}}nonce="{{nonce}}"{{/nonce}}>if (typeof window.GOVUK === 'undefined') document.body.className = document.body.className.replace('js-enabled', '');</script>
100
-
101
- </body>
102
- </html>
@@ -1,23 +0,0 @@
1
- 'use strict';
2
-
3
- const Hogan = require('hogan.js');
4
- const fs = require('fs');
5
- const path = require('path');
6
- const govukConfig = require('./config');
7
-
8
- function addNonceValueAttributeToInlineScripts(compiledTemplateString) {
9
- const scriptNonceValue = '{{#nonce}}nonce="{{nonce}}"{{/nonce}}';
10
- return compiledTemplateString.replace(/(<script)((?![^>]+src).*?)>/g,
11
- `$1$2 ${scriptNonceValue}>`);
12
- }
13
-
14
- module.exports = () => {
15
- const template = require.resolve('./govuk_template.html');
16
-
17
- const govukTemplate = fs.readFileSync(template, { encoding: 'utf-8' });
18
- const compiledTemplate = Hogan.compile(govukTemplate).render(govukConfig);
19
- const parsedTemplate = addNonceValueAttributeToInlineScripts(compiledTemplate);
20
- const output = path.resolve(__dirname, '../govuk_template_generated.html');
21
-
22
- fs.writeFileSync(output, parsedTemplate, { encoding: 'utf-8' });
23
- };
@@ -1,102 +0,0 @@
1
-
2
- <!DOCTYPE html>
3
- <!--[if lt IE 9]><html class="lte-ie8" lang="{{htmlLang}}"><![endif]-->
4
- <!--[if gt IE 8]><!--><html lang="{{htmlLang}}" class="govuk-template"><!--<![endif]-->
5
- <head>
6
- <meta charset="utf-8" />
7
- <title>{{$pageTitle}}{{/pageTitle}}</title>
8
- {{$head}}{{/head}}
9
-
10
- <link rel="shortcut icon" sizes="16x16 32x32 48x48" href="{{govukAssetPath}}images/favicon.ico" type="image/x-icon">
11
- <link rel="mask-icon" href="{{govukAssetPath}}images/govuk-mask-icon.svg" color="#0b0c0c">
12
- <link rel="apple-touch-icon" sizes="180x180" href="{{govukAssetPath}}images/govuk-apple-touch-icon-180x180.png">
13
- <link rel="apple-touch-icon" sizes="167x167" href="{{govukAssetPath}}images/govuk-apple-touch-icon-167x167.png">
14
- <link rel="apple-touch-icon" sizes="152x152" href="{{govukAssetPath}}images/govuk-apple-touch-icon-152x152.png">
15
- <link rel="apple-touch-icon" href="{{govukAssetPath}}images/govuk-apple-touch-icon.png">
16
-
17
-
18
- <meta name="theme-color" content="#0b0c0c" />
19
-
20
- <meta name="viewport" content="width=device-width, initial-scale=1">
21
-
22
-
23
- <meta property="og:image" content="{{govukAssetPath}}images/opengraph-image.png">
24
- </head>
25
-
26
- <body class="{{$bodyClasses}}{{/bodyClasses}} govuk-template__body js-enabled" >
27
- <script {{#nonce}}nonce="{{nonce}}"{{/nonce}}>document.body.className = ((document.body.className) ? document.body.className + ' js-enabled' : 'js-enabled');</script>
28
-
29
-
30
-
31
- <div id="global-cookie-message" class="gem-c-cookie-banner govuk-clearfix" data-module="cookie-banner" role="region" aria-label="cookie banner" data-nosnippet="">
32
- {{$cookieMessage}}{{/cookieMessage}}
33
- </div>
34
-
35
- {{$bodyStart}}{{/bodyStart}}
36
-
37
- <header role="banner" id="govuk-header" class="{{$headerClass}}{{/headerClass}}">
38
- <div class="govuk-header__container govuk-width-container">
39
-
40
- <div class="govuk-header__logo">
41
- <a href="{{$homepageUrl}}https://www.gov.uk{{/homepageUrl}}" title="{{$logoLinkTitle}}Go to the GOV.UK homepage{{/logoLinkTitle}}" id="logo" class="govuk-header__link govuk-header__link--homepage" target="_blank" data-module="track-click" data-track-category="homeLinkClicked" data-track-action="homeHeader">
42
- <span class="govuk-header__logotype">
43
- <!--[if gt IE 8]><!-->
44
- <svg aria-hidden="true" focusable="false" class="govuk-header__logotype-crown" xmlns="http://www.w3.org/2000/svg\" viewBox="0 0 32 30" height="30" width="32">
45
- <path fill="currentColor" fill-rule="evenodd" d="M22.6 10.4c-1 .4-2-.1-2.4-1-.4-.9.1-2 1-2.4.9-.4 2 .1 2.4 1s-.1 2-1 2.4m-5.9 6.7c-.9.4-2-.1-2.4-1-.4-.9.1-2 1-2.4.9-.4 2 .1 2.4 1s-.1 2-1 2.4m10.8-3.7c-1 .4-2-.1-2.4-1-.4-.9.1-2 1-2.4.9-.4 2 .1 2.4 1s0 2-1 2.4m3.3 4.8c-1 .4-2-.1-2.4-1-.4-.9.1-2 1-2.4.9-.4 2 .1 2.4 1s-.1 2-1 2.4M17 4.7l2.3 1.2V2.5l-2.3.7-.2-.2.9-3h-3.4l.9 3-.2.2c-.1.1-2.3-.7-2.3-.7v3.4L15 4.7c.1.1.1.2.2.2l-1.3 4c-.1.2-.1.4-.1.6 0 1.1.8 2 1.9 2.2h.7c1-.2 1.9-1.1 1.9-2.1 0-.2 0-.4-.1-.6l-1.3-4c-.1-.2 0-.2.1-.3m-7.6 5.7c.9.4 2-.1 2.4-1 .4-.9-.1-2-1-2.4-.9-.4-2 .1-2.4 1s0 2 1 2.4m-5 3c.9.4 2-.1 2.4-1 .4-.9-.1-2-1-2.4-.9-.4-2 .1-2.4 1s.1 2 1 2.4m-3.2 4.8c.9.4 2-.1 2.4-1 .4-.9-.1-2-1-2.4-.9-.4-2 .1-2.4 1s0 2 1 2.4m14.8 11c4.4 0 8.6.3 12.3.8 1.1-4.5 2.4-7 3.7-8.8l-2.5-.9c.2 1.3.3 1.9 0 2.7-.4-.4-.8-1.1-1.1-2.3l-1.2 4c.7-.5 1.3-.8 2-.9-1.1 2.5-2.6 3.1-3.5 3-1.1-.2-1.7-1.2-1.5-2.1.3-1.2 1.5-1.5 2.1-.1 1.1-2.3-.8-3-2-2.3 1.9-1.9 2.1-3.5.6-5.6-2.1 1.6-2.1 3.2-1.2 5.5-1.2-1.4-3.2-.6-2.5 1.6.9-1.4 2.1-.5 1.9.8-.2 1.1-1.7 2.1-3.5 1.9-2.7-.2-2.9-2.1-2.9-3.6.7-.1 1.9.5 2.9 1.9l.4-4.3c-1.1 1.1-2.1 1.4-3.2 1.4.4-1.2 2.1-3 2.1-3h-5.4s1.7 1.9 2.1 3c-1.1 0-2.1-.2-3.2-1.4l.4 4.3c1-1.4 2.2-2 2.9-1.9-.1 1.5-.2 3.4-2.9 3.6-1.9.2-3.4-.8-3.5-1.9-.2-1.3 1-2.2 1.9-.8.7-2.3-1.2-3-2.5-1.6.9-2.2.9-3.9-1.2-5.5-1.5 2-1.3 3.7.6 5.6-1.2-.7-3.1 0-2 2.3.6-1.4 1.8-1.1 2.1.1.2.9-.3 1.9-1.5 2.1-.9.2-2.4-.5-3.5-3 .6 0 1.2.3 2 .9l-1.2-4c-.3 1.1-.7 1.9-1.1 2.3-.3-.8-.2-1.4 0-2.7l-2.9.9C1.3 23 2.6 25.5 3.7 30c3.7-.5 7.9-.8 12.3-.8"></path>
46
- </svg>
47
- <!--<![endif]-->
48
- <!--[if IE 8]>
49
- <img src="{{govukAssetPath}}images/govuk-logotype-tudor-crown.png" class="govuk-header__logotype-crown-fallback-image" width="32" height="30" alt="">
50
- <![endif]-->
51
- </span>
52
- <span class="govuk-header__logotype-text">
53
- {{$globalHeaderText}}GOV.UK{{/globalHeaderText}}
54
- </span>
55
- </a>
56
- </div>
57
- {{$insideHeader}}{{/insideHeader}}
58
-
59
- {{$propositionHeader}}{{/propositionHeader}}
60
- </div>
61
- </header>
62
-
63
-
64
- {{$afterHeader}}{{/afterHeader}}
65
-
66
-
67
- {{$main}}{{/main}}
68
-
69
- <footer class="govuk-footer" id="footer" role="contentinfo">
70
-
71
- <div class="govuk-width-container">
72
- {{$footerTop}}{{/footerTop}}
73
-
74
- <div class="govuk-footer__meta">
75
- <div class="govuk-footer__meta-item govuk-footer__meta-item--grow">
76
- <h2 class="govuk-visually-hidden">Support links</h2>
77
- {{$footerSupportLinks}}{{/footerSupportLinks}}
78
-
79
- <svg aria-hidden="true" focusable="false" class="govuk-footer__licence-logo" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 483.2 195.7" height="17" width="41">
80
- <path fill="currentColor" d="M421.5 142.8V.1l-50.7 32.3v161.1h112.4v-50.7zm-122.3-9.6A47.12 47.12 0 0 1 221 97.8c0-26 21.1-47.1 47.1-47.1 16.7 0 31.4 8.7 39.7 21.8l42.7-27.2A97.63 97.63 0 0 0 268.1 0c-36.5 0-68.3 20.1-85.1 49.7A98 98 0 0 0 97.8 0C43.9 0 0 43.9 0 97.8s43.9 97.8 97.8 97.8c36.5 0 68.3-20.1 85.1-49.7a97.76 97.76 0 0 0 149.6 25.4l19.4 22.2h3v-87.8h-80l24.3 27.5zM97.8 145c-26 0-47.1-21.1-47.1-47.1s21.1-47.1 47.1-47.1 47.2 21 47.2 47S123.8 145 97.8 145"></path>
81
- </svg>
82
-
83
- <span class="govuk-footer__licence-description">{{$licenceMessage}}All content is available under the <a href="https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/" id="open-government-licence" class="govuk-footer__link" target="_blank" rel="license">Open Government Licence v3.0</a>, except where otherwise stated{{/licenceMessage}}</span>
84
- </div>
85
-
86
- <div class="govuk-footer__meta-item">
87
- <a class="govuk-footer__link govuk-footer__copyright-logo" id="copyright-logo" target="_blank" href="https://www.nationalarchives.gov.uk/information-management/re-using-public-sector-information/uk-government-licensing-framework/crown-copyright/">{{$crownCopyrightMessage}}© Crown copyright{{/crownCopyrightMessage}}</a>
88
- </div>
89
- </div>
90
- </div>
91
- </footer>
92
-
93
- <div id="global-app-error" class="app-error hidden"></div>
94
-
95
-
96
- {{$bodyEnd}}{{/bodyEnd}}
97
-
98
-
99
- <script {{#nonce}}nonce="{{nonce}}"{{/nonce}}>if (typeof window.GOVUK === 'undefined') document.body.className = document.body.className.replace('js-enabled', '');</script>
100
-
101
- </body>
102
- </html>
@@ -1,29 +0,0 @@
1
- 'use strict';
2
-
3
- const path = require('path');
4
- const servestatic = require('serve-static');
5
- const Router = require('express').Router;
6
- const buildTemplateLayout = require('./build');
7
-
8
- const basedir = path.dirname(require.resolve('govuk-frontend/package.json'));
9
-
10
- const setup = (opts, router) => {
11
- buildTemplateLayout();
12
- const options = opts || {};
13
- options.path = options.path || '/assets';
14
-
15
- router.use(options.path, servestatic(path.join(basedir, './govuk/assets'), options));
16
- router.use((req, res, next) => {
17
- res.locals.govukAssetPath = req.baseUrl + options.path + '/';
18
- res.locals.partials = res.locals.partials || {};
19
- res.locals.partials['govuk-template'] = path.resolve(__dirname, './govuk_template_generated');
20
- next();
21
- });
22
-
23
- return router;
24
- };
25
-
26
- module.exports = (options, app) => {
27
- const router = app || new Router();
28
- return setup(options, router);
29
- };
@@ -1,9 +0,0 @@
1
- 'use strict';
2
-
3
- module.exports = {
4
- govUKTemplate: require('./govuk-template'),
5
- mixins: require('./template-mixins/mixins'),
6
- partials: require('./template-partials'),
7
- themes: require('./themes'),
8
- toolkit: require('./toolkit')
9
- };
@@ -1,103 +0,0 @@
1
- /* eslint-disable no-param-reassign */
2
- 'use strict';
3
-
4
- const querystring = require('querystring');
5
- const path = require('path');
6
- const moment = require('moment');
7
-
8
- const renderer = require('./render');
9
-
10
- module.exports = options => (req, res, next) => {
11
- const hoganRender = renderer(res);
12
-
13
- const t = function (key) {
14
- return hoganRender(req.translate(options.sharedTranslationsKey + key), this);
15
- };
16
-
17
- res.locals.currency = function () {
18
- return function (txt) {
19
- txt = hoganRender(txt, this);
20
- let value = parseFloat(txt);
21
- if (isNaN(value)) {
22
- return txt;
23
- } else if (value % 1 === 0) {
24
- value = value.toString();
25
- } else {
26
- value = value.toFixed(2);
27
- }
28
- return '£' + value;
29
- };
30
- };
31
-
32
- res.locals.date = function () {
33
- return function (txt) {
34
- txt = (txt || '').split('|');
35
- const value = hoganRender(txt[0], this);
36
- return moment(value).format(txt[1] || 'D MMMM YYYY');
37
- };
38
- };
39
-
40
- res.locals.hyphenate = function () {
41
- return function (txt) {
42
- const value = hoganRender(txt, this);
43
- return value.trim().toLowerCase().replace(/\s+/g, '-');
44
- };
45
- };
46
-
47
- res.locals.uppercase = function () {
48
- return function (txt) {
49
- return hoganRender(txt, this).toUpperCase();
50
- };
51
- };
52
-
53
- res.locals.lowercase = function () {
54
- return function (txt) {
55
- return hoganRender(txt, this).toLowerCase();
56
- };
57
- };
58
-
59
- res.locals.selected = function () {
60
- return function (txt) {
61
- let val;
62
- const bits = txt.split('=');
63
- if (this.values && this.values[bits[0]] !== undefined) {
64
- val = this.values[bits[0]].toString();
65
- }
66
- return val === bits[1] ? ' checked="checked"' : '';
67
- };
68
- };
69
-
70
- /**
71
- * Use on whole sentences
72
- */
73
- res.locals.time = function () {
74
- return function (txt) {
75
- txt = hoganRender(txt, this);
76
- txt = txt.replace(/12:00am/i, 'midnight').replace(/^midnight/, 'Midnight');
77
- txt = txt.replace(/12:00pm/i, 'midday').replace(/^midday/, 'Midday');
78
- return txt;
79
- };
80
- };
81
-
82
- res.locals.t = function () {
83
- return function (txt) {
84
- txt = hoganRender(txt, this);
85
- return t.apply(req, [txt, this]);
86
- };
87
- };
88
-
89
- res.locals.url = function () {
90
- return function (url) {
91
- url = hoganRender(url, this);
92
- return req.baseUrl ? path.resolve(req.baseUrl, url) : url;
93
- };
94
- };
95
-
96
- res.locals.qs = function () {
97
- return function (query) {
98
- return '?' + querystring.stringify(Object.assign({}, req.query, querystring.parse(query)));
99
- };
100
- };
101
-
102
- next();
103
- };
@@ -1,37 +0,0 @@
1
- /* eslint-disable no-param-reassign, no-undef */
2
- 'use strict';
3
-
4
- const path = require('path');
5
- const express = require('express');
6
- const deprecate = require('deprecate');
7
-
8
- const mixins = require('./template-mixins');
9
- const helpers = require('./helpers');
10
-
11
- module.exports = (options, deprecated) => {
12
- if (arguments.length === 2) {
13
- deprecate([
14
- 'hof-template-mixins: Passing field config to mixins is deprecated',
15
- 'hof-template-mixins: Field config will be loaded from res.locals.options.fields'
16
- ]);
17
- options = deprecated;
18
- }
19
-
20
- options = options || {};
21
- options.fields = options.fields || {};
22
-
23
- options.viewsDirectory = options.viewsDirectory || path.resolve(__dirname, '../');
24
- options.viewEngine = options.viewEngine || 'html';
25
- options.sharedTranslationsKey = options.sharedTranslationsKey || '';
26
-
27
- if (options.sharedTranslationsKey && !options.sharedTranslationsKey.match(/\.$/)) {
28
- options.sharedTranslationsKey += '.';
29
- }
30
-
31
- const router = express.Router();
32
-
33
- router.use(mixins(options));
34
- router.use(helpers(options));
35
-
36
- return router;
37
- };
@@ -1,12 +0,0 @@
1
- /* eslint-disable no-param-reassign */
2
- 'use strict';
3
-
4
- const Hogan = require('hogan.js');
5
-
6
- module.exports = res => (text, ctx) => {
7
- if (!text) {
8
- return '';
9
- }
10
- ctx = Object.assign({}, res.locals, ctx);
11
- return Hogan.compile(text).render(ctx);
12
- };