govuk_publishing_components 27.4.0 → 27.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (29) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -0
  3. data/app/assets/images/govuk_publishing_components/action-link-arrow--blue.png +0 -0
  4. data/app/assets/javascripts/govuk_publishing_components/analytics/explicit-cross-domain-links.js +38 -0
  5. data/app/assets/javascripts/govuk_publishing_components/analytics/init.js +19 -0
  6. data/app/assets/javascripts/govuk_publishing_components/analytics/scroll-tracker.js +0 -72
  7. data/app/assets/javascripts/govuk_publishing_components/lib/primary-links.js +32 -16
  8. data/app/assets/stylesheets/govuk_publishing_components/components/_action-link.scss +10 -4
  9. data/app/assets/stylesheets/govuk_publishing_components/components/_big-number.scss +8 -0
  10. data/app/assets/stylesheets/govuk_publishing_components/components/_input.scss +14 -4
  11. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_typography.scss +8 -0
  12. data/app/controllers/govuk_publishing_components/audit_controller.rb +11 -3
  13. data/app/views/govuk_publishing_components/audit/_components.html.erb +2 -2
  14. data/app/views/govuk_publishing_components/audit/show.html.erb +1 -1
  15. data/app/views/govuk_publishing_components/components/_big_number.html.erb +2 -1
  16. data/app/views/govuk_publishing_components/components/_devolved_nations.html.erb +2 -2
  17. data/app/views/govuk_publishing_components/components/_input.html.erb +2 -1
  18. data/app/views/govuk_publishing_components/components/_list.html.erb +7 -2
  19. data/app/views/govuk_publishing_components/components/docs/big_number.yml +7 -0
  20. data/app/views/govuk_publishing_components/components/docs/devolved_nations.yml +24 -14
  21. data/app/views/govuk_publishing_components/components/docs/govspeak.yml +4 -4
  22. data/app/views/govuk_publishing_components/components/docs/list.yml +8 -0
  23. data/app/views/govuk_publishing_components/components/docs/radio.yml +45 -40
  24. data/app/views/govuk_publishing_components/components/layout_for_public/_account-navigation.html.erb +2 -0
  25. data/config/locales/en.yml +5 -0
  26. data/lib/govuk_publishing_components/presenters/content_breadcrumbs_based_on_priority.rb +3 -17
  27. data/lib/govuk_publishing_components/presenters/devolved_nations_helper.rb +12 -1
  28. data/lib/govuk_publishing_components/version.rb +1 -1
  29. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 701cdbaae0e829d529cf36553c1fa9a0856b552d1933700c1789276209bc131f
4
- data.tar.gz: c2418c0148dfbf76fa3a689f50089d0f797216b68979a1056b3a08b84f56da98
3
+ metadata.gz: a177d643883dea8f63ce0c6931e9170ab46e4d50e3499b430c9a67ddb84cb2ca
4
+ data.tar.gz: e9b25ea90b6d0fd6269df2acf19a8d724884635ad0dbd84b4279e574737a30ac
5
5
  SHA512:
6
- metadata.gz: 6658563042e32a3a4f9f6bf2d8f883b4f9bfae2c4fdbc7148e3878dbbd0d993e13263af5f7510167467777aac84e225673be2eb29e14dc3474d32046494093a4
7
- data.tar.gz: 864f25f602249724ce5476e06918a9eb181edc0e9fb57ba394e578f0a95faa6790bab96733cc77d4bb69508b1b159dfc203412d7935ccb247b9938928c6fd4b9
6
+ metadata.gz: b1279ab602818802cf978a9742a8ba40ccdeef9478307c8f724dfa9d8b024ba33945b7dd8eaaa1f758f48c6a70d61957a3b1936db692d04b4c5fb439a7d7bc2d
7
+ data.tar.gz: 81a267c76307c65fc8a0cca680d82421e18e9e494a1d3a31b252563a05d6b88b38c3d1bb60c1b66bac958f7be668b918b2b9aab53b19f94ab599512e7bd6a5e8
data/README.md CHANGED
@@ -47,6 +47,7 @@ bin/rake app:jasmine:ci
47
47
  - [Code documentation on rubydoc.info](http://www.rubydoc.info/gems/govuk_publishing_components)
48
48
  - [Component conventions](docs/component_conventions.md)
49
49
  - [Component principles](docs/component_principles.md)
50
+ - [Component auditing](docs/auditing.md)
50
51
 
51
52
  ## Licence
52
53
 
@@ -8,6 +8,24 @@
8
8
  this.start = function ($module) {
9
9
  var element = $module[0]
10
10
 
11
+ var cookieBannerEngaged = GOVUK.cookie('cookies_preferences_set')
12
+
13
+ // If not engaged, append only ?cookie-consent=not-engaged
14
+ // If engaged and rejected, append only ?cookie-consent=reject
15
+ // If engaged and accepted usage, append ?_ga=clientid if available and cookie-consent=accept
16
+
17
+ if (cookieBannerEngaged === 'false') {
18
+ this.decorate(element, 'cookie_consent=not-engaged')
19
+ return
20
+ }
21
+ var cookieConsent = GOVUK.getConsentCookie()
22
+ if (cookieConsent.usage === false) {
23
+ this.decorate(element, 'cookie_consent=reject')
24
+ return
25
+ }
26
+
27
+ this.decorate(element, 'cookie_consent=accept')
28
+
11
29
  if (!global.ga) { return }
12
30
 
13
31
  global.ga(function () {
@@ -28,6 +46,26 @@
28
46
  }
29
47
  })
30
48
  }
