hof 19.14.2 → 20.0.0-beta.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. package/.nyc_output/65af88d9-aebe-4d1b-a21d-6fbf7f2bbda4.json +1 -0
  2. package/.nyc_output/processinfo/65af88d9-aebe-4d1b-a21d-6fbf7f2bbda4.json +1 -0
  3. package/.nyc_output/processinfo/index.json +1 -0
  4. package/.vscode/settings.json +6 -0
  5. package/components/date/index.js +26 -35
  6. package/components/date/templates/date.html +15 -12
  7. package/components/emailer/index.js +41 -49
  8. package/components/summary/index.js +0 -18
  9. package/config/hof-defaults.js +2 -4
  10. package/controller/base-controller.js +8 -26
  11. package/controller/controller.js +45 -2
  12. package/frontend/govuk-template/build/config.js +3 -3
  13. package/frontend/govuk-template/build/govuk_template.html +104 -0
  14. package/frontend/govuk-template/build/index.js +2 -2
  15. package/frontend/govuk-template/govuk_template_generated.html +104 -0
  16. package/frontend/govuk-template/index.js +4 -4
  17. package/frontend/template-mixins/mixins/template-mixins.js +20 -9
  18. package/frontend/template-mixins/partials/forms/checkbox-group.html +38 -0
  19. package/frontend/template-mixins/partials/forms/checkbox.html +4 -4
  20. package/frontend/template-mixins/partials/forms/input-submit.html +1 -1
  21. package/frontend/template-mixins/partials/forms/input-text-date.html +37 -0
  22. package/frontend/template-mixins/partials/forms/input-text-group.html +12 -9
  23. package/frontend/template-mixins/partials/forms/option-group.html +33 -26
  24. package/frontend/template-mixins/partials/forms/select.html +10 -5
  25. package/frontend/template-mixins/partials/forms/textarea-group.html +15 -6
  26. package/frontend/template-mixins/partials/mixins/panel.html +4 -4
  27. package/frontend/template-partials/translations/src/en/errors.json +0 -12
  28. package/frontend/template-partials/views/accessibility.html +4 -4
  29. package/frontend/template-partials/views/cookies.html +1 -1
  30. package/frontend/template-partials/views/layout.html +22 -22
  31. package/frontend/template-partials/views/partials/back.html +1 -1
  32. package/frontend/template-partials/views/partials/bullet-list.html +1 -1
  33. package/frontend/template-partials/views/partials/confirmation-alert.html +4 -3
  34. package/frontend/template-partials/views/partials/continue.html +1 -1
  35. package/frontend/template-partials/views/partials/cookie-banner.html +27 -24
  36. package/frontend/template-partials/views/partials/cookie-settings-radio.html +6 -6
  37. package/frontend/template-partials/views/partials/external-link.html +1 -1
  38. package/frontend/template-partials/views/partials/form.html +1 -1
  39. package/frontend/template-partials/views/partials/maincontent-left.html +4 -4
  40. package/frontend/template-partials/views/partials/navigation.html +7 -6
  41. package/frontend/template-partials/views/partials/session-cookies-table.html +6 -6
  42. package/frontend/template-partials/views/partials/table.html +7 -7
  43. package/frontend/template-partials/views/partials/validation-list.html +2 -2
  44. package/frontend/template-partials/views/partials/validation-summary.html +14 -13
  45. package/frontend/template-partials/views/session-timeout.html +1 -1
  46. package/frontend/themes/gov-uk/client-js/cookieSettings.js +1 -1
  47. package/frontend/themes/gov-uk/client-js/govuk-cookies.js +122 -0
  48. package/frontend/themes/gov-uk/client-js/index.js +5 -0
  49. package/frontend/themes/gov-uk/client-js/skip-to-main.js +18 -0
  50. package/frontend/themes/gov-uk/styles/_cookie-banner.scss +51 -1
  51. package/frontend/themes/gov-uk/styles/modules/_validation.scss +3 -3
  52. package/frontend/toolkit/assets/javascript/character-count.js +4 -4
  53. package/frontend/toolkit/assets/stylesheets/modules/_validation.scss +3 -3
  54. package/index.js +5 -5
  55. package/lib/router.js +1 -2
  56. package/lib/settings.js +17 -2
  57. package/middleware/errors.js +0 -32
  58. package/middleware/index.js +1 -2
  59. package/package.json +7 -6
  60. package/sandbox/.env +1 -0
  61. package/sandbox/apps/sandbox/fields.js +24 -11
  62. package/sandbox/apps/sandbox/index.js +5 -1
  63. package/sandbox/apps/sandbox/translations/en/default.json +203 -0
  64. package/sandbox/apps/sandbox/translations/src/en/fields.json +9 -6
  65. package/sandbox/apps/sandbox/translations/src/en/journey.json +4 -1
  66. package/sandbox/apps/sandbox/translations/src/en/pages.json +2 -29
  67. package/sandbox/apps/sandbox/translations/src/en/validation.json +1 -1
  68. package/sandbox/assets/js/index.js +1 -1
  69. package/sandbox/assets/scss/app.scss +68 -16
  70. package/sandbox/package.json +4 -1
  71. package/sandbox/public/css/app.css +9444 -0
  72. package/sandbox/public/images/icons/icon-caret-left.png +0 -0
  73. package/sandbox/public/images/icons/icon-complete.png +0 -0
  74. package/sandbox/public/images/icons/icon-cross-remove-sign.png +0 -0
  75. package/sandbox/public/js/bundle.js +35644 -0
  76. package/sandbox/server.js +0 -5
  77. package/sandbox/yarn.lock +767 -0
  78. package/utilities/helpers/index.js +1 -16
  79. package/wizard/index.js +0 -1
  80. package/config/rate-limits.js +0 -20
  81. package/config/sanitisation-rules.js +0 -29
  82. package/frontend/govuk-template/govuk_template.html +0 -109
  83. package/frontend/template-partials/views/rate-limit-error.html +0 -10
  84. package/frontend/themes/gov-uk/views/partials/form.html +0 -9
  85. package/frontend/themes/gov-uk/views/partials/forms/option-group.html +0 -28
  86. package/frontend/themes/gov-uk/views/partials/mixins/panel.html +0 -3
  87. package/frontend/themes/gov-uk/views/partials/validation-summary.html +0 -24
  88. package/middleware/rate-limiter.js +0 -96
  89. package/sandbox/apps/sandbox/views/confirmation.html +0 -15
