govuk_publishing_components 24.15.3 → 24.18.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +25 -76
  3. data/app/assets/images/govuk_publishing_components/action-link-arrow--brexit.svg +3 -0
  4. data/app/assets/images/govuk_publishing_components/action-link-arrow--dark.png +0 -0
  5. data/app/assets/images/govuk_publishing_components/action-link-arrow--dark.svg +2 -2
  6. data/app/assets/javascripts/govuk_publishing_components/analytics/custom-dimensions.js +1 -0
  7. data/app/assets/javascripts/govuk_publishing_components/analytics/scroll-tracker.js +7 -0
  8. data/app/assets/javascripts/govuk_publishing_components/components/button.js +1 -1
  9. data/app/assets/javascripts/govuk_publishing_components/components/character-count.js +1 -1
  10. data/app/assets/javascripts/govuk_publishing_components/components/checkboxes.js +10 -10
  11. data/app/assets/javascripts/govuk_publishing_components/components/details.js +5 -5
  12. data/app/assets/javascripts/govuk_publishing_components/components/error-summary.js +1 -1
  13. data/app/assets/javascripts/govuk_publishing_components/components/layout-header.js +1 -1
  14. data/app/assets/javascripts/govuk_publishing_components/components/radio.js +1 -1
  15. data/app/assets/javascripts/govuk_publishing_components/components/tabs.js +1 -1
  16. data/app/assets/javascripts/govuk_publishing_components/lib/govspeak/all.js +1 -0
  17. data/app/assets/javascripts/govuk_publishing_components/modules.js +23 -20
  18. data/app/assets/javascripts/govuk_publishing_components/rum-loader.js.erb +18 -13
  19. data/app/assets/javascripts/govuk_publishing_components/vendor/lux/{lux-polyfill.js → lux-measurer.js} +0 -0
  20. data/app/assets/javascripts/govuk_publishing_components/vendor/lux/{lux.js → lux-reporter.js} +0 -0
  21. data/app/assets/javascripts/govuk_publishing_components/vendor/polyfills/all.js +1 -0
  22. data/app/assets/stylesheets/govuk_publishing_components/components/_action-link.scss +25 -0
  23. data/app/views/govuk_publishing_components/components/_action_link.html.erb +4 -0
  24. data/app/views/govuk_publishing_components/components/_checkboxes.html.erb +2 -2
  25. data/app/views/govuk_publishing_components/components/_details.html.erb +1 -1
  26. data/app/views/govuk_publishing_components/components/_layout_for_public.html.erb +9 -3
  27. data/app/views/govuk_publishing_components/components/_radio.html.erb +3 -0
  28. data/app/views/govuk_publishing_components/components/docs/action_link.yml +6 -0
  29. data/app/views/govuk_publishing_components/components/docs/layout_footer.yml +12 -0
  30. data/app/views/govuk_publishing_components/components/docs/layout_for_public.yml +4 -0
  31. data/app/views/govuk_publishing_components/components/docs/radio.yml +10 -0
  32. data/config/initializers/assets.rb +2 -2
  33. data/lib/govuk_publishing_components/presenters/content_breadcrumbs_based_on_priority.rb +11 -24
  34. data/lib/govuk_publishing_components/presenters/meta_tags.rb +23 -1
  35. data/lib/govuk_publishing_components/presenters/public_layout_helper.rb +8 -0
  36. data/lib/govuk_publishing_components/version.rb +1 -1
  37. metadata +9 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0ca0bc4aaec398f4d2bcb5d7f5727169638e3780495ae7bf9518ce979283bb20
4
- data.tar.gz: fb29ac6713100ffba6c45f1f2e1a955d4ca071cdd2b9ede0a28e14cac1e7f8dd
3
+ metadata.gz: 02b26535b07ec186ec09b9ddd4ffb9e2bf6097caa9b7d59e3f0ec9e349fb81b1
4
+ data.tar.gz: 0373e25f45dddff403f478602d5d3bbb8db192265b170ea99fe7fd788b4b602f
5
5
  SHA512:
6
- metadata.gz: eafcd908a1accfe8c3d4d049dbf21a7f314d53e5484c926badd915f00a68810330c37bda6b9965354791140770b9726352487532987f4b9f820cc65079b1717f
7
- data.tar.gz: af6c0b5853f8eebc4ae69642b03008dc9e05d926cdef050ca10f243d65809320ca642818d11c898e9ac63e8c7b8acb027bf9947547023ddade74f2e65195c8b6
6
+ metadata.gz: fb00fd4cc2b4288e78404a556af58b9f3de3ffc0155ea4430d0ca4ff08ae3764b9e34ac237e1b82278809b574bf115b30b7f84500f1f1d6f7f71df7f5a5d9568
7
+ data.tar.gz: 8cd996b85dc084669b638f8f9e98559acb1e9280c9b687c47dedd4dbfc0d5de3054ae23cd511e91f123903a3e1e3a01918eab45914afb72db9639c8a22970f7d
data/README.md CHANGED
@@ -1,103 +1,52 @@
1
- GOV.UK Publishing Components
1
+ # GOV.UK Publishing Components
2
+
2
3
  [![status](https://badgen.net/github/status/alphagov/govuk_publishing_components/master)](https://ci.integration.publishing.service.gov.uk/job/govuk_publishing_components/job/master/)
3
4
  [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
4
5
  [![Stylelint Style Guide](https://img.shields.io/badge/code_style-stylelint-brightgreen.svg)](https://github.com/alphagov/stylelint-config-gds/)
5
- =====================
6
6
 
7
- GOV.UK Publishing Components is a Ruby gem to document and distribute components for GOV.UK applications.
7
+ A Ruby gem to document and distribute components for GOV.UK applications. It provides:
8
8
 
9
- It provides:
10
9
  - a shared library of components
11
10
  - helpers to generate component payloads
12
11
  - an application to preview components and provide guidance
12
+ - [GOV.UK Design System](https://design-system.service.gov.uk/) styles and components (via [GOV.UK Frontend](https://github.com/alphagov/govuk-frontend))
13
13
 
14
- Components should be added to this gem if they are required in more than one application, otherwise they should be added to that application.
15
-
16
- ## How to
17
-
18
- - [Install and use this gem](/docs/install-and-use.md)
19
- - [Use a component in your application](/docs/use-components.md)
20
- - [Generate a new component](/docs/generate-a-new-component.md)
21
- - [Develop a component](/docs/develop-component.md)
22
- - [Run the component guide](/docs/run-component-guide.md)
23
- - [Move a component from an application to the gem](/docs/moving-components-upstream-into-this-gem.md)
24
- - [Publish/release a new version of the gem](/docs/publishing-to-rubygems.md)
25
- - [Keep this gem in sync with the Design System](/docs/upgrade-govuk-frontend.md)
26
-
27
- ## Architecture / structure
28
-
29
- ![](https://docs.google.com/drawings/d/e/2PACX-1vRj6JM7cQvngDl3Gr_U9G4xga2gsU7Z-d2qHHQcsBdjsW4WaC9_eQdryBJIS69cLkrY7S0fK9BcrPSF/pub?w=960&h=720)
30
-
31
- [Source](https://docs.google.com/drawings/d/1N8-kbyCN_xOvvshN6d2HnQz5i5Bqed2WIatI3Nj9gNQ/edit)
32
-
33
- There are 2 types of helper classes in this app:
34
-
35
- - [AppHelpers](lib/govuk_publishing_components/app_helpers). Are exposed to the applications using this gem. They should be documented using RDoc.
36
- - [Component Presenters](lib/govuk_publishing_components/presenters). Anything in these classes is only for use within the components. They should be marked `@private`.
14
+ Components should be added to this gem if they are required in more than one application, otherwise they should be added to that application. All components should meet the same standards of browser and assistive technology support described in [GOV.UK Frontend](https://github.com/alphagov/govuk-frontend#browser-and-assistive-technology-support).
37
15
 
38
- ## Relationship with GOV.UK Design System
16
+ ## Technical documentation
39
17
 
40
- GOV.UK Publishing Components also makes [GOV.UK Design System](https://design-system.service.gov.uk/) styles and components available to GOV.UK's frontend applications. This gem consumes [GOV.UK Frontend](https://github.com/alphagov/govuk-frontend) via [Yarn](https://classic.yarnpkg.com/).
18
+ You can use the [GOV.UK Docker environment](https://github.com/alphagov/govuk-docker) or the local `startup.sh` script to run the app. Read the [guidance on local frontend development](https://docs.publishing.service.gov.uk/manual/local-frontend-development.html) to find out more about each approach, before you get started.
41
19
 
42
- ## Browser and assistive technology support
20
+ If you are using GOV.UK Docker, remember to combine it with the commands that follow. See the [GOV.UK Docker usage instructions](https://github.com/alphagov/govuk-docker#usage) for examples.
43
21
 
44
- GOV.UK Publishing Components shares the same standards in terms of browser and assistive technology support with [GOV.UK Frontend](https://github.com/alphagov/govuk-frontend#browser-and-assistive-technology-support).
45
-
46
- ## Documentation
47
-
48
- [See the rubydoc.info documentation](http://www.rubydoc.info/gems/govuk_publishing_components)
49
-
50
- ## Working locally
51
-
52
- ### Install dependencies
53
-
54
- As well as the Ruby, you will also need the [Yarn package manager](https://classic.yarnpkg.com/en/docs/install/) to allow installing [npm](https://npmjs.com) dependencies.
55
-
56
- Install the application's dependencies with:
22
+ ### Running the test suite
57
23
 
58
24
  ```sh
59
- bundle install
60
- yarn install
25
+ bundle exec rake
61
26
  ```
62
27
 
63
- ### Running a local app with a local gem
64
-
65
- The GDS Developer Docs has a [guide on local frontend development](https://docs.publishing.service.gov.uk/manual/local-frontend-development.html) that covers setting up a local app to use the local version of the components gem in Docker and using the `./startup.sh` script.
28
+ To run JavaScript tests (only):
66
29
 
67
- ### Running tests
68
-
69
- The default rake task runs all the linting and test tasks:
70
-
71
- ```sh
72
- bin/rake
73
30
  ```
74
- Javascript is tested using Jasmine and the [Jasmine gem](https://github.com/pivotal/jasmine-gem). Tests can be run either in the browser or on the command line via the dummy app’s tasks:
75
-
76
- ```sh
77
- # browser
31
+ # run JS tests in browser
78
32
  bin/rake app:jasmine
79
33
 
80
- # command line
34
+ # run JS tests on command line
81
35
  bin/rake app:jasmine:ci
82
36
  ```
83
37
 
84
- ### Viewing the component guide
85
-
86
- View the component guide in your browser with:
87
-
88
- ```sh
89
- ./startup.sh
90
- ```
91
-
92
- The guide should be available at http://localhost:3212
93
-
94
- ### View documentation
95
-
96
- Preview documentation in your browser with:
97
-
98
- ```sh
99
- bundle exec yard server --reload
100
- ```
38
+ ### Further documentation
39
+
40
+ - [Install and use this gem](docs/install-and-use.md)
41
+ - [Use a component in your application](docs/use-components.md)
42
+ - [Generate a new component](docs/generate-a-new-component.md)
43
+ - [Testing a component](docs/testing-components.md)
44
+ - [Move a component from an application to the gem](docs/moving-components-upstream-into-this-gem.md)
45
+ - [Publish/release a new version of the gem](docs/publishing-to-rubygems.md)
46
+ - [Keep this gem in sync with the Design System](docs/upgrade-govuk-frontend.md)
47
+ - [Code documentation on rubydoc.info](http://www.rubydoc.info/gems/govuk_publishing_components)
48
+ - [Component conventions](docs/component_conventions.md)
49
+ - [Component principles](docs/component_principles.md)
101
50
 
102
51
  ## Licence
103
52
 
@@ -0,0 +1,3 @@
1
+ <svg width="38" height="36" viewBox="0 0 38 36" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M38 35.8461C34.8518 35.8299 31.701 35.8136 28.5528 35.7974C28.5447 29.2599 28.5366 22.7252 28.5284 16.1878C21.8989 22.7252 15.2721 29.2599 8.64252 35.7974C5.8547 35.792 3.06417 35.7838 0.276344 35.7784C0.262798 34.1366 0.249251 32.4948 0.232996 30.8503C7.36917 23.7195 14.5026 16.5833 21.6388 9.44717C14.4268 9.47697 7.21204 9.50406 0 9.53387C3.17254 6.35862 6.34778 3.18608 9.52032 0.010837C19.0135 0.00812776 28.5068 0.00270925 38 0C38 11.9234 38 23.8577 38 35.8461Z" fill="#FF003B"/>
3
+ </svg>
@@ -1,5 +1,5 @@
1
1
  <svg width="23" height="23" viewBox="0 0 23 23" fill="none" xmlns="http://www.w3.org/2000/svg">
2
2
  <circle cx="11.5" cy="11.5" r="11.5" fill="#272828"/>
3
- <path fill-rule="evenodd" clip-rule="evenodd" d="M14.9429 11.7949L10.4402 7.29222L11.7327 5.99967L17.528 11.7949L11.7327 17.5902L10.4402 16.2976L14.9429 11.7949Z" fill="#fff500"/>
4
- <path fill-rule="evenodd" clip-rule="evenodd" d="M3.95631 10.881L15.4414 10.881L15.4414 12.709L3.95631 12.709L3.95631 10.881Z" fill="#fff500"/>
3
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M14.9429 11.7949L10.4402 7.29222L11.7327 5.99967L17.528 11.7949L11.7327 17.5902L10.4402 16.2976L14.9429 11.7949Z" fill="#ffffff"/>
4
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M3.95631 10.881L15.4414 10.881L15.4414 12.709L3.95631 12.709L3.95631 10.881Z" fill="#ffffff"/>
5
5
  </svg>
@@ -63,6 +63,7 @@
63
63
  'taxon-ids': { dimension: 59, defaultValue: 'other' },
64
64
  'content-has-history': { dimension: 39, defaultValue: 'false' },
65
65
  'publishing-application': { dimension: 89 },
66
+ 'brexit-audience': { dimension: 111 },
66
67
  stepnavs: { dimension: 96 },
67
68
  'relevant-result-shown': { dimension: 83 },
68
69
  'spelling-suggestion': { dimension: 81 }
@@ -212,6 +212,13 @@
212
212
  ['Percent', 60],
213
213
  ['Percent', 80],
214
214
  ['Percent', 100]
215
+ ],
216
+ '/guidance/import-and-export-goods-using-preference-agreements': [
217
+ ['Percent', 20],
218
+ ['Percent', 40],
219
+ ['Percent', 60],
220
+ ['Percent', 80],
221
+ ['Percent', 100]
215
222
  ]
216
223
  }
217
224
 
@@ -2,4 +2,4 @@
2
2
  // = require govuk/components/button/button.js
3
3
  window.GOVUK = window.GOVUK || {}
4
4
  window.GOVUK.Modules = window.GOVUK.Modules || {}
5
- window.GOVUK.Modules.Button = window.GOVUKFrontend
5
+ window.GOVUK.Modules.GovukButton = window.GOVUKFrontend
@@ -2,4 +2,4 @@
2
2
  // = require govuk/components/character-count/character-count.js
3
3
  window.GOVUK = window.GOVUK || {}
4
4
  window.GOVUK.Modules = window.GOVUK.Modules || {}
5
- window.GOVUK.Modules.CharacterCount = window.GOVUKFrontend
5
+ window.GOVUK.Modules.GovukCharacterCount = window.GOVUKFrontend
@@ -3,17 +3,17 @@
3
3
  // = require govuk/components/checkboxes/checkboxes.js
4
4
  window.GOVUK = window.GOVUK || {}
5
5
  window.GOVUK.Modules = window.GOVUK.Modules || {}
6
- window.GOVUK.Modules.Checkboxes = window.GOVUKFrontend;
6
+ window.GOVUK.Modules.GovukCheckboxes = window.GOVUKFrontend;
7
7
 
8
8
  (function (Modules) {
9
- function GovukCheckboxes ($module) {
9
+ function GemCheckboxes ($module) {
10
10
  this.$module = $module
11
11
  this.$checkboxes = this.$module.querySelectorAll('input[type=checkbox]')
12
12
  this.$nestedCheckboxes = this.$module.querySelectorAll('[data-nested=true] input[type=checkbox]')
13
13
  this.$exclusiveCheckboxes = this.$module.querySelectorAll('[data-exclusive=true] input[type=checkbox]')
14
14
  }
15
15
 
16
- GovukCheckboxes.prototype.init = function () {
16
+ GemCheckboxes.prototype.init = function () {
17
17
  this.applyAriaControlsAttributes(this.$module)
18
18
 
19
19
  for (var i = 0; i < this.$checkboxes.length; i++) {
@@ -29,7 +29,7 @@ window.GOVUK.Modules.Checkboxes = window.GOVUKFrontend;
29
29
  }
30
30
  }
31
31
 
32
- GovukCheckboxes.prototype.handleCheckboxChange = function (event) {
32
+ GemCheckboxes.prototype.handleCheckboxChange = function (event) {
33
33
  if (window.GOVUK.analytics && window.GOVUK.analytics.trackEvent) {
34
34
  // Where checkboxes are manipulated externally in finders, `suppressAnalytics`
35
35
  // is passed to prevent duplicate GA events.
@@ -58,7 +58,7 @@ window.GOVUK.Modules.Checkboxes = window.GOVUKFrontend;
58
58
  }
59
59
  }
60
60
 
61
- GovukCheckboxes.prototype.handleNestedCheckboxChange = function (event) {
61
+ GemCheckboxes.prototype.handleNestedCheckboxChange = function (event) {
62
62
  var $checkbox = event.target
63
63
  var $isNested = $checkbox.closest('.govuk-checkboxes--nested')
64
64
  var $hasNested = this.$module.querySelector('.govuk-checkboxes--nested[data-parent=' + $checkbox.id + ']')
@@ -70,7 +70,7 @@ window.GOVUK.Modules.Checkboxes = window.GOVUKFrontend;
70
70
  }
71
71
  }
72
72
 
73
- GovukCheckboxes.prototype.toggleNestedCheckboxes = function ($scope, $checkbox) {
73
+ GemCheckboxes.prototype.toggleNestedCheckboxes = function ($scope, $checkbox) {
74
74
  var $nestedCheckboxes = $scope.querySelectorAll('input[type=checkbox]')
75
75
  if ($checkbox.checked) {
76
76
  for (var i = 0; i < $nestedCheckboxes.length; i++) {
@@ -83,7 +83,7 @@ window.GOVUK.Modules.Checkboxes = window.GOVUKFrontend;
83
83
  }
84
84
  }
85
85
 
86
- GovukCheckboxes.prototype.toggleParentCheckbox = function ($scope, $checkbox) {
86
+ GemCheckboxes.prototype.toggleParentCheckbox = function ($scope, $checkbox) {
87
87
  var $inputs = $scope.querySelectorAll('input')
88
88
  var $checkedInputs = $scope.querySelectorAll('input:checked')
89
89
  var parentId = $scope.getAttribute('data-parent')
@@ -96,7 +96,7 @@ window.GOVUK.Modules.Checkboxes = window.GOVUKFrontend;
96
96
  }
97
97
  }
98
98
 
99
- GovukCheckboxes.prototype.handleExclusiveCheckboxChange = function (event) {
99
+ GemCheckboxes.prototype.handleExclusiveCheckboxChange = function (event) {
100
100
  var $currentCheckbox = event.target
101
101
  var $checkboxes = $currentCheckbox.closest('.govuk-checkboxes')
102
102
  var $exclusiveOption = $checkboxes.querySelector('input[type=checkbox][data-exclusive]')
@@ -113,7 +113,7 @@ window.GOVUK.Modules.Checkboxes = window.GOVUKFrontend;
113
113
  }
114
114
  }
115
115
 
116
- GovukCheckboxes.prototype.applyAriaControlsAttributes = function ($scope) {
116
+ GemCheckboxes.prototype.applyAriaControlsAttributes = function ($scope) {
117
117
  var $inputs = $scope.querySelectorAll('[data-controls]')
118
118
 
119
119
  for (var i = 0; i < $inputs.length; i++) {
@@ -121,5 +121,5 @@ window.GOVUK.Modules.Checkboxes = window.GOVUKFrontend;
121
121
  }
122
122
  }
123
123
 
124
- Modules.GovukCheckboxes = GovukCheckboxes
124
+ Modules.GemCheckboxes = GemCheckboxes
125
125
  })(window.GOVUK.Modules)
@@ -2,16 +2,16 @@
2
2
  // = require govuk/components/details/details.js
3
3
  window.GOVUK = window.GOVUK || {}
4
4
  window.GOVUK.Modules = window.GOVUK.Modules || {}
5
- window.GOVUK.Modules.Details = window.GOVUKFrontend;
5
+ window.GOVUK.Modules.GovukDetails = window.GOVUKFrontend;
6
6
 
7
7
  (function (Modules) {
8
- function GovukDetails ($module) {
8
+ function GemDetails ($module) {
9
9
  this.$module = $module
10
10
  this.customTrackLabel = this.$module.getAttribute('data-track-label')
11
11
  this.detailsClick = this.$module.querySelector('[data-details-track-click]')
12
12
  }
13
13
 
14
- GovukDetails.prototype.init = function () {
14
+ GemDetails.prototype.init = function () {
15
15
  if (this.customTrackLabel) { // If a custom label has been provided, we can simply call the tracking module
16
16
  var trackDetails = new window.GOVUK.Modules.GemTrackClick()
17
17
  trackDetails.start($(this.$module))
@@ -22,7 +22,7 @@ window.GOVUK.Modules.Details = window.GOVUKFrontend;
22
22
  }
23
23
  }
24
24
 
25
- GovukDetails.prototype.trackDefault = function (element) {
25
+ GemDetails.prototype.trackDefault = function (element) {
26
26
  if (window.GOVUK.analytics && window.GOVUK.analytics.trackEvent) {
27
27
  var componentStatus = (element.getAttribute('open') == null) ? 'open' : 'closed'
28
28
  var trackCategory = element.getAttribute('data-track-category')
@@ -45,5 +45,5 @@ window.GOVUK.Modules.Details = window.GOVUKFrontend;
45
45
  }
46
46
  }
47
47
 
48
- Modules.GovukDetails = GovukDetails
48
+ Modules.GemDetails = GemDetails
49
49
  })(window.GOVUK.Modules)
@@ -2,4 +2,4 @@
2
2
  // = require govuk/components/error-summary/error-summary.js
3
3
  window.GOVUK = window.GOVUK || {}
4
4
  window.GOVUK.Modules = window.GOVUK.Modules || {}
5
- window.GOVUK.Modules.ErrorSummary = window.GOVUKFrontend
5
+ window.GOVUK.Modules.GovukErrorSummary = window.GOVUKFrontend
@@ -2,4 +2,4 @@
2
2
  // = require govuk/components/header/header.js
3
3
  window.GOVUK = window.GOVUK || {}
4
4
  window.GOVUK.Modules = window.GOVUK.Modules || {}
5
- window.GOVUK.Modules.Header = window.GOVUKFrontend
5
+ window.GOVUK.Modules.GovukHeader = window.GOVUKFrontend
@@ -2,4 +2,4 @@
2
2
  // = require govuk/components/radios/radios.js
3
3
  window.GOVUK = window.GOVUK || {}
4
4
  window.GOVUK.Modules = window.GOVUK.Modules || {}
5
- window.GOVUK.Modules.Radios = window.GOVUKFrontend
5
+ window.GOVUK.Modules.GovukRadios = window.GOVUKFrontend
@@ -2,4 +2,4 @@
2
2
  // = require govuk/components/tabs/tabs.js
3
3
  window.GOVUK = window.GOVUK || {}
4
4
  window.GOVUK.Modules = window.GOVUK.Modules || {}
5
- window.GOVUK.Modules.Tabs = window.GOVUKFrontend
5
+ window.GOVUK.Modules.GovukTabs = window.GOVUKFrontend
@@ -26,29 +26,32 @@
26
26
  var modules = this.find(container)
27
27
 
28
28
  for (var i = 0, l = modules.length; i < l; i++) {
29
- var module
30
29
  var element = $(modules[i])
31
- var moduleName = camelCaseAndCapitalise(element.data('module'))
32
- var started = element.data('module-started')
33
- var frontendModuleName = moduleName.replace('Govuk', '')
30
+ var moduleNames = element.data('module').split(' ')
34
31
 
35
- if ( // GOV.UK Publishing & Legacy Modules
36
- typeof GOVUK.Modules[moduleName] === 'function' &&
37
- !GOVUK.Modules[moduleName].prototype.init &&
38
- !started
39
- ) {
40
- module = new GOVUK.Modules[moduleName]()
41
- module.start(element)
42
- element.data('module-started', true)
43
- }
32
+ for (var j = 0, k = moduleNames.length; j < k; j++) {
33
+ var module
34
+ var moduleName = camelCaseAndCapitalise(moduleNames[j])
35
+ var started = element.data(moduleNames[j] + '-module-started')
36
+
37
+ if ( // GOV.UK Publishing & Legacy Modules
38
+ typeof GOVUK.Modules[moduleName] === 'function' &&
39
+ !GOVUK.Modules[moduleName].prototype.init &&
40
+ !started
41
+ ) {
42
+ module = new GOVUK.Modules[moduleName]()
43
+ module.start(element)
44
+ element.data(moduleNames[j] + '-module-started', true)
45
+ }
44
46
 
45
- if ( // GOV.UK Frontend Modules
46
- typeof GOVUK.Modules[frontendModuleName] === 'function' &&
47
- GOVUK.Modules[frontendModuleName].prototype.init &&
48
- !started
49
- ) {
50
- module = new GOVUK.Modules[frontendModuleName](element[0]).init()
51
- element.data('module-started', true)
47
+ if ( // GOV.UK Frontend Modules
48
+ typeof GOVUK.Modules[moduleName] === 'function' &&
49
+ GOVUK.Modules[moduleName].prototype.init &&
50
+ !started
51
+ ) {
52
+ module = new GOVUK.Modules[moduleName](element[0]).init()
53
+ element.data(moduleNames[j] + '-module-started', true)
54
+ }
52
55
  }
53
56
  }
54
57
 
@@ -1,9 +1,6 @@
1
1
  (function() {
2
- var marker = document.getElementsByTagName('script')[0]
3
- var scripts = [
4
- '<%= path_to_javascript("govuk_publishing_components/vendor/lux/lux-polyfill") %>',
5
- '<%= path_to_javascript("govuk_publishing_components/vendor/lux/lux") %>'
6
- ]
2
+ var scriptSrc = '<%= path_to_javascript("govuk_publishing_components/vendor/lux/lux-reporter") %>'
3
+
7
4
  var parsedCookie = (function() {
8
5
  try {
9
6
  var cookies = document.cookie.split(';')
@@ -23,14 +20,22 @@
23
20
  return {}
24
21
  })()
25
22
 
26
- if (parsedCookie.usage === true) {
27
- for (var i = 0; i < scripts.length; i++) {
28
- var script = document.createElement('script')
29
- script.src = scripts[i]
30
- script.async = true
31
- script.defer = true
23
+ var insertScript = function(source) {
24
+ var marker = document.getElementsByTagName('script')[0]
32
25
 
33
- marker.parentNode.insertBefore(script, marker)
34
- }
26
+ var script = document.createElement('script')
27
+ script.src = source
28
+ script.async = true
29
+ script.defer = true
30
+
31
+ marker.parentNode.insertBefore(script, marker)
32
+ }
33
+
34
+ if (parsedCookie.usage === true) {
35
+ insertScript(scriptSrc)
36
+ } else {
37
+ window.addEventListener('cookie-consent', function() {
38
+ insertScript(scriptSrc)
39
+ })
35
40
  }
36
41
  })()
@@ -146,6 +146,31 @@
146
146
  }
147
147
  }
148
148
 
149
+ .gem-c-action-link--brexit {
150
+ max-width: none;
151
+
152
+ &:before {
153
+ height: 30px;
154
+ width: 35px;
155
+ background-image: image-url("govuk_publishing_components/action-link-arrow--brexit.svg");
156
+ background-repeat: no-repeat;
157
+ background-size: 25px auto;
158
+ background-position: 0 0;
159
+ }
160
+
161
+ @include govuk-media-query($until: tablet) {
162
+ margin-bottom: govuk-spacing(2);
163
+ }
164
+
165
+ @include govuk-media-query($from: tablet) {
166
+ margin-bottom: govuk-spacing(2);
167
+
168
+ &:before {
169
+ background-position: 0 4px;
170
+ }
171
+ }
172
+ }
173
+
149
174
  .gem-c-action-link--nhs {
150
175
  &:before {
151
176
  width: 80px;
@@ -14,9 +14,11 @@
14
14
  dark_icon ||= false
15
15
  small_icon ||= false
16
16
  nhs_icon ||= false
17
+ brexit_icon ||= false
17
18
  transparent_icon ||= false
18
19
  data ||= nil
19
20
  classes ||= nil
21
+ font_size ||= nil
20
22
 
21
23
  css_classes = %w(gem-c-action-link)
22
24
  css_classes << "gem-c-action-link--light-text" if light_text
@@ -24,6 +26,7 @@
24
26
  css_classes << "gem-c-action-link--small-icon" if small_icon
25
27
  css_classes << "gem-c-action-link--transparent-icon" if transparent_icon
26
28
  css_classes << "gem-c-action-link--nhs" if nhs_icon
29
+ css_classes << "gem-c-action-link--brexit" if brexit_icon
27
30
  css_classes << "gem-c-action-link--simple" if simple
28
31
  css_classes << "gem-c-action-link--simple-light" if simple_light
29
32
  css_classes << "gem-c-action-link--with-subtext" if subtext
@@ -33,6 +36,7 @@
33
36
  link_classes = %w(govuk-link gem-c-action-link__link)
34
37
  link_classes << shared_helper.classes if classes
35
38
  link_classes << "govuk-link--inverse" if light_text
39
+ link_classes << shared_helper.get_heading_size(font_size, 'm') if font_size
36
40
  %>
37
41
  <% if text.present? %>
38
42
  <div class="<%= css_classes.join(' ') %>">
@@ -4,7 +4,7 @@
4
4
  id = cb_helper.id
5
5
  %>
6
6
 
7
- <%= tag.div id: id, class: cb_helper.css_classes, data: { module: "govuk-checkboxes" } do %>
7
+ <%= tag.div id: id, class: cb_helper.css_classes, data: { module: "gem-checkboxes" } do %>
8
8
  <% if cb_helper.should_have_fieldset %>
9
9
  <% if cb_helper.heading_markup %>
10
10
  <%= tag.fieldset class: "govuk-fieldset", "aria-describedby": cb_helper.fieldset_describedby do %>
@@ -23,7 +23,7 @@
23
23
  <% end %>
24
24
 
25
25
  <%= tag.ul class: cb_helper.list_classes, data: {
26
- module: ('checkboxes' if cb_helper.has_conditional),
26
+ module: ('govuk-checkboxes' if cb_helper.has_conditional),
27
27
  nested: ('true' if cb_helper.has_nested),
28
28
  exclusive: ('true' if cb_helper.has_exclusive)
29
29
  } do %>
@@ -7,7 +7,7 @@
7
7
  css_classes << (shared_helper.get_margin_bottom)
8
8
 
9
9
  data_attributes ||= {}
10
- data_attributes[:module] = 'govuk-details'
10
+ data_attributes[:module] = 'govuk-details gem-details'
11
11
  %>
12
12
  <%= tag.details class: css_classes, data: data_attributes, open: open do %>
13
13
  <summary class="govuk-details__summary" data-details-track-click>
@@ -1,7 +1,9 @@
1
1
  <%
2
+ omit_feedback_form ||= false
2
3
  emergency_banner ||= nil
3
4
  full_width ||= false
4
5
  global_bar ||= nil
6
+ product_name ||= nil
5
7
  html_lang ||= "en"
6
8
  layout_helper = GovukPublishingComponents::Presenters::PublicLayoutHelper.new(local_assigns)
7
9
  logo_link ||= "/"
@@ -37,6 +39,7 @@
37
39
  <meta charset="utf-8" />
38
40
  <title><%= title %></title>
39
41
 
42
+ <%= javascript_include_tag "govuk_publishing_components/vendor/lux/lux-measurer", { async: true } %>
40
43
  <%= javascript_include_tag "govuk_publishing_components/rum-loader", { async: true } %>
41
44
 
42
45
  <%= csrf_meta_tags %>
@@ -76,6 +79,7 @@
76
79
  search: show_search,
77
80
  logo_link: logo_link,
78
81
  navigation_items: navigation_items,
82
+ product_name: product_name,
79
83
 
80
84
  # The (blue) bottom border needs to be underneath the emergency banner -
81
85
  # so it has been turned off and added in manually.
@@ -104,9 +108,11 @@
104
108
  </main>
105
109
  </div>
106
110
 
107
- <div class="govuk-width-container">
108
- <%= render "govuk_publishing_components/components/feedback" %>
109
- </div>
111
+ <% unless omit_feedback_form %>
112
+ <div class="govuk-width-container">
113
+ <%= render "govuk_publishing_components/components/feedback" %>
114
+ </div>
115
+ <% end %>
110
116
 
111
117
  <% unless local_assigns[:hide_footer_links] %>
112
118
  <%= render "govuk_publishing_components/components/layout_footer", {
@@ -1,4 +1,5 @@
1
1
  <%
2
+ local_assigns[:margin_bottom] ||= 6
2
3
  shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
3
4
  id ||= nil
4
5
  id_prefix ||= "radio-#{SecureRandom.hex(4)}"
@@ -27,6 +28,7 @@
27
28
  hint ||= nil
28
29
  error_message ||= nil
29
30
  error_items ||= []
31
+ margin_bottom = margin_bottom ||= 6
30
32
 
31
33
  has_error = error_message || error_items.any?
32
34
  hint_id = "hint-#{SecureRandom.hex(4)}" if hint
@@ -34,6 +36,7 @@
34
36
 
35
37
  form_group_css_classes = %w(govuk-form-group)
36
38
  form_group_css_classes << "govuk-form-group--error" if has_error
39
+ form_group_css_classes << shared_helper.get_margin_bottom
37
40
 
38
41
  radio_classes = %w(govuk-radios)
39
42
  radio_classes << "govuk-radios--small" if small
@@ -101,6 +101,12 @@ examples:
101
101
  text: Coronavirus (COVID-19)
102
102
  href: "/my-test-page"
103
103
  dark_icon: true
104
+ with_brexit_icon_and_custom_font_size:
105
+ data:
106
+ text: Guidance for businesses
107
+ href: "/guidance-for-businesses"
108
+ brexit_icon: true
109
+ font_size: m
104
110
  with_nhs_icon:
105
111
  data:
106
112
  text: Something about the NHS
@@ -40,10 +40,14 @@ examples:
40
40
  items:
41
41
  - href: '/help'
42
42
  text: Help
43
+ - href: '/help/privacy-notice'
44
+ text: Privacy
43
45
  - href: '/help/cookies'
44
46
  text: Cookies
45
47
  - href: '/contact'
46
48
  text: Contact
49
+ - href: '/help/accessibility-statement'
50
+ text: Accessibility statement
47
51
  - href: '/help/terms-conditions'
48
52
  text: Terms and conditions
49
53
  - href: '/cymraeg'
@@ -105,10 +109,14 @@ examples:
105
109
  items:
106
110
  - href: '/help'
107
111
  text: Help
112
+ - href: '/help/privacy-notice'
113
+ text: Privacy
108
114
  - href: '/help/cookies'
109
115
  text: Cookies
110
116
  - href: '/contact'
111
117
  text: Contact
118
+ - href: '/help/accessibility-statement'
119
+ text: Accessibility statement
112
120
  - href: '/help/terms-conditions'
113
121
  text: Terms and conditions
114
122
  - href: '/cymraeg'
@@ -146,10 +154,14 @@ examples:
146
154
  items:
147
155
  - href: '/help'
148
156
  text: Help
157
+ - href: '/help/privacy-notice'
158
+ text: Privacy
149
159
  - href: '/help/cookies'
150
160
  text: Cookies
151
161
  - href: '/contact'
152
162
  text: Contact
163
+ - href: '/help/accessibility-statement'
164
+ text: Accessibility statement
153
165
  - href: '/help/terms-conditions'
154
166
  text: Terms and conditions
155
167
  - href: '/cymraeg'
@@ -27,6 +27,10 @@ examples:
27
27
  description: This allows the header to be omitted which is currently used when rendering CSV previews from Whitehall
28
28
  data:
29
29
  omit_header: true
30
+ omit_feedback:
31
+ description: This allows the feedback form to be omitted
32
+ data:
33
+ omit_feedback_form: true
30
34
  navigation:
31
35
  description: Passes the navigation through to the [header component](/component-guide/layout_header/).
32
36
  data:
@@ -65,6 +65,16 @@ examples:
65
65
  text: "Use GOV.UK Verify"
66
66
  hint_text: "You'll have an account if you've already proved your identity with a certified company, such as the Post Office."
67
67
  bold: true
68
+ with_bottom_margin:
69
+ description: "The component accepts a number for margin bottom from 0 to 9 (0px to 60px) using the [GOV.UK Frontend spacing scale](https://design-system.service.gov.uk/styles/spacing/#the-responsive-spacing-scale). It defaults to a margin bottom of 30px (6)."
70
+ data:
71
+ name: "radio-group"
72
+ margin_bottom: 9
73
+ items:
74
+ - value: "government-gateway"
75
+ text: "Use Government Gateway"
76
+ - value: "govuk-verify"
77
+ text: "Use GOV.UK Verify"
68
78
  with_hint_on_form_group:
69
79
  data:
70
80
  name: "radio-group-error"
@@ -8,8 +8,8 @@ Rails.application.config.assets.precompile += %w[
8
8
  component_guide/visual-regression.js
9
9
  component_guide/print.css
10
10
  govuk_publishing_components/rum-loader.js
11
- govuk_publishing_components/vendor/lux.js
12
- govuk_publishing_components/vendor/lux-polyfill.js
11
+ govuk_publishing_components/vendor/lux/lux-reporter.js
12
+ govuk_publishing_components/vendor/lux/lux-measurer.js
13
13
  govuk_publishing_components/all_components.js
14
14
  govuk_publishing_components/ie.js
15
15
  govuk_publishing_components/modules.js
@@ -39,7 +39,16 @@ module GovukPublishingComponents
39
39
  tracking_category: "breadcrumbClicked",
40
40
  tracking_action: tracking_action,
41
41
  tracking_label: content_item["base_path"],
42
- }.merge(custom_dimension_tracking)
42
+ tracking_dimension_enabled: false,
43
+ }
44
+ end
45
+
46
+ def brexit_audience
47
+ {
48
+ PRIORITY_TAXONS[:brexit_business] => "Brexitbusiness",
49
+ PRIORITY_TAXONS[:brexit_individuals] => "Brexitcitizen",
50
+ PRIORITY_TAXONS[:brexit_taxon] => "Brexitbusinessandcitizen",
51
+ }[taxon["content_id"]]
43
52
  end
44
53
 
45
54
  private
@@ -79,38 +88,16 @@ module GovukPublishingComponents
79
88
  [PRIORITY_TAXONS[:brexit_business], PRIORITY_TAXONS[:brexit_individuals]]
80
89
  end
81
90
 
82
- def brexit_taxons
83
- brexit_child_taxons << PRIORITY_TAXONS[:brexit_taxon]
84
- end
85
-
86
91
  def preferred_priority_taxon
87
92
  query_parameters["priority-taxon"] if query_parameters
88
93
  end
89
94
 
90
95
  def tracking_action
91
96
  action = %w[superBreadcrumb]
92
- action << page_name_for_tracking
97
+ action << brexit_audience
93
98
  action.compact.join(" ")
94
99
  end
95
100
 
96
- def custom_dimension_tracking
97
- tracking = { tracking_dimension_enabled: false }
98
- if brexit_taxons.include?(taxon["content_id"])
99
- tracking[:tracking_dimension_enabled] = true
100
- tracking[:tracking_dimension] = page_name_for_tracking
101
- tracking[:tracking_dimension_index] = 111
102
- end
103
- tracking
104
- end
105
-
106
- def page_name_for_tracking
107
- {
108
- PRIORITY_TAXONS[:brexit_business] => "Brexitbusiness",
109
- PRIORITY_TAXONS[:brexit_individuals] => "Brexitcitizen",
110
- PRIORITY_TAXONS[:brexit_taxon] => "Brexitbusinessandcitizen",
111
- }[taxon["content_id"]]
112
- end
113
-
114
101
  def tagged_to_both_brexit_child_taxons?
115
102
  t = priority_taxons.select { |taxon| brexit_child_taxon?(taxon) }
116
103
  t.uniq.count > 1
@@ -20,7 +20,8 @@ module GovukPublishingComponents
20
20
  meta_tags = add_organisation_tags(meta_tags)
21
21
  meta_tags = add_political_tags(meta_tags)
22
22
  meta_tags = add_taxonomy_tags(meta_tags)
23
- add_step_by_step_tags(meta_tags)
23
+ meta_tags = add_step_by_step_tags(meta_tags)
24
+ add_brexit_tags(meta_tags)
24
25
  end
25
26
 
26
27
  private
@@ -111,6 +112,27 @@ module GovukPublishingComponents
111
112
  meta_tags
112
113
  end
113
114
 
115
+ def add_brexit_tags(meta_tags)
116
+ links = content_item[:links]
117
+ taxons = links[:taxons] unless links.nil?
118
+
119
+ return meta_tags if taxons.blank?
120
+ return meta_tags unless tagged_to_priority_taxon?
121
+
122
+ audience = priority_taxon_helper.brexit_audience
123
+ meta_tags["govuk:brexit-audience"] = audience if audience.present?
124
+
125
+ meta_tags
126
+ end
127
+
128
+ def tagged_to_priority_taxon?
129
+ priority_taxon_helper.taxon.present?
130
+ end
131
+
132
+ def priority_taxon_helper
133
+ @priority_taxon_helper ||= ContentBreadcrumbsBasedOnPriority.new(content_item.deep_stringify_keys, request.query_parameters)
134
+ end
135
+
114
136
  def has_content_history?
115
137
  (content_item[:public_updated_at] && details[:first_public_at] && content_item[:public_updated_at] != details[:first_public_at]) ||
116
138
  (details[:change_history] && details[:change_history].size > 1)
@@ -330,10 +330,18 @@ module GovukPublishingComponents
330
330
  href: "/help",
331
331
  text: "Help",
332
332
  },
333
+ {
334
+ href: "/help/privacy-notice",
335
+ text: "Privacy",
336
+ },
333
337
  {
334
338
  href: "/help/cookies",
335
339
  text: "Cookies",
336
340
  },
341
+ {
342
+ href: "/help/accessibility-statement",
343
+ text: "Accessibility statement",
344
+ },
337
345
  {
338
346
  href: "/contact",
339
347
  text: "Contact",
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = "24.15.3".freeze
2
+ VERSION = "24.18.1".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_publishing_components
3
3
  version: !ruby/object:Gem::Version
4
- version: 24.15.3
4
+ version: 24.18.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Dev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-06-22 00:00:00.000000000 Z
11
+ date: 2021-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: govuk_app_config
@@ -198,14 +198,14 @@ dependencies:
198
198
  requirements:
199
199
  - - "~>"
200
200
  - !ruby/object:Gem::Version
201
- version: 3.7.0
201
+ version: 3.8.0
202
202
  type: :development
203
203
  prerelease: false
204
204
  version_requirements: !ruby/object:Gem::Requirement
205
205
  requirements:
206
206
  - - "~>"
207
207
  - !ruby/object:Gem::Version
208
- version: 3.7.0
208
+ version: 3.8.0
209
209
  - !ruby/object:Gem::Dependency
210
210
  name: jasmine_selenium_runner
211
211
  requirement: !ruby/object:Gem::Requirement
@@ -364,6 +364,7 @@ files:
364
364
  - app/assets/config/govuk_publishing_components_manifest.js
365
365
  - app/assets/images/govuk_publishing_components/action-link--nhs.png
366
366
  - app/assets/images/govuk_publishing_components/action-link--nhs.svg
367
+ - app/assets/images/govuk_publishing_components/action-link-arrow--brexit.svg
367
368
  - app/assets/images/govuk_publishing_components/action-link-arrow--dark.png
368
369
  - app/assets/images/govuk_publishing_components/action-link-arrow--dark.svg
369
370
  - app/assets/images/govuk_publishing_components/action-link-arrow--simple-light.png
@@ -486,6 +487,7 @@ files:
486
487
  - app/assets/javascripts/govuk_publishing_components/lib.js
487
488
  - app/assets/javascripts/govuk_publishing_components/lib/cookie-functions.js
488
489
  - app/assets/javascripts/govuk_publishing_components/lib/current-location.js
490
+ - app/assets/javascripts/govuk_publishing_components/lib/govspeak/all.js
489
491
  - app/assets/javascripts/govuk_publishing_components/lib/govspeak/barchart-enhancement.js
490
492
  - app/assets/javascripts/govuk_publishing_components/lib/govspeak/magna-charta.js
491
493
  - app/assets/javascripts/govuk_publishing_components/lib/govspeak/youtube-link-enhancement.js
@@ -501,9 +503,10 @@ files:
501
503
  - app/assets/javascripts/govuk_publishing_components/rum-loader.js.erb
502
504
  - app/assets/javascripts/govuk_publishing_components/vendor/html5shiv-printshiv.js
503
505
  - app/assets/javascripts/govuk_publishing_components/vendor/json2.js
504
- - app/assets/javascripts/govuk_publishing_components/vendor/lux/lux-polyfill.js
505
- - app/assets/javascripts/govuk_publishing_components/vendor/lux/lux.js
506
+ - app/assets/javascripts/govuk_publishing_components/vendor/lux/lux-measurer.js
507
+ - app/assets/javascripts/govuk_publishing_components/vendor/lux/lux-reporter.js
506
508
  - app/assets/javascripts/govuk_publishing_components/vendor/modernizr.js
509
+ - app/assets/javascripts/govuk_publishing_components/vendor/polyfills/all.js
507
510
  - app/assets/javascripts/govuk_publishing_components/vendor/polyfills/closest.js
508
511
  - app/assets/javascripts/govuk_publishing_components/vendor/polyfills/common.js
509
512
  - app/assets/javascripts/govuk_publishing_components/vendor/polyfills/indexOf.js