49
+
50
+ this.decorate = function (element, param) {
51
+ var attribute = 'href'
52
+ var attributeValue = element.getAttribute(attribute)
53
+
54
+ if (!attributeValue) {
55
+ attribute = 'action'
56
+ attributeValue = element.getAttribute(attribute)
57
+ }
58
+
59
+ if (!attributeValue) { return }
60
+
61
+ if (attributeValue.includes('?')) {
62
+ attributeValue += '&' + param
63
+ element.setAttribute(attribute, attributeValue)
64
+ } else {
65
+ attributeValue += '?' + param
66
+ element.setAttribute(attribute, attributeValue)
67
+ }
68
+ }
31
69
  }
32
70
 
33
71
  global.GOVUK = GOVUK
@@ -8,6 +8,25 @@ var analyticsInit = function () {
8
8
  var linkedDomains = window.GOVUK.analyticsVars.linkedDomains || false
9
9
  }
10
10
 
11
+ window.GOVUK.Analytics.checkDigitalIdentityConsent = function (location) {
12
+ if (!location || !location.search) return
13
+ // this checks for the presence of the Digital Identity cookie consent query parameter and updates our consent cookie accordingly
14
+ // This is so that users don't see multiple cookie banners when they move between the different account management pages, as some will be on GOV.UK and others will be on the DI domain.
15
+ var digitalIdentityConsent = /([?&]cookie_consent=)(accept|reject)/.exec(location.search)
16
+ if (digitalIdentityConsent) {
17
+ if (digitalIdentityConsent[2] === 'accept') {
18
+ window.GOVUK.setConsentCookie({ usage: true })
19
+ // set cookies_preferences_set to true to prevent cookie banner showing
20
+ window.GOVUK.cookie('cookies_preferences_set', 'true')
21
+ } else if (digitalIdentityConsent[2] === 'reject') {
22
+ window.GOVUK.setConsentCookie({ usage: false })
23
+ window.GOVUK.cookie('cookies_preferences_set', 'true')
24
+ }
25
+ }
26
+ }
27
+
28
+ window.GOVUK.Analytics.checkDigitalIdentityConsent(window.location)
29
+
11
30
  var consentCookie = window.GOVUK.getConsentCookie()