@@ -5,25 +5,32 @@
5
5
  {{$pageTitle}}
6
6
  {{#errorlist.length}}{{#t}}errorlist.prefix{{/t}}{{/errorlist.length}}{{$header}}{{/header}} – GOV.UK
7
7
  {{/pageTitle}}
8
- {{$headerClass}}with-proposition{{/headerClass}}
8
+ {{$bodyStart}}
9
+ <a href="#{{#skipToMain}}{{skipToMain}}{{/skipToMain}}{{^skipToMain}}main-content{{/skipToMain}}" class="govuk-skip-link" id="skip-to-main">Skip to main content</a>
10
+ {{/bodyStart}}
11
+ {{$headerClass}}govuk-header{{/headerClass}}
9
12
  {{$insideHeader}}{{/insideHeader}}
10
13
  {{$main}}
11
- <main class="main" role="main">
12
- <div class="phase-banner">
13
- <p>
14
- <strong class="phase-tag">{{#t}}journey.phase{{/t}}</strong>
15
- <span>This is a new service – your <a href="{{feedbackUrl}}{{^feedbackUrl}}https://eforms.homeoffice.gov.uk/outreach/feedback.ofml{{/feedbackUrl}}">feedback</a> will help us to improve it.</span>
16
- </p>
17
- </div>
14
+ <div class="govuk-width-container ">
15
+ {{#feedbackUrl}}
16
+ <div class="govuk-phase-banner">
17
+ <p class="govuk-phase-banner__content">
18
+ <strong class="govuk-tag govuk-phase-banner__content__tag">{{#t}}journey.phase{{/t}}</strong>
19
+ <span class="govuk-phase-banner__text">This is a new service – your <a href="{{feedbackUrl}}{{^feedbackUrl}}https://eforms.homeoffice.gov.uk/outreach/feedback.ofml{{/feedbackUrl}}" class="govuk-link" id="feedback-link" target="_blank">feedback</a> will help us to improve it.</span>
20
+ </p>
21
+ </div>
22
+ {{/feedbackUrl}}
18
23
  <span id="step">
19
24
  {{> partials-back}} <span>{{$step}}{{/step}}</span>
20
25
  </span>
21
- <div class="grid-row" id="content">
22
- {{> partials-maincontent-left}}
23
- </div>
26
+ <main class="govuk-main-wrapper govuk-main-wrapper--auto-spacing" id="main-content" role="main">
27
+ <div class="govuk-grid-row" id="gov-grid-row-content">
28
+ {{> partials-maincontent-left}}
29
+ </div>
30
+ </main>
24
31
  {{> partials-continue}}
25
32
  <script type="text/javascript" src="{{assetPath}}/js/bundle.js"></script>
26
- </main>
33
+ </div>
27
34
  {{/main}}
28
35
  {{$cookieMessage}}
29
36
  {{#gaTagId}}
@@ -37,16 +44,9 @@
37
44
  {{/gaTagId}}
38
45
  {{/cookieMessage}}
39
46
  {{$footerSupportLinks}}
40
- <ul>
41
- {{#footerSupportLinks}}
42
- <li><a href="{{path}}">{{#t}}{{property}}{{/t}}</a></li>
43
- {{/footerSupportLinks}}
44
- {{^footerSupportLinks}}
45
- <li><a href="/cookies">{{#t}}base.cookies{{/t}}</a></li>
46
- <li><a href="/terms-and-conditions">{{#t}}base.terms{{/t}}</a></li>
47
- <li><a href="/accessibility">{{#t}}base.accessibility{{/t}}</a></li>
48
- {{/footerSupportLinks}}
49
- </ul>
47
+ <li class="govuk-footer__inline-list-item"><a class="govuk-footer__link" href="/cookies">{{#t}}base.cookies{{/t}}</a></li>
48
+ <li class="govuk-footer__inline-list-item"><a class="govuk-footer__link" href="/accessibility">{{#t}}base.accessibility{{/t}}</a></li>
49
+ <li class="govuk-footer__inline-list-item"><a class="govuk-footer__link" href="/terms-and-conditions">{{#t}}base.terms{{/t}}</a></li>
50
50
  {{/footerSupportLinks}}
51
51
  {{$bodyEnd}}
52
52
  {{> partials-gatag}}
@@ -1,5 +1,5 @@
1
1
  {{$back}}
2
2
  {{#backLink}}
3
- <a class="link-back" href="{{#url}}{{backLink}}{{/url}}">{{#t}}buttons.back{{/t}}</a>
3
+ <a class="govuk-back-link" href="{{#url}}{{backLink}}{{/url}}">{{#t}}buttons.back{{/t}}</a>
4
4
  {{/backLink}}
5
5
  {{/back}}
@@ -1,4 +1,4 @@
1
- <ul class="list-bullet">
1
+ <ul class="govuk-list govuk-list--bullet">
2
2
  {{#items}}
3
3
  <li>
4
4
  {{.}}
@@ -1,5 +1,6 @@
1
- <div class="alert-complete" role="alert">
2
- <div class="alert-message">
3
- <h1>{{#t}}journey.confirmation.message{{/t}}</h1>
1
+ <div class="govuk-panel govuk-panel--confirmation" role="alert">
2
+ <h1 govuk-panel__title>{{#t}}journey.confirmation.message{{/t}}</h1>
3
+ <div class="govuk-panel__body">
4
+ {{#t}}journey.confirmation.details{{/t}}
4
5
  </div>
5
6
  </div>
@@ -1,5 +1,5 @@
1
1
  {{$continue}}
2
2
  {{#continueLink}}
3
- <a class="button" href="{{#url}}{{continueLink}}{{/url}}">{{#t}}buttons.continue{{/t}}</a>
3
+ <a class="govuk-button" href="{{#url}}{{continueLink}}{{/url}}">{{#t}}buttons.continue{{/t}}</a>
4
4
  {{/continueLink}}
5
5
  {{/continue}}
@@ -1,26 +1,29 @@
1
- <div id="cookie-banner" class="grid-row">
2
- <div id="cookie-banner-info" class="column-two-thirds">
3
- <h1 class="heading-medium js-enabled">Cookies on {{#appName}}{{appName}}{{/appName}}{{^appName}}this service{{/appName}}</h1>
4
- <p class="js-enabled">We use some essential cookies to make this website work.</p>
5
- <p class="js-enabled">We'd like to set additional cookies to understand how you use this service, remember your settings and improve government services.</p>
6
- <p class="js-enabled">We also use cookies set by other sites to help us deliver content from their services.</p>
7
- <!--Non-javascript fallback content-->
8
- <h1 class="heading-medium js-disabled">Tell us whether you accept cookies</h1>
9
- <p class="js-disabled">
10
- We use some essential cookies to make this website work.
11
- We'd like to set additional cookies to understand how you use GOV.UK, remember your settings and improve government services.
12
- We also use cookies set by other sites to help us deliver content from their services.
1
+ <div id="cookie-banner" class="govuk-cookie-banner gem-c-cookie-banner govuk-clearfix">
2
+ <div class="gem-c-cookie-banner__message govuk-cookie-banner__message govuk-width-container">
3
+ <div id="cookie-banner-info" class="govuk-grid-row">
4
+ <div class="govuk-grid-column-two-thirds">
5
+ <h2 class="govuk-cookie-banner__heading govuk-heading-m">Cookies on {{#appName}}{{appName}}{{/appName}}{{^appName}}this service{{/appName}}</h2>
6
+ <div class="govuk-cookie-banner__content">
7
+ <p class="govuk-body">We use some essential cookies to make this website work.</p>
8
+ <p class="govuk-body">We'd like to set additional cookies to understand how you use GOV.UK, remember your settings and improve government services.</p>
9
+ <p class="govuk-body">We also use cookies set by other sites to help us deliver content from their services.</p>
10
+ </div>
11
+ </div>
12
+ </div>
13
+ <div id="cookie-banner-actions" class="govuk-button-group">
14
+ <button id="accept-cookies-button" class="gem-c-button govuk-button" type="submit" data-module="gem-track-click" data-accept-cookies="true" data-track-category="cookieBanner" data-track-action="Cookie banner accepted" data-cookie-types="all">Accept additional cookies</button>
15
+
16
+ <button id="reject-cookies-button" class="gem-c-button govuk-button" type="submit" data-module="gem-track-click" data-reject-cookies="true" data-track-category="cookieBanner" data-track-action="Cookie banner rejected">Reject additional cookies</button>
17
+
18
+ <a class="govuk-link" href="/cookies">View cookies</a>
19
+ </div>
20
+ </div>
21
+ <div class="gem-c-cookie-banner__confirmation govuk-width-container" tabindex="0" hidden="" id="cookie-banner-submitted" >
22
+ <p class="gem-c-cookie-banner__confirmation-message" role="alert">
23
+ Your cookie preferences have been saved. You can <a class="govuk-link" data-module="gem-track-click" data-track-category="cookieBanner" data-track-action="Cookie banner settings clicked from confirmation" href="/student-help/cookies">change your cookie settings</a> at any time.
13
24
  </p>
14
- </div>
15
- <div id="cookie-banner-actions" class="column-two-thirds">
16
- <button id="accept-cookies-button" class="button js-enabled" type="button" aria-label="Yes, accept cookies that measure website usage">Accept additional cookies</button>
17
- <button id="reject-cookies-button" class="button js-enabled" type="button" aria-label="No, decline cookies that measure website usage">Reject additional cookies</button>
18
- <a href="/cookies" class="js-enabled">View cookies</a>
19
- <!--Non-javascript fallback content-->
20
- <a href="/cookies" role="button" class="button js-disabled">Set cookie preferences</a>
21
- </div>
22
- <div id="cookie-banner-submitted" tabindex="-1">
23
- <p>Your cookie preferences have been saved. You can <a href="/cookies">change your cookie settings</a> at any time.</p>
24
- <button id="hide-cookie-banner" class="button" type="button" aria-label="Hide cookie banner">Hide</button>
25
- </div>
25
+ <div class="govuk-button-group">
26
+ <button class="gem-c-cookie-banner__hide-button govuk-button" id="hide-cookie-banner">Hide this message</button>
27
+ </div>
28
+ </div>
26
29
  </div>
@@ -1,8 +1,8 @@
1
- <div class="multiple-choice">
2
- <input id="radio-1" type="radio" name="radio-group" value="Use cookies that measure my website use">
3
- <label for="radio-1">Use cookies that measure my website use</label>
1
+ <div class="govuk-radios__item">
2
+ <input class="govuk-radios__input" id="radio-1" type="radio" name="radio-group" value="Use cookies that measure my website use">
3
+ <label class="govuk-label govuk-radios__label" for="radio-1">Use cookies that measure my website use</label>
4
4
  </div>
5
- <div class="multiple-choice">
6
- <input id="radio-2" type="radio" name="radio-group" value="Do not use cookies that measure my website use">
7
- <label for="radio-2">Do not use cookies that measure my website use</label>
5
+ <div class="govuk-radios__item">
6
+ <input class="govuk-radios__input" id="radio-2" type="radio" name="radio-group" value="Do not use cookies that measure my website use">
7
+ <label class="govuk-label govuk-radios__label" for="radio-2">Do not use cookies that measure my website use</label>
8
8
  </div>
@@ -1 +1 @@
1
- <p>{{before}}<a href="{{href}}" rel="external">{{link}}</a>{{after}}</p>
1
+ <p class="govuk-body">{{before}}<a class="govuk-link" href="{{href}}" rel="external">{{link}}</a>{{after}}</p>
@@ -1,6 +1,6 @@
1
1
  <form action="" method="POST" {{$encoding}}{{/encoding}} autocomplete="off" novalidate="true" spellcheck="false">
2
2
  {{$intro}}
3
- {{#intro}}<p class="form-block">{{intro}}</p>{{/intro}}
3
+ {{#intro}}<span class="govuk-hint" >{{intro}}</span>{{/intro}}
4
4
  {{/intro}}
5
5
  {{$form}}{{/form}}
6
6
  {{#csrf-token}}
@@ -1,10 +1,10 @@
1
1
  {{$content-outer}}
2
2
  {{$preloader}}{{/preloader}}
3
- <div class="column-two-thirds">
3
+ <div class="govuk-grid-column-two-thirds">
4
4
  {{$validationSummary}}{{/validationSummary}}
5
- <header>
6
- <h1>{{$header}}{{/header}}</h1>
7
- </header>
5
+ {{#captionHeading}}<span class="govuk-caption-l">{{captionHeading}}</span>{{/captionHeading}}
6
+ {{#header}}<h1 class="govuk-heading-xl">{{header}}</h1>{{/header}}
7
+ {{#subHeading}}<div id="page-header" class="govuk-heading-l">{{subHeading}}</div>{{/subHeading}}
8
8
  {{$content}}{{/content}}
9
9
  </div>
10
10
  {{/content-outer}}
@@ -1,7 +1,8 @@
1
- <div class="header-proposition">
2
- <div class="content">
3
- <nav id="proposition-menu">
4
- <a href="{{baseUrl}}" id="proposition-name">{{$journeyHeader}}{{/journeyHeader}}</a>
5
- </nav>
6
- </div>
1
+ <div class="govuk-header__content">
2
+ {{#startPageRedirectUrl}}
3
+ <a href="{{startPageRedirectUrl}}" class="govuk-header__link govuk-header__link--service-name" id="proposition-name">{{$journeyHeader}}{{/journeyHeader}}</a>
4
+ {{/startPageRedirectUrl}}
5
+ {{^startPageRedirectUrl}}
6
+ <a href="{{baseUrl}}" class="govuk-header__link govuk-header__link--service-name" id="proposition-name">{{$journeyHeader}}{{/journeyHeader}}</a>
7
+ {{/startPageRedirectUrl}}
7
8
  </div>
@@ -1,15 +1,15 @@
1
- <table>
2
- <thead>
3
- <tr>
1
+ <table class="govuk-table">
2
+ <thead class="govuk-table__head">
3
+ <tr class="govuk-table__row">
4
4
  {{#headers}}
5
- <th>{{.}}</th>
5
+ <th scope="col" class="govuk-table__header app-custom-class">{{.}}</th>
6
6
  {{/headers}}
7
7
  </tr>
8
8
  </thead>
9
9
  <tbody>
10
- <tr>
10
+ <tr class="govuk-table__row">
11
11
  {{#cookieName}}
12
- <td>{{cookieName}}</td>
12
+ <td scope="row" class="govuk-table__header">{{cookieName}}</td>
13
13
  {{/cookieName}}
14
14
  {{^cookieName}}
15
15
  <td>{{defaultCookieName}}</td>
@@ -1,16 +1,16 @@
1
- <table>
2
- <thead>
3
- <tr>
1
+ <table class="govuk-table">
2
+ <thead class="govuk-table__head">
3
+ <tr class="govuk-table__row">
4
4
  {{#headers}}
5
- <th>{{.}}</th>
5
+ <th scope="col" class="govuk-table__header app-custom-class">{{.}}</th>
6
6
  {{/headers}}
7
7
  </tr>
8
8
  </thead>
9
- <tbody>
9
+ <tbody class="govuk-table__body">
10
10
  {{#rows}}
11
- <tr>
11
+ <tr class="govuk-table__row">
12
12
  {{#.}}
13
- <td>{{.}}</td>
13
+ <td class="govuk-table__cell">{{.}}</td>
14
14
  {{/.}}
15
15
  </tr>
16
16
  {{/rows}}
@@ -1,3 +1,3 @@
1
- <ul>
2
- {{$validation-list}}{{/validation-list}}
1
+ <ul class="govuk-list govuk-error-summary__list">
2
+ {{$validation-list}}{{/validation-list}}
3
3
  </ul>
@@ -1,24 +1,25 @@
1
1
  {{#errorlist.length}}
2
- <div class="validation-summary" tabindex="-1">
2
+ <div class="govuk-error-summary" aria-labelledby="error-summary-title" data-module="govuk-error-summary" role="alert" tabindex="-1">
3
3
  {{$errorlist-title}}
4
4
 
5
5
  {{#errorLength.single}}
6
- <h2 id="error-summary-title">{{#t}}errorlist.title.single{{/t}}</h2>
6
+ <h2 class="govuk-error-summary__title" id="error-summary-title">{{#t}}errorlist.title.single{{/t}}</h2>
7
7
  {{/errorLength.single}}
8
8
  {{#errorLength.multiple}}
9
- <h2 id="error-summary-title">{{#t}}errorlist.title.multiple{{/t}}</h2>
9
+ <h2 class="govuk-error-summary__title" id="error-summary-title">{{#t}}errorlist.title.multiple{{/t}}</h2>
10
10
  {{/errorLength.multiple}}
11
11
 
12
12
  {{/errorlist-title}}
13
-
14
- {{<partials-validation-list}}
15
- {{$validation-list}}
16
- {{#errorlist}}
17
- {{#message}}
18
- <li><a href="#{{key}}">{{ message }}</a></li>
19
- {{/message}}
20
- {{/errorlist}}
21
- {{/validation-list}}
22
- {{/partials-validation-list}}
13
+ <div class="govuk-error-summary__body">
14
+ {{<partials-validation-list}}
15
+ {{$validation-list}}
16
+ {{#errorlist}}
17
+ {{#message}}
18
+ <li><a href="#{{errorLinkId}}">{{ message }}</a></li>
19
+ {{/message}}
20
+ {{/errorlist}}
21
+ {{/validation-list}}
22
+ {{/partials-validation-list}}
23
+ </div>
23
24
  </div>
24
25
  {{/errorlist.length}}
@@ -1,6 +1,6 @@
1
1
  {{<error}}
2
2
  {{$content}}
3
3
  <p>{{{content.message}}}</p>
4
- <a href="{{startLink}}" class="button" role="button">{{#t}}buttons.start-again{{/t}}</a>
4
+ <a href="{{startLink}}" class="govuk-button" role="button">{{#t}}buttons.start-again{{/t}}</a>
5
5
  {{/content}}
6
6
  {{/error}}
@@ -35,7 +35,7 @@ function showCookieBannerSubmitted() {
35
35
  document.getElementById('cookie-banner-info').style.display = 'none';
36
36
  document.getElementById('cookie-banner-actions').style.display = 'none';
37
37
  var cookieBannerSubmitted = document.getElementById('cookie-banner-submitted');
38
- cookieBannerSubmitted.style.display = 'flex';
38
+ cookieBannerSubmitted.style.display = 'block';
39
39
  cookieBannerSubmitted.focus();
40
40
  }
41
41
 
@@ -0,0 +1,122 @@
1
+ (function () {
2
+ "use strict"
3
+ var root = this;
4
+ if(typeof root.GOVUK === 'undefined') { root.GOVUK = {}; }
5
+
6
+ /*
7
+ Cookie methods
8
+ ==============
9
+
10
+ Usage:
11
+
12
+ Setting a cookie:
13
+ GOVUK.cookie('hobnob', 'tasty', { days: 30 });
14
+
15
+ Reading a cookie:
16
+ GOVUK.cookie('hobnob');
17
+
18
+ Deleting a cookie:
19
+ GOVUK.cookie('hobnob', null);
20
+ */
21
+ GOVUK.cookie = function (name, value, options) {
22
+ if(typeof value !== 'undefined'){
23
+ if(value === false || value === null) {
24
+ return GOVUK.setCookie(name, '', { days: -1 });
25
+ } else {
26
+ return GOVUK.setCookie(name, value, options);
27
+ }
28
+ } else {
29
+ return GOVUK.getCookie(name);
30
+ }
31
+ };
32
+ GOVUK.setCookie = function (name, value, options) {
33
+ if(typeof options === 'undefined') {
34
+ options = {};
35
+ }
36
+ var cookieString = name + "=" + value + "; path=/";
37
+ if (options.days) {
38
+ var date = new Date();
39
+ date.setTime(date.getTime() + (options.days * 24 * 60 * 60 * 1000));
40
+ cookieString = cookieString + "; expires=" + date.toGMTString();
41
+ }
42
+ if (document.location.protocol == 'https:'){
43
+ cookieString = cookieString + "; Secure";
44
+ }
45
+ document.cookie = cookieString;
46
+ };
47
+ GOVUK.getCookie = function (name) {
48
+ var nameEQ = name + "=";
49
+ var cookies = document.cookie.split(';');
50
+ for(var i = 0, len = cookies.length; i < len; i++) {
51
+ var cookie = cookies[i];
52
+ while (cookie.charAt(0) == ' ') {
53
+ cookie = cookie.substring(1, cookie.length);
54
+ }
55
+ if (cookie.indexOf(nameEQ) === 0) {
56
+ return decodeURIComponent(cookie.substring(nameEQ.length));
57
+ }
58
+ }
59
+ return null;
60
+ };
61
+ }).call(this);
62
+ (function () {
63
+ 'use strict'
64
+ var root = this
65
+ if (typeof root.GOVUK === 'undefined') { root.GOVUK = {} }
66
+
67
+ GOVUK.addCookieMessage = function () {
68
+ var message = document.getElementById('global-cookie-message')
69
+
70
+ var hasCookieMessage = (message && GOVUK.cookie('seen_cookie_message') === null)
71
+
72
+ if (hasCookieMessage) {
73
+ message.style.display = 'block'
74
+ GOVUK.cookie('seen_cookie_message', 'yes', { days: 28 })
75
+
76
+ document.addEventListener('DOMContentLoaded', function (event) {
77
+ if (GOVUK.analytics && typeof GOVUK.analytics.trackEvent === 'function') {
78
+ GOVUK.analytics.trackEvent('cookieBanner', 'Cookie banner shown', {
79
+ value: 1,
80
+ nonInteraction: true
81
+ })
82
+ }
83
+ })
84
+ };
85
+ }
86
+ }).call(this)
87
+ ;
88
+ (function() {
89
+ "use strict"
90
+
91
+ // add cookie message
92
+ if (window.GOVUK && GOVUK.addCookieMessage) {
93
+ GOVUK.addCookieMessage();
94
+ }
95
+
96
+ // header navigation toggle
97
+ if (document.querySelectorAll && document.addEventListener){
98
+ var els = document.querySelectorAll('.js-header-toggle'),
99
+ i, _i;
100
+ for(i=0,_i=els.length; i<_i; i++){
101
+ els[i].addEventListener('click', function(e){
102
+ e.preventDefault();
103
+ var target = document.getElementById(this.getAttribute('href').substr(1)),
104
+ targetClass = target.getAttribute('class') || '',
105
+ sourceClass = this.getAttribute('class') || '';
106
+
107
+ if(targetClass.indexOf('js-visible') !== -1){
108
+ target.setAttribute('class', targetClass.replace(/(^|\s)js-visible(\s|$)/, ''));
109
+ } else {
110
+ target.setAttribute('class', targetClass + " js-visible");
111
+ }
112
+ if(sourceClass.indexOf('js-visible') !== -1){
113
+ this.setAttribute('class', sourceClass.replace(/(^|\s)js-visible(\s|$)/, ''));
114
+ } else {
115
+ this.setAttribute('class', sourceClass + " js-visible");
116
+ }
117
+ this.setAttribute('aria-expanded', this.getAttribute('aria-expanded') !== "true");
118
+ target.setAttribute('aria-hidden', target.getAttribute('aria-hidden') === "false");
119
+ });
120
+ }
121
+ }
122
+ }).call(this);
@@ -8,6 +8,11 @@ var formFocus = toolkit.formFocus;
8
8
  var characterCount = toolkit.characterCount;
9
9
  var validation = toolkit.validation;
10
10
 
11
+ var GOVUK = require('govuk-frontend')
12
+ GOVUK.initAll();
13
+ window.GOVUK = GOVUK;
14
+ var skipToMain = require('./skip-to-main');
15
+ var cookie = require('./govuk-cookies');
11
16
  var cookieSettings = require('./cookieSettings');
12
17
 
13
18
  toolkit.detailsSummary();
@@ -0,0 +1,18 @@
1
+ const skipToMain = function () {
2
+ const skipToMainLink = document.getElementById("skip-to-main");
3
+ const firstControlId = skipToMainLink.hash.split('#')[1] ? skipToMainLink.hash.split('#')[1] : "main-content";
4
+ if(firstControlId === "main-content"){
5
+ skipToMainLink.setAttribute("href", "#main-content");
6
+ }
7
+ if(firstControlId) {
8
+ skipToMainLink.onclick = function(e) {
9
+ //here timeout added just to make this functionality asynchronous
10
+ //to focus on form as well as non form contents
11
+ setTimeout(() => {
12
+ const firstControl = document.getElementById(firstControlId);
13
+ firstControl.focus();
14
+ }, 10);
15
+ }
16
+ }
17
+ };
18
+ skipToMain();
@@ -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
+ }
@@ -22,7 +22,7 @@
22
22
  }
23
23
  }
24
24
 
25
- .validation-error {
25
+ .govuk-form-group--error {
26
26
  box-sizing: border-box;
27
27
  padding-left: $gutter-half - $validation-bdr-size;
28
28
  border-left: $validation-bdr-size-lg solid $error-colour;
@@ -36,7 +36,7 @@
36
36
  }
37
37
  }
38
38
 
39
- .error-message {
39
+ .govuk-error-message {
40
40
  display: block;
41
41
  @include media(tablet) {
42
42
  margin-bottom: 0.5em;
@@ -46,6 +46,6 @@
46
46
  }
47
47
 
48
48
  .invalid-input,
49
- .validation-error .date-input {
49
+ .govuk-form-group--error .date-input {
50
50
  border: $validation-bdr-size solid $error-colour;
51
51
  }
@@ -30,12 +30,12 @@ CharacterCount.prototype.updateCount = function () {
30
30
  this.$maxlengthHint.innerHTML = 'You have ' + number + characterNoun + remainderSuffix;
31
31
 
32
32
  if (currentLength >= this.maxLength + 1) {
33
- helpers.removeClass(this.$maxlengthHint, 'form-hint');
34
- helpers.addClass(this.$maxlengthHint, 'error-message');
33
+ helpers.removeClass(this.$maxlengthHint, 'govuk-hint');
34
+ helpers.addClass(this.$maxlengthHint, 'govuk-error-message');
35
35
  helpers.addClass(this.$textarea, 'textarea-error');
36
36
  } else {
37
- helpers.addClass(this.$maxlengthHint, 'form-hint');
38
- helpers.removeClass(this.$maxlengthHint, 'error-message');
37
+ helpers.addClass(this.$maxlengthHint, 'govuk-hint');
38
+ helpers.removeClass(this.$maxlengthHint, 'govuk-error-message');
39
39
  helpers.removeClass(this.$textarea, 'textarea-error');
40
40
  }
41
41
  };
@@ -22,7 +22,7 @@
22
22
  }
23
23
  }
24
24
 
25
- .validation-error {
25
+ .govuk-form-group--error {
26
26
  box-sizing: border-box;
27
27
  padding-left: $gutter-half - $validation-bdr-size;
28
28
  border-left: $validation-bdr-size-lg solid $error-colour;
@@ -36,7 +36,7 @@
36
36
  }
37
37
  }
38
38
 
39
- .error-message {
39
+ .govuk-error-message {
40
40
  display: block;
41
41
  @include media(tablet) {
42
42
  margin-bottom: 0.5em;
@@ -46,6 +46,6 @@
46
46
  }
47
47
 
48
48
  .invalid-input,
49
- .validation-error .date-input {
49
+ .govuk-form-group--error .date-input {
50
50
  border: $validation-bdr-size solid $error-colour;
51
51
  }