govuk_publishing_components 27.5.0 → 27.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -0
  3. data/app/assets/javascripts/govuk_publishing_components/analytics/explicit-cross-domain-links.js +38 -0
  4. data/app/assets/javascripts/govuk_publishing_components/analytics/google-analytics-universal-tracker.js +9 -0
  5. data/app/assets/javascripts/govuk_publishing_components/analytics/init.js +12 -8
  6. data/app/assets/javascripts/govuk_publishing_components/analytics/scroll-tracker.js +0 -55
  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 +9 -3
  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/assets/stylesheets/govuk_publishing_components/components/print/_organisation-logo.scss +3 -0
  13. data/app/controllers/govuk_publishing_components/audit_controller.rb +11 -3
  14. data/app/views/govuk_publishing_components/audit/_components.html.erb +2 -2
  15. data/app/views/govuk_publishing_components/audit/show.html.erb +1 -1
  16. data/app/views/govuk_publishing_components/components/_big_number.html.erb +2 -1
  17. data/app/views/govuk_publishing_components/components/_devolved_nations.html.erb +2 -2
  18. data/app/views/govuk_publishing_components/components/_input.html.erb +2 -1
  19. data/app/views/govuk_publishing_components/components/_list.html.erb +7 -2
  20. data/app/views/govuk_publishing_components/components/docs/big_number.yml +7 -0
  21. data/app/views/govuk_publishing_components/components/docs/devolved_nations.yml +24 -14
  22. data/app/views/govuk_publishing_components/components/docs/govspeak.yml +4 -4
  23. data/app/views/govuk_publishing_components/components/docs/list.yml +8 -0
  24. data/app/views/govuk_publishing_components/components/docs/radio.yml +45 -40
  25. data/app/views/govuk_publishing_components/components/layout_for_public/_account-navigation.html.erb +2 -0
  26. data/config/locales/en.yml +5 -0
  27. data/lib/govuk_publishing_components/presenters/content_breadcrumbs_based_on_priority.rb +3 -17
  28. data/lib/govuk_publishing_components/presenters/devolved_nations_helper.rb +12 -1
  29. data/lib/govuk_publishing_components/version.rb +1 -1
  30. metadata +5 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5eeb1e46730d1f7b1bc3eceb3be65497a4c4f0e2d68695b21cca5ce55f617126
4
- data.tar.gz: 44aeca5c635114770a59d61dc92806bc6bb2b50c582566760fec95967fe65391
3
+ metadata.gz: 2f2aa4a5338ce625693a82792f054575ba77e17f7b59dec7a43375cd69bdc0a0
4
+ data.tar.gz: b972a36c99f444e03f1190b54dc38c48a4e755779df9b3596331765785a0ea28
5
5
  SHA512:
6
- metadata.gz: 548b6ce397891440ccbb4b5cce2c23f8ad5d4097d8b7fc4f4a3ff4c82f6203dcac21416e86c37321bf4c51d555bbd5eb001b5094726e47e1d36f8b0df1380c01
7
- data.tar.gz: adb5135492b5b1f4db2dcc2157ad0de43d50b367676f64c161209bb91762c4d448c7055fb04acaf6415ddf10f32db900c76629805c80be06537b99287419045d
6
+ metadata.gz: 7ef57a9ae12333724ca55b5826eb2f962e02c51877e2944b10d7d214258e38aa517317692cc1ee2aab58f38ed7051ebf9fe3ddc864e6982330baf286fe314f9d
7
+ data.tar.gz: 8548a40fad2185b2a63fd7c7748f1bcee2511dfc0c610fbeb8f50caf7ad0daf6739e04fe0c06bcf9e52536d71e8a35203f22847a83ece3b3517c826eda87a8ae
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
@@ -36,11 +36,20 @@
36
36
  fieldsObject = { cookieDomain: fieldsObject }
37
37
  }
38
38
 
39
+ function setLinkedDomains () {
40
+ var domains = window.GOVUK.analyticsVars.primaryLinkedDomains
41
+ if (domains && domains.length > 0) {
42
+ sendToGa('require', 'linker')
43
+ sendToGa('linker:autoLink', domains)
44
+ }
45
+ }
46
+
39
47
  configureProfile()
40
48
  anonymizeIp()
41
49
  disableAdFeatures()
42
50
  stripTitlePII()
43
51
  stripLocationPII()
52
+ setLinkedDomains()
44
53
  }
45
54
 