12
31
  var dummyAnalytics = {
13
32
  addLinkedTrackerDomain: function () {},
@@ -15,7 +15,6 @@
15
15
 
16
16
  var CONFIG = {
17
17
  '/brexit': percentages,
18
- '/guidance/coronavirus-covid-19-information-for-the-public': percentages,
19
18
  '/government/publications/the-essential-trustee-what-you-need-to-know-cc3/the-essential-trustee-what-you-need-to-know-what-you-need-to-do': [
20
19
  ['Heading', '1. About this guidance'],
21
20
  ['Heading', '2. Trustees’ duties at a glance'],
@@ -59,13 +58,6 @@
59
58
  '/guidance/foreign-travel-insurance': [
60
59
  ['Heading', 'What your travel insurance policy should cover']
61
60
  ],
62
- '/guidance/social-security-contributions-for-uk-and-eu-workers-if-the-uk-leaves-the-eu-with-no-deal': [
63
- ['Heading', 'UK employers'],
64
- ['Heading', 'UK employees and self-employed']
65
- ],
66
- '/guidance/student-finance-arrangements-in-a-no-deal-scenario': [
67
- ['Heading', 'Other overseas study placements']
68
- ],
69
61
  '/guidance/living-in-france': [
70
62
  ['Heading', 'Passports and travel']
71
63
  ],
@@ -75,12 +67,6 @@
75
67
  '/guidance/healthcare-for-eu-and-efta-citizens-visiting-the-uk': [
76
68
  ['Heading', 'Travel insurance']
77
69
  ],
78
- '/guidance/driving-in-the-eu-after-brexit': [
79
- ['Heading', 'GB stickers and number plates']
80
- ],
81
- '/guidance/driving-in-the-eu-after-brexit#insurance-for-your-vehicle-caravan-or-trailer': [
82
- ['Heading', 'Trailer registration']
83
- ],
84
70
  '/driving-abroad': [
85
71
  ['Heading', 'Check your insurance if you’re taking your own vehicle']
86
72
  ],
@@ -90,64 +76,21 @@
90
76
  '/driving-abroad/international-driving-permit': [
91
77
  ['Heading', 'Check which IDP you need']
92
78
  ],
93
- '/guidance/driving-in-the-eu-after-brexit#gb-stickers-and-number-plates': [
94
- ['Heading', 'GB stickers and number plates']
95
- ],
96
79
  '/guidance/guidance-for-suppliers-of-cattle-sheep-and-goat-ear-tags': [
97
80
  ['Heading', 'Tagging information for livestock keepers']
98
81
  ],
99
- '/guidance/wine-trade-regulations': [
100
- ['Heading', 'Rules for transporting wine into the UK']
101
- ],
102
- '/guidance/the-chemicals-sector-and-preparing-for-eu-exit': [
103
- ['Heading', 'Energy and climate']
104
- ],
105
82
  '/guidance/how-to-move-goods-between-or-through-common-transit-countries-including-the-eu': [
106
83
  ['Heading', 'Start moving your goods']
107
84
  ],
108
85
  '/guidance/ecmt-international-road-haulage-permits': [
109
86
  ['Heading', 'Apply for permits']
110
87
  ],
111
- '/guidance/prepare-to-drive-in-the-eu-after-brexit-lorry-and-goods-vehicle-drivers': [
112
- ['Heading', 'Driver CPC for lorry drivers']
113
- ],
114
- '/guidance/run-international-bus-or-coach-services-after-brexit': [
115
- ['Heading', 'Run regular international services']
116
- ],
117
- '/guidance/vehicle-type-approval-if-theres-no-brexit-deal': [
118
- ['Heading', 'Existing vehicle and component type-approvals']
119
- ],
120
- '/guidance/the-retail-sector-and-preparing-for-eu-exit': [
121
- ['Heading', 'Importing and exporting']
122
- ],
123
- '/guidance/the-consumer-goods-sector-and-preparing-for-eu-exit': [
124
- ['Heading', 'Importing and exporting']
125
- ],
126
- '/government/publications/banking-insurance-and-other-financial-services-if-theres-no-brexit-deal/banking-insurance-and-other-financial-services-if-theres-no-brexit-deal-information-for-financial-services-institutions': [
127
- ['Heading', '3. Action taken by the UK']
128
- ],
129
- '/government/publications/further-guidance-note-on-the-regulation-of-medicines-medical-devices-and-clinical-trials-if-theres-no-brexit-deal/further-guidance-note-on-the-regulation-of-medicines-medical-devices-and-clinical-trials-if-theres-no-brexit-deal': [
130
- ['Heading', '1.4 Orphan medicines']
131
- ],
132
- '/guidance/check-temporary-rates-of-customs-duty-on-imports-after-eu-exit': [
133
- ['Heading', 'Tariff-rate quotas (TRQ)']
134
- ],
135
- '/guidance/construction-products-regulation-if-there-is-no-brexit-deal': [
136
- ['Heading', 'UK manufacturers exporting to the EU']
137
- ],
138
- '/guidance/european-and-domestic-funding-after-brexit': [
139
- ['Heading', 'What you need to do']
140
- ],
141
- '/guidance/guidance-on-substantial-amendments-to-a-clinical-trial-if-the-uk-leaves-the-eu-with-no-deal': [
142
- ['Heading', 'Investigational medicinal product (IMP) certification and importation']
143
- ],
144
88
  '/taking-goods-out-uk-temporarily/get-an-ata-carnet': [
145
89
  ['Heading', 'Using an ATA Carnet']
146
90
  ],
147
91
  '/wood-packaging-import-export': [
148
92
  ['Heading', 'Export solid wood packaging']
149
93
  ],
150
- '/guidance/answers-to-the-most-common-topics-asked-about-by-the-public-for-the-coronavirus-press-conference': percentages,
151
94
  '/coronavirus': percentages,
152
95
  '/coronavirus/education-and-childcare': percentages,
153
96
  '/coronavirus/worker-support': percentages,
@@ -164,21 +107,6 @@
164
107
  '/guidance/brexit-guidance-for-individuals-and-families': percentages,
165
108
  '/guidance/brexit-guidance-for-individuals-and-families.cy': percentages,
166
109
  '/guidance/import-and-export-goods-using-preference-agreements': percentages,
167
- '/guidance/red-amber-and-green-list-rules-for-entering-england': [
168
- ['Heading', 'Stay up-to-date'],
169
- ['Heading', 'Red list of countries and territories'],
170
- ['Heading', 'Amber list of countries and territories'],
171
- ['Heading', 'Amber list rules if you are fully UK vaccinated'],
172
- ['Heading', 'Amber list rules if you are not fully UK vaccinated'],
173
- ['Heading', 'Green list countries and territories'],
174
- ['Heading', 'Green list rules'],
175
- ['Heading', 'Ireland, the UK, the Channel Islands and the Isle of Man'],
176
- ['Heading', 'Transit stops in amber or red list countries'],
177
- ['Heading', 'Job and medical exemptions'],
178
- ['Heading', 'Travelling abroad from England'],
179
- ['Heading', 'Demonstrating your COVID-19 vaccination status when travelling abroad'],
180
- ['Heading', 'Foreign, Commonwealth & Development Office travel advice']
181
- ],
182
110
  '/guidance/travel-abroad-from-england-during-coronavirus-covid-19': [
183
111
  ['Heading', 'Before you travel abroad'],
184
112
  ['Heading', '1. Check the rules for the country you’re going to'],
@@ -2,15 +2,14 @@
2
2
  ;(function (global) {
3
3
  'use strict'
4
4
 
5
- var $ = global.jQuery
6
5
  var GOVUK = global.GOVUK || {}
7
6
 
8
7
  // Only show the first {n} items in a list, documentation is in the README.md
9
8
  var PrimaryList = function (el, selector) {
10
- this.$el = $(el)
11
- this.$extraLinks = this.$el.find('li:not(' + selector + ')')
9
+ this.el = el
10
+ this.extraLinks = this.el.querySelectorAll('li:not(' + selector + ')')
12
11
  // only hide more than one extra link
13
- if (this.$extraLinks.length > 1) {
12
+ if (this.extraLinks.length > 1) {
14
13
  this.addToggleLink()
15
14
  this.hideExtraLinks()
16
15
  }
@@ -18,29 +17,35 @@
18
17
 
19
18
  PrimaryList.prototype = {
20
19
  toggleText: function () {
21
- if (this.$extraLinks.length > 1) {
22
- return '+' + this.$extraLinks.length + ' others'
20
+ if (this.extraLinks.length > 1) {
21
+ return '+' + this.extraLinks.length + ' others'
23
22
  } else {
24
- return '+' + this.$extraLinks.length + ' other'
23
+ return '+' + this.extraLinks.length + ' other'
25
24
  }
26
25
  },
27
26
  addToggleLink: function () {
28
- this.$toggleLink = $('<a href="#">' + this.toggleText() + '</a>')
29
- this.$toggleLink.click($.proxy(this.toggleLinks, this))
30
- this.$toggleLink.insertAfter(this.$el)
27
+ this.toggleLink = document.createElement('a')
28
+ this.toggleLink.href = '#'
29
+ this.toggleLink.setAttribute('aria-expanded', 'false')
30
+ this.toggleLink.innerText = this.toggleText()
31
+
32
+ this.el.parentNode.insertBefore(this.toggleLink, this.el.nextSibling)
33
+ this.toggleLink.addEventListener('click', this.toggleLinks.bind(this))
31
34
  },
32
35
  toggleLinks: function (e) {
33
36
  e.preventDefault()
34
- this.$toggleLink.remove()
37
+ this.toggleLink.remove()
35
38
  this.showExtraLinks()
36
39
  },
37
40
  hideExtraLinks: function () {
38
- this.$extraLinks.addClass('visuallyhidden')
39
- $(window).trigger('govuk.pageSizeChanged')
41
+ for (var i = 0; i < this.extraLinks.length; i++) {
42
+ this.extraLinks[i].className = 'primary-links--display-none'
43
+ }
40
44
  },
41
45
  showExtraLinks: function () {
42
- this.$extraLinks.removeClass('visuallyhidden')
43
- $(window).trigger('govuk.pageSizeChanged')
46
+ for (var i = 0; i < this.extraLinks.length; i++) {
47
+ this.extraLinks[i].className = ''
48
+ }
44
49
  }
45
50
  }
46
51
 
@@ -48,7 +53,18 @@
48
53
 
49
54
  GOVUK.primaryLinks = {
50
55
  init: function (selector) {
51
- $(selector).parent().each(function (i, el) {
56
+ var allListItems = document.querySelectorAll(selector)
57
+ var AllLists = []
58
+
59
+ for (var i = 0; i < allListItems.length; i++) {
60
+ var parent = allListItems[i].parentNode
61
+
62
+ if (AllLists.indexOf(parent) < 0) {
63
+ AllLists.push(parent)
64
+ }
65
+ }
66
+
67
+ AllLists.forEach(function (el, i) {
52
68
  new GOVUK.PrimaryList(el, selector) // eslint-disable-line no-new
53
69
  })
54
70
  }
@@ -94,13 +94,19 @@
94
94
 
95
95
  .gem-c-action-link--blue-arrow {
96
96
  &:before {
97
- width: 35px;
98
- height: 30px;
97
+ width: 36px;
98
+ height: 28px;
99
99
  background: image-url("govuk_publishing_components/action-link-arrow--blue.png");
100
100
  background: image-url("govuk_publishing_components/action-link-arrow--blue.svg"), linear-gradient(transparent, transparent);
101
101
  background-repeat: no-repeat;
102
- background-size: 25px auto;
103
- background-position: 0 2px;
102
+ background-size: 28px auto;
103
+ background-position: 0 0;
104
+
105
+ @include govuk-media-query($from: tablet) {
106
+ width: 45px;
107
+ height: 35px;
108
+ background-size: 35px auto;
109
+ }
104
110
  }
105
111
  }
106
112
 
@@ -38,4 +38,12 @@
38
38
  @include govuk-link-hover-decoration;
39
39
  }
40
40
  }
41
+
42
+ &:focus,
43
+ &:focus:hover {
44
+ .gem-c-big-number__label,
45
+ .gem-c-big-number__value--decorated {
46
+ text-decoration: none;
47
+ }
48
+ }
41
49
  }
@@ -1,8 +1,18 @@
1
1
  @import "govuk/components/input/input";
2
+ $search-icon-size: 40px;
2
3
 
3
- .gem-c-input--search-icon {
4
- background: govuk-colour("white") url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 36 36' width='40' height='40'%3E%3Cpath d='M25.7 24.8L21.9 21c.7-1 1.1-2.2 1.1-3.5 0-3.6-2.9-6.5-6.5-6.5S10 13.9 10 17.5s2.9 6.5 6.5 6.5c1.6 0 3-.6 4.1-1.5l3.7 3.7 1.4-1.4zM12 17.5c0-2.5 2-4.5 4.5-4.5s4.5 2 4.5 4.5-2 4.5-4.5 4.5-4.5-2-4.5-4.5z' fill='currentColor'%3E%3C/path%3E%3C/svg%3E") no-repeat -5px -3px;
5
- padding-left: govuk-spacing(6);
4
+ .gem-c-input__search-icon {
5
+ display: block;
6
+ position: relative;
7
+ margin-bottom: -$search-icon-size;
8
+ z-index: 1;
9
+ width: $search-icon-size;
10
+ height: $search-icon-size;
11
+ @if $govuk-typography-use-rem {
12
+ margin-bottom: -(govuk-px-to-rem($search-icon-size));
13
+ height: govuk-px-to-rem($search-icon-size);
14
+ }
15
+ background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 36 36' width='40' height='40'%3E%3Cpath d='M25.7 24.8L21.9 21c.7-1 1.1-2.2 1.1-3.5 0-3.6-2.9-6.5-6.5-6.5S10 13.9 10 17.5s2.9 6.5 6.5 6.5c1.6 0 3-.6 4.1-1.5l3.7 3.7 1.4-1.4zM12 17.5c0-2.5 2-4.5 4.5-4.5s4.5 2 4.5 4.5-2 4.5-4.5 4.5-4.5-2-4.5-4.5z' fill='currentColor'%3E%3C/path%3E%3C/svg%3E") no-repeat -3px center;
6
16
  }
7
17
 
8
18
  // this overrides styles from static that break the look of the component
@@ -14,7 +24,7 @@
14
24
  padding: govuk-spacing(1);
15
25
  box-sizing: border-box;
16
26
 
17
- &.gem-c-input--search-icon {
27
+ &.gem-c-input--with-search-icon {
18
28
  padding-left: govuk-spacing(6);
19
29
  }
20
30
  }
@@ -108,3 +108,11 @@
108
108
  @include govuk-link-style-inverse;
109
109
  }
110
110
  }
111
+
112
+ // This helper class is for use by the primary links js module
113
+ // We have this custom helper here with a single rule over using the design system helper class govuk-!-display-none
114
+ // because jasmine tests don't like the "!" in the distributed helper class
115
+
116
+ .primary-links--display-none {
117
+ display: none;
118
+ }
@@ -31,9 +31,14 @@ module GovukPublishingComponents
31
31
 
32
32
  gem_path = Gem.loaded_specs["govuk_publishing_components"].full_gem_path
33
33
  gem_path = Dir.pwd if ENV["MAIN_COMPONENT_GUIDE"]
34
+ host_dir = File.expand_path("..")
35
+ path = File.expand_path("..", gem_path)
36
+
37
+ @in_application = false
38
+ @in_application = true unless path.to_s == host_dir.to_s
34
39
 
35
40
  components = AuditComponents.new(gem_path, false)
36
- applications = analyse_applications(File.expand_path("..", gem_path), application_dirs)
41
+ applications = analyse_applications(host_dir, application_dirs)
37
42
  compared_data = AuditComparer.new(components.data, applications, false)
38
43
 
39
44
  @applications = compared_data.applications_data || []
@@ -44,15 +49,18 @@ module GovukPublishingComponents
44
49
 
45
50
  def analyse_applications(path, application_dirs)
46
51
  results = []
47
- @applications_found = false
52
+ applications_found = 0
48
53
 
49
54
  application_dirs.each do |application|
50
55
  application_path = [path, application].join("/")
51
56
  app = AuditApplications.new(application_path, application)
52
- @applications_found = true if app.data[:application_found]
57
+ applications_found += 1 if app.data[:application_found]
53
58
  results << app.data
54
59
  end
55
60
 
61
+ @other_applications = false
62
+ @other_applications = true if applications_found > 1
63
+
56
64
  results
57
65
  end
58
66
  end
@@ -1,4 +1,4 @@
1
- <% if @applications_found %>
1
+ <% if @other_applications %>
2
2
  <%= render "govuk_publishing_components/components/heading", {
3
3
  text: "Components",
4
4
  font_size: "l",
@@ -101,7 +101,7 @@
101
101
  }
102
102
  %>
103
103
 
104
- <% if @applications_found %>
104
+ <% if @other_applications %>
105
105
  <% components_by_application = capture do %>
106
106
  <% if @components[:components_by_application].any? %>
107
107
  <dl class="govuk-summary-list">
@@ -10,7 +10,7 @@
10
10
  <%= render "components" %>
11
11
  <% end %>
12
12
 
13
- <% if @applications_found %>
13
+ <% if @in_application or @other_applications %>
14
14
  <%= render "govuk_publishing_components/components/tabs", {
15
15
  tabs: [
16
16
  {
@@ -4,6 +4,7 @@
4
4
  label ||= nil
5
5
  href ||= nil
6
6
  data_attributes ||= nil
7
+ aria ||= nil
7
8
  classes = ["gem-c-big-number__value"]
8
9
 
9
10
  if label.nil? && href
@@ -25,7 +26,7 @@
25
26
  <% end %>
26
27
  <% end %>
27
28
 
28
- <%= tag.div class: "gem-c-big-number" do %>
29
+ <%= tag.div class: "gem-c-big-number", aria: aria do %>
29
30
  <% unless href.nil? %>
30
31
  <%= link_to big_number_value, href, class: "govuk-link gem-c-big-number__link", data: data_attributes %>
31
32
  <% else %>
@@ -2,7 +2,7 @@
2
2
  shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
3
3
  devolved_nations_helper = GovukPublishingComponents::Presenters::DevolvedNationsHelper.new(local_assigns)
4
4
 
5
- applies_to ||= t('components.devolved_nations.applies_to')
5
+ applies_to ||= t("components.devolved_nations.applies_to")
6
6
  heading_level ||= 2
7
7
  %>
8
8
 
@@ -15,7 +15,7 @@
15
15
  <% if devolved_nations_helper.nations_with_urls.any? %>
16
16
  <%= content_tag :ul, class: "govuk-list govuk-!-margin-top-1 govuk-!-margin-bottom-0" do -%>
17
17
  <% devolved_nations_helper.nations_with_urls.each do |k, v| %>
18
- <%= content_tag(:li, link_to("Guidance for #{t("components.devolved_nations.#{k}")}", v[:alternative_url], class: "govuk-link")) %>
18
+ <%= content_tag(:li, link_to(devolved_nations_helper.alternative_content_text(k), v[:alternative_url], class: "govuk-link")) %>
19
19
  <% end %>
20
20
  <% end %>
21
21
  <% end %>
@@ -31,7 +31,7 @@
31
31
  css_classes = %w(gem-c-input govuk-input)
32
32
  css_classes << "govuk-input--error" if has_error
33
33
  css_classes << "govuk-input--width-#{width}" if [2, 3, 4, 5, 10, 20, 30].include?(width)
34
- css_classes << "gem-c-input--search-icon" if search_icon
34
+ css_classes << "gem-c-input--with-search-icon" if search_icon
35
35
  form_group_css_classes = %w(govuk-form-group)
36
36
  form_group_css_classes << "govuk-form-group--error" if has_error && !grouped
37
37
 
@@ -120,6 +120,7 @@
120
120
  <%= input_tag %><%= tag.span suffix, class: "govuk-input__suffix", aria: { hidden: true } %>
121
121
  <% end %>
122
122
  <% else %>
123
+ <%= tag.span class: "gem-c-input__search-icon" if search_icon %>
123
124
  <%= input_tag %>
124
125
  <% end %>
125
126
  <% end %>
@@ -6,10 +6,15 @@
6
6
  list_type ||= "unordered"
7
7
  visible_counters ||= nil
8
8
 
9
+ shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
10
+
9
11
  classes = %w[gem-c-list govuk-list]
10
- classes << "govuk-list--bullet" if visible_counters && list_type === "unordered"
11
- classes << "govuk-list--number" if visible_counters && list_type === "number"
12
+ classes << "govuk-list--bullet" if visible_counters and list_type === "unordered"
13
+ classes << "govuk-list--number" if visible_counters and list_type === "number"
12
14
  classes << "govuk-list--spaced" if extra_spacing
15
+ # Setting the `margin_bottom` to 4 is the same as the default margin - so we
16
+ # can omit the override class. To do this we leave out `4` from the array:
17
+ classes << (shared_helper.get_margin_bottom) if [0,1,2,3,5,6,7,8,9].include?(local_assigns[:margin_bottom])
13
18
 
14
19
  # Default list type is unordered list.
15
20
  list_tag = "ul"
@@ -54,3 +54,10 @@ examples:
54
54
  label: Ministerial departments
55
55
  data_attributes:
56
56
  department-count: true
57
+ with_aria_attributes:
58
+ description: Aria attributes are applied to the whole component instance
59
+ data:
60
+ number: 23
61
+ label: Ministerial departments
62
+ aria:
63
+ hidden: true
@@ -1,18 +1,18 @@
1
1
  name: Devolved Nations (experimental)
2
- description: A banner for linking to guidance for other nations.
2
+ description: A banner for linking to alternative content for other nations.
3
3
  body: |
4
- The component replaces uses of the important metadata component for guidance for other nations.
4
+ The component replaces uses of the important metadata component for alternative content for other nations.
5
5
 
6
6
  The component can display:
7
7
 
8
- * nations that the guidance relates to
8
+ * nations that the alternative content relates to
9
9
  * a list of alternative URLs where applicable
10
10
  shared_accessibility_criteria:
11
11
  - link
12
12
  accessibility_criteria: |
13
13
  The component must:
14
14
 
15
- - Provide context for link text to highlight guidance is available.
15
+ - Provide context for link text to highlight alternative content is available.
16
16
  examples:
17
17
  default:
18
18
  data:
@@ -35,18 +35,22 @@ examples:
35
35
  applicable: true
36
36
  wales:
37
37
  applicable: true
38
- applies_to_one_nation_individual_guidance_available:
38
+ applies_to_one_nation_individual_publication_available:
39
+ description: If no content type, or an invalid type, is specified then the default alternative content type is displayed as "Publication" e.g. "Publication for Northern Ireland"
39
40
  data:
40
41
  national_applicability:
41
42
  england:
42
43
  applicable: true
44
+ northern_ireland:
45
+ applicable: false
46
+ alternative_url: /
43
47
  scotland:
44
48
  applicable: false
45
49
  alternative_url: /
46
50
  wales:
47
51
  applicable: false
48
52
  alternative_url: /
49
- applies_to_one_nation_individual_guidance_available:
53
+ applies_to_three_nations_individual_publication_available:
50
54
  data:
51
55
  national_applicability:
52
56
  england:
@@ -55,12 +59,21 @@ examples:
55
59
  applicable: false
56
60
  alternative_url: /
57
61
  scotland:
58
- applicable: false
59
- alternative_url: /
62
+ applicable: true
60
63
  wales:
64
+ applicable: true
65
+ applies_to_one_nation_individual_consultation_available:
66
+ description: Specify alternative type for the content e.g. Consultation
67
+ data:
68
+ national_applicability:
69
+ england:
70
+ applicable: true
71
+ northern_ireland:
61
72
  applicable: false
62
73
  alternative_url: /
63
- applies_to_three_nations_individual_guidance_available:
74
+ type: consultation
75
+ applies_to_one_nation_individual_guidance_available:
76
+ description: Specify alternative type for the content e.g. Guidance
64
77
  data:
65
78
  national_applicability:
66
79
  england:
@@ -68,12 +81,9 @@ examples:
68
81
  northern_ireland:
69
82
  applicable: false
70
83
  alternative_url: /
71
- scotland:
72
- applicable: true
73
- wales:
74
- applicable: true
84
+ type: detailed_guide
75
85
  specific_heading level:
76
- description: Use a different heading level for the main link title. Defaults to H2 if not passed.
86
+ description: Use a different heading level for the main link title. Defaults to `H2` if not passed.
77
87
  data:
78
88
  heading_level: 3
79
89
  national_applicability:
@@ -439,16 +439,16 @@ examples:
439
439
  statistic_headlines:
440
440
  data:
441
441
  block: |
442
- <aside class="stat-headline">
442
+ <div class="stat-headline">
443
443
  <p><em>£6bn</em>
444
444
  Total Departmental Expenditure Limit (<abbr title="Departmental Expenditure Limit">DEL</abbr>) in financial year 2015 to 2016</p>
445
- </aside>
445
+ </div>
446
446
  <p>This includes £5.8 billion Resource <abbr title="Departmental Expenditure Limit">DEL</abbr> and £0.2 billion Capital <abbr title="Departmental Expenditure Limit">DEL</abbr>. In addition, <abbr title="Department for Work and Pensions">DWP</abbr> Annually Managed Expenditure (<abbr title="Annually Managed Expenditure">AME</abbr>) in financial year 2015 to 2016 is £170.5 billion, as forecast by the Office for Budget Responsibility.</p>
447
- <aside class="stat-headline">
447
+ <div class="stat-headline">
448
448
  <p>UK employment rate
449
449
  <em>74.1%</em>
450
450
  between October and December 2015</p>
451
- </aside>
451
+ </div>
452
452
  specialist_content:
453
453
  data:
454
454
  block: |
@@ -62,3 +62,11 @@ examples:
62
62
  data:
63
63
  id: 'super-fantastic-chocolate-list'
64
64
  <<: *default-example-data
65
+ with_margin:
66
+ description: |
67
+ Sets the margin on the bottom of the list element.
68
+
69
+ 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 having a 20px margin.
70
+ data:
71
+ margin_bottom: 9
72
+ <<: *default-example-data
@@ -11,7 +11,7 @@ accessibility_criteria: |
11
11
  - be focusable with a keyboard
12
12
  - be usable with a keyboard
13
13
  - indicate when they have focus
14
- - change in appearance when touched (in the touch-down state)
14
+ - change in appearance when active (in the active state)
15
15
  - be usable with touch
16
16
  - have label with a touch area similar to the input
17
17
  - be usable with [voice commands](https://www.w3.org/WAI/perspectives/voice.html)
@@ -53,7 +53,7 @@ examples:
53
53
  - value: "govuk-verify"
54
54
  text: "Use GOV.UK Verify"
55
55
  with_bold:
56
- description: 'Used to provide better contrast between long labels and hint text, Note that the `:or` option [is documented as a string due to a bug](https://github.com/alphagov/govuk_publishing_components/issues/102)'
56
+ description: Used to provide better contrast between long labels and hint text, Note that the `:or` option [is documented as a string due to a bug](https://github.com/alphagov/govuk_publishing_components/issues/102)
57
57
  data:
58
58
  name: "radio-group-bold"
59
59
  items:
@@ -66,7 +66,7 @@ examples:
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
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)."
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
70
  data:
71
71
  name: "radio-group"
72
72
  margin_bottom: 9
@@ -85,16 +85,50 @@ examples:
85
85
  text: "Use Government Gateway"
86
86
  - value: "govuk-verify"
87
87
  text: "Use GOV.UK Verify"
88
- with_heading:
89
- description: This adds a legend element containing the text supplied.
88
+ with_legend:
89
+ description: |
90
+ Legend text is automatically wrapped inside a `h2`. To render the text without it, `heading_level` must be set to `0`.
90
91
  data:
91
- name: "radio-group-heading"
92
- heading: "Are you hungry?"
92
+ name: "radio-group-legend"
93
+ heading: "What's it to do with?"
94
+ heading_level: 0
93
95
  items:
94
96
  - value: "yes"
95
97
  text: "Yes"
96
98
  - value: "no"
97
99
  text: "No"
100
+ with_heading:
101
+ description: |
102
+ By default, text supplied for the `legend` is wrapped inside a `h2`.
103
+
104
+ The font size of this heading can be changed using the `heading_size` option. Valid options are `s`, `m`, `l`, `xl`, defaulting to `m` if no option is passed.
105
+ data:
106
+ name: "radio-group-description"
107
+ heading: "What is your favourite colour?"
108
+ heading_size: "s"
109
+ items:
110
+ - value: "red"
111
+ text: "Red"
112
+ - value: "green"
113
+ text: "Green"
114
+ - value: "blue"
115
+ text: "Blue"
116
+ with_different_heading_level:
117
+ description: |
118
+ By default, text supplied for the `legend` is wrapped inside a `h2`. This can be changed using the `heading_level` option.
119
+
120
+ If `heading_level` is `1` and `heading_size` is not set, the text size will be `xl`.
121
+ data:
122
+ name: "radio-group-description"
123
+ heading: "What is your favourite colour?"
124
+ heading_level: 1
125
+ items:
126
+ - value: "red"
127
+ text: "Red"
128
+ - value: "green"
129
+ text: "Green"
130
+ - value: "blue"
131
+ text: "Blue"
98
132
  with_heading_and_hint:
99
133
  data:
100
134
  name: "radio-group-heading"
@@ -109,9 +143,9 @@ examples:
109
143
  text: "Blue"
110
144
  with_page_header_and_caption:
111
145
  description: |
112
- If a caption text is provided with a page heading, it will be displayed above the heading.
113
- A caption can only be used with a page heading. If a heading is not provided the caption will not render.
114
- The pattern is used across GOV.UK to show a high-level section that this page question falls into.
146
+ A caption can be added using the `heading_caption` option. Captions will only be displayed if text for the heading option is present.
147
+
148
+ The pattern is used across GOV.UK to show a high-level section that this page belongs to.
115
149
  data:
116
150
  name: "radio-group-heading"
117
151
  heading: "Is it snowing?"
@@ -181,35 +215,6 @@ examples:
181
215
  text: "Green"
182
216
  - value: "blue"
183
217
  text: "Blue"
184
- with_custom_heading_size:
185
- description: |
186
- This allows the size of the legend to be changed. Valid options are s, m, l, xl, defaulting to m if no option is passed.
187
-
188
- If heading_level is 1 and heading_size is not set, the text size will be xl.
189
- data:
190
- name: "radio-group-description"
191
- heading: "What is your favourite colour?"
192
- heading_size: "s"
193
- items:
194
- - value: "red"
195
- text: "Red"
196
- - value: "green"
197
- text: "Green"
198
- - value: "blue"
199
- text: "Blue"
200
- with_custom_heading_level:
201
- description: This allows the heading level to be changed. Heading level will default to `h2` if nothing is passed.
202
- data:
203
- name: "radio-group-description"
204
- heading: "What is your favourite colour?"
205
- heading_level: 3
206
- items:
207
- - value: "red"
208
- text: "Red"
209
- - value: "green"
210
- text: "Green"
211
- - value: "blue"
212
- text: "Blue"
213
218
  with_hint_text_on_radios:
214
219
  data:
215
220
  name: "radio-group-hint-text"
@@ -248,7 +253,7 @@ examples:
248
253
  - value: "govuk-verify"
249
254
  text: "Use GOV.UK Verify"
250
255
  with_or_divider:
251
- description: "See [related service manual gudiance for this pattern](https://www.gov.uk/service-manual/design/writing-for-user-interfaces#ask-questions-that-users-can-understand)"
256
+ description: "See [related service manual guidance for this pattern](https://www.gov.uk/service-manual/design/writing-for-user-interfaces#ask-questions-that-users-can-understand)"
252
257
  data:
253
258
  name: "radio-group-or-divider"
254
259
  items:
@@ -16,6 +16,7 @@
16
16
  GovukPersonalisation::Urls.manage,
17
17
  class: 'gem-c-layout-for-public-account-menu__link govuk-link govuk-link--no-visited-state',
18
18
  'aria-current': page_is == "manage" ? "page" : nil,
19
+ data: { module: "explicit-cross-domain-links" },
19
20
  ) %>
20
21
  </li>
21
22
  <li class="gem-c-layout-for-public-account-menu__item <%= "gem-c-layout-for-public-account-menu__item--current" if page_is == "security" %>">
@@ -24,6 +25,7 @@
24
25
  GovukPersonalisation::Urls.security,
25
26
  class: 'gem-c-layout-for-public-account-menu__link govuk-link govuk-link--no-visited-state',
26
27
  'aria-current': page_is == "security" ? "page" : nil,
28
+ data: { module: "explicit-cross-domain-links" },
27
29
  ) %>
28
30
  </li>
29
31
  </ul>
@@ -51,6 +51,11 @@ en:
51
51
  connectors:
52
52
  last_word: " and "
53
53
  two_words: " and "
54
+ type:
55
+ consultation: Consultation for %{nation}
56
+ detailed_guide: Guidance for %{nation}
57
+ guidance: Guidance for %{nation}
58
+ publication: Publication for %{nation}
54
59
  england: England
55
60
  northern_ireland: Northern Ireland
56
61
  scotland: Scotland
@@ -4,18 +4,12 @@ module GovukPublishingComponents
4
4
  # keys are labels, values are the content_ids for the matching taxons
5
5
  # Where multiple matching taxons are present, the top most one is the highest priority
6
6
  # and the bottom one the lowest priority
7
- BREXIT_TAXONS = {
7
+ PRIORITY_TAXONS = {
8
8
  brexit_business: "634fd193-8039-4a70-a059-919c34ff4bfc",
9
9
  brexit_individuals: "614b2e65-56ac-4f8d-bb9c-d1a14167ba25",
10
10
  brexit_taxon: "d6c2de5d-ef90-45d1-82d4-5f2438369eea",
11
11
  }.freeze
12
12
 
13
- PRIORITY_TAXONS = {
14
- education_coronavirus: "272308f4-05c8-4d0d-abc7-b7c2e3ccd249",
15
- worker_coronavirus: "b7f57213-4b16-446d-8ded-81955d782680",
16
- business_coronavirus: "65666cdf-b177-4d79-9687-b9c32805e450",
17
- }.merge(BREXIT_TAXONS).freeze
18
-
19
13
  # Returns the highest priority taxon that has a content_id matching those in PRIORITY_TAXONS
20
14
  def self.call(content_item, query_parameters = nil)
21
15
  new(content_item, query_parameters).breadcrumbs
@@ -37,9 +31,9 @@ module GovukPublishingComponents
37
31
 
38
32
  def priority_brexit_taxon
39
33
  if tagged_to_both_brexit_child_taxons?
40
- priority_brexit_taxons.find { |t| t["content_id"] == BREXIT_TAXONS[:brexit_taxon] }
34
+ priority_taxons.find { |t| t["content_id"] == PRIORITY_TAXONS[:brexit_taxon] }
41
35
  else
42
- priority_brexit_taxons.min_by { |t| BREXIT_TAXONS.values.index(t["content_id"]) }
36
+ priority_taxons.min_by { |t| PRIORITY_TAXONS.values.index(t["content_id"]) }
43
37
  end
44
38
  end
45
39
 
@@ -83,10 +77,6 @@ module GovukPublishingComponents
83
77
  end
84
78
  end
85
79
 
86
- def priority_brexit_taxons
87
- priority_taxons.select { |t| priority_brexit_taxon?(t) }
88
- end
89
-
90
80
  def taxon_tree(taxons)
91
81
  return [] if taxons.blank?
92
82
 
@@ -97,10 +87,6 @@ module GovukPublishingComponents
97
87
  PRIORITY_TAXONS.values.include?(taxon["content_id"])
98
88
  end
99
89
 
100
- def priority_brexit_taxon?(taxon)
101
- BREXIT_TAXONS.values.include?(taxon["content_id"])
102
- end
103
-
104
90
  def brexit_child_taxon?(taxon)
105
91
  brexit_child_taxons.include?(taxon["content_id"])
106
92
  end
@@ -1,10 +1,11 @@
1
1
  module GovukPublishingComponents
2
2
  module Presenters
3
3
  class DevolvedNationsHelper
4
- attr_reader :national_applicability
4
+ attr_reader :national_applicability, :type
5
5
 
6
6
  def initialize(local_assigns)
7
7
  @national_applicability = local_assigns[:national_applicability]
8
+ @type = local_assigns[:type] || "publication"
8
9
  end
9
10
 
10
11
  def applicable_nations_title_text
@@ -25,6 +26,16 @@ module GovukPublishingComponents
25
26
  .present?
26
27
  end
27
28
  end
29
+
30
+ def alternative_content_text(name)
31
+ nation = I18n.t("components.devolved_nations.#{name}")
32
+
33
+ if I18n.exists?("components.devolved_nations.type.#{@type}")
34
+ I18n.t("components.devolved_nations.type.#{@type}", nation: nation)
35
+ else
36
+ I18n.t("components.devolved_nations.type.publication", nation: nation)
37
+ end
38
+ end
28
39
  end
29
40
  end
30
41
  end
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = "27.4.0".freeze
2
+ VERSION = "27.8.0".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: 27.4.0
4
+ version: 27.8.0
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-10-04 00:00:00.000000000 Z
11
+ date: 2021-10-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: govuk_app_config
@@ -212,14 +212,14 @@ dependencies:
212
212
  requirements:
213
213
  - - "~>"
214
214
  - !ruby/object:Gem::Version
215
- version: 3.9.2
215
+ version: 3.10.0
216
216
  type: :development
217
217
  prerelease: false
218
218
  version_requirements: !ruby/object:Gem::Requirement
219
219
  requirements:
220
220
  - - "~>"
221
221
  - !ruby/object:Gem::Version
222
- version: 3.9.2
222
+ version: 3.10.0
223
223
  - !ruby/object:Gem::Dependency
224
224
  name: jasmine_selenium_runner
225
225
  requirement: !ruby/object:Gem::Requirement