46
55
  GoogleAnalyticsUniversalTracker.load = function () {
@@ -3,9 +3,12 @@ var analyticsInit = function () {
3
3
 
4
4
  var analyticsVars = window.GOVUK.analyticsVars || false
5
5
  if (analyticsVars) {
6
- var gaProperty = window.GOVUK.analyticsVars.gaProperty || false
7
- var gaPropertyCrossDomain = window.GOVUK.analyticsVars.gaPropertyCrossDomain || false
8
- var linkedDomains = window.GOVUK.analyticsVars.linkedDomains || false
6
+ // the property naming convention here isn't consistent, but used in static and
7
+ // govuk-account-manager-prototype, so hard to change
8
+ var primaryGaProperty = window.GOVUK.analyticsVars.gaProperty || false
9
+
10
+ var crossDomainGaProperty = window.GOVUK.analyticsVars.gaPropertyCrossDomain || false
11
+ var crossDomainLinkedDomains = window.GOVUK.analyticsVars.linkedDomains || false
9
12
  }
10
13
 
11
14
  window.GOVUK.Analytics.checkDigitalIdentityConsent = function (location) {
@@ -39,7 +42,7 @@ var analyticsInit = function () {
39
42
 
40
43
  // Disable analytics by default
41
44
  // This will be reversed below, if the consent cookie says usage cookies are allowed
42
- var disabler = 'ga-disable-' + gaProperty
45
+ var disabler = 'ga-disable-' + primaryGaProperty
43
46
  window[disabler] = true
44
47
 
45
48
  if (consentCookie && consentCookie.usage) {
@@ -48,14 +51,14 @@ var analyticsInit = function () {
48
51
  // Load Google Analytics libraries
49
52
  window.GOVUK.StaticAnalytics.load()
50
53
 
51
- if (gaProperty) {
54
+ if (primaryGaProperty) {
52
55
  // Use document.domain in dev, preview and staging so that tracking works
53
56
  // Otherwise explicitly set the domain as www.gov.uk (and not gov.uk).
54
57
  var cookieDomain = (document.domain === 'www.gov.uk') ? '.www.gov.uk' : document.domain
55
58
 
56
59
  // Configure profiles, setup custom vars, track initial pageview
57
60
  var analytics = new window.GOVUK.StaticAnalytics({
58
- universalId: gaProperty,
61
+ universalId: primaryGaProperty,
59
62
  cookieDomain: cookieDomain,
60
63
  allowLinker: true
61
64
  })
@@ -63,8 +66,9 @@ var analyticsInit = function () {
63
66
  // Make interface public for virtual pageviews and events
64
67
  window.GOVUK.analytics = analytics
65
68
 
66
- if (linkedDomains && linkedDomains.length > 0) {
67
- window.GOVUK.analytics.addLinkedTrackerDomain(gaPropertyCrossDomain, 'govuk', linkedDomains)
69
+ // set up linking of domains for cross domain ga property
70
+ if (crossDomainLinkedDomains && crossDomainLinkedDomains.length > 0) {
71
+ window.GOVUK.analytics.addLinkedTrackerDomain(crossDomainGaProperty, 'govuk', crossDomainLinkedDomains)
68
72
  }
69
73
  }
70
74
  } else {
@@ -58,13 +58,6 @@
58
58
  '/guidance/foreign-travel-insurance': [
59
59
  ['Heading', 'What your travel insurance policy should cover']
60
60
  ],
61
- '/guidance/social-security-contributions-for-uk-and-eu-workers-if-the-uk-leaves-the-eu-with-no-deal': [
62
- ['Heading', 'UK employers'],
63
- ['Heading', 'UK employees and self-employed']
64
- ],
65
- '/guidance/student-finance-arrangements-in-a-no-deal-scenario': [
66
- ['Heading', 'Other overseas study placements']
67
- ],
68
61
  '/guidance/living-in-france': [
69
62
  ['Heading', 'Passports and travel']
70
63
  ],
@@ -74,12 +67,6 @@
74
67
  '/guidance/healthcare-for-eu-and-efta-citizens-visiting-the-uk': [
75
68
  ['Heading', 'Travel insurance']
76
69
  ],
77
- '/guidance/driving-in-the-eu-after-brexit': [
78
- ['Heading', 'GB stickers and number plates']
79
- ],
80
- '/guidance/driving-in-the-eu-after-brexit#insurance-for-your-vehicle-caravan-or-trailer': [
81
- ['Heading', 'Trailer registration']
82
- ],
83
70
  '/driving-abroad': [
84
71
  ['Heading', 'Check your insurance if you’re taking your own vehicle']
85
72
  ],
@@ -89,57 +76,15 @@
89
76
  '/driving-abroad/international-driving-permit': [
90
77
  ['Heading', 'Check which IDP you need']
91
78
  ],
92
- '/guidance/driving-in-the-eu-after-brexit#gb-stickers-and-number-plates': [
93
- ['Heading', 'GB stickers and number plates']
94
- ],
95
79
  '/guidance/guidance-for-suppliers-of-cattle-sheep-and-goat-ear-tags': [
96
80
  ['Heading', 'Tagging information for livestock keepers']
97
81
  ],
98
- '/guidance/wine-trade-regulations': [
99
- ['Heading', 'Rules for transporting wine into the UK']
100
- ],
101
- '/guidance/the-chemicals-sector-and-preparing-for-eu-exit': [
102
- ['Heading', 'Energy and climate']
103
- ],
104
82
  '/guidance/how-to-move-goods-between-or-through-common-transit-countries-including-the-eu': [
105
83
  ['Heading', 'Start moving your goods']
106
84
  ],
107
85
  '/guidance/ecmt-international-road-haulage-permits': [
108
86
  ['Heading', 'Apply for permits']
109
87
  ],
110
- '/guidance/prepare-to-drive-in-the-eu-after-brexit-lorry-and-goods-vehicle-drivers': [
111
- ['Heading', 'Driver CPC for lorry drivers']
112
- ],
113
- '/guidance/run-international-bus-or-coach-services-after-brexit': [
114
- ['Heading', 'Run regular international services']
115
- ],
116
- '/guidance/vehicle-type-approval-if-theres-no-brexit-deal': [
117
- ['Heading', 'Existing vehicle and component type-approvals']
118
- ],
119
- '/guidance/the-retail-sector-and-preparing-for-eu-exit': [
120
- ['Heading', 'Importing and exporting']
121
- ],
122
- '/guidance/the-consumer-goods-sector-and-preparing-for-eu-exit': [
123
- ['Heading', 'Importing and exporting']
124
- ],
125
- '/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': [
126
- ['Heading', '3. Action taken by the UK']
127
- ],
128
- '/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': [
129
- ['Heading', '1.4 Orphan medicines']
130
- ],
131
- '/guidance/check-temporary-rates-of-customs-duty-on-imports-after-eu-exit': [
132
- ['Heading', 'Tariff-rate quotas (TRQ)']
133
- ],
134
- '/guidance/construction-products-regulation-if-there-is-no-brexit-deal': [
135
- ['Heading', 'UK manufacturers exporting to the EU']
136
- ],
137
- '/guidance/european-and-domestic-funding-after-brexit': [
138
- ['Heading', 'What you need to do']
139
- ],
140
- '/guidance/guidance-on-substantial-amendments-to-a-clinical-trial-if-the-uk-leaves-the-eu-with-no-deal': [
141
- ['Heading', 'Investigational medicinal product (IMP) certification and importation']
142
- ],
143
88
  '/taking-goods-out-uk-temporarily/get-an-ata-carnet': [
144
89
  ['Heading', 'Using an ATA Carnet']
145
90
  ],
@@ -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: 45px;
98
- height: 35px;
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: 35px auto;
102
+ background-size: 28px auto;
103
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
+ }
@@ -0,0 +1,3 @@
1
+ .gem-c-organisation-logo__image {
2
+ max-width: 100%;
3
+ }
@@ -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.5.0".freeze
2
+ VERSION = "27.8.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: 27.5.0
4
+ version: 27.8.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-10-11 00:00:00.000000000 Z
11
+ date: 2021-10-22 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
@@ -642,6 +642,7 @@ files:
642
642
  - app/assets/stylesheets/govuk_publishing_components/components/print/_govspeak-html-publication.scss
643
643
  - app/assets/stylesheets/govuk_publishing_components/components/print/_govspeak.scss
644
644
  - app/assets/stylesheets/govuk_publishing_components/components/print/_layout-super-navigation-header.scss
645
+ - app/assets/stylesheets/govuk_publishing_components/components/print/_organisation-logo.scss
645
646
  - app/assets/stylesheets/govuk_publishing_components/components/print/_step-by-step-nav-header.scss
646
647
  - app/assets/stylesheets/govuk_publishing_components/components/print/_step-by-step-nav.scss
647
648
  - app/assets/stylesheets/govuk_publishing_components/components/print/_textarea.scss