govuk_publishing_components 27.3.1 → 27.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c72a238dfe33bedb2354586acae39ae707af2543e1147ad399697b7e943161a5
4
- data.tar.gz: ebe2c25dfbdc7bbd61962a32a4dad734cefb8a9868e232ab7686137a539fa3ad
3
+ metadata.gz: 15c7bcc4d82cf3b301b7b7ba021e1bb3de52fcd8834526953c559ec6dee2c50e
4
+ data.tar.gz: 46ed67c901b6561008e808d60b42d67c5c0ff6555d47ea25eb94dfb5e89e0543
5
5
  SHA512:
6
- metadata.gz: 25b19ea4edc8469f447c053bdeb90cbec595ddab3be836b9ba9c2c7a46d223b1537a19d81aa94313b46f046d8f9f592c55fdc219225d328907abdeb15a48afbc
7
- data.tar.gz: bf129ecb95da51adabbb82dadef58fca37606b40ea43998f24c1005d30e9ffba6c1c530c866ab1ceb1d5af6b6ba4fccc196f44573b4044a402efd58b1d5505bb
6
+ metadata.gz: f8b1714ed5784b5e37882f50855cb5ebe51c9fa334ed3214a7b3a8703efc5dfa97cabc62c5a69f5cda8ff8047ad09eb6e8869cc525d8fb782099c2b376d20ab4
7
+ data.tar.gz: ff89e8308d97f9a46ca3246e6978ea3fe24fca5852b3dac2f11f5b5822b1ac3bb7d116afe40cde48341e420347075ff52517cfd97cdb845c044a03ace9b18194
@@ -0,0 +1,3 @@
1
+ <svg width="23" height="23" viewBox="0 0 23 23" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M11.4893 23C17.8406 23 22.9893 17.8513 22.9893 11.5C22.9893 5.14873 17.8406 0 11.4893 0C5.64643 0 0.821276 4.35747 0.0862655 10H12.7633L8.98933 5.67277L10.4482 4L16.9893 11.5L10.4482 19L8.98933 17.3272L13.6354 12H0C0.261778 18.1193 5.30558 23 11.4893 23ZM13.9893 11.5942L14.0715 11.5L13.9893 11.4057V11.5942Z" fill="#366FB3"/>
3
+ </svg>
@@ -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'],
@@ -147,7 +146,6 @@
147
146
  '/wood-packaging-import-export': [
148
147
  ['Heading', 'Export solid wood packaging']
149
148
  ],
150
- '/guidance/answers-to-the-most-common-topics-asked-about-by-the-public-for-the-coronavirus-press-conference': percentages,
151
149
  '/coronavirus': percentages,
152
150
  '/coronavirus/education-and-childcare': percentages,
153
151
  '/coronavirus/worker-support': percentages,
@@ -164,21 +162,6 @@
164
162
  '/guidance/brexit-guidance-for-individuals-and-families': percentages,
165
163
  '/guidance/brexit-guidance-for-individuals-and-families.cy': percentages,
166
164
  '/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
165
  '/guidance/travel-abroad-from-england-during-coronavirus-covid-19': [
183
166
  ['Heading', 'Before you travel abroad'],
184
167
  ['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
  }
@@ -92,6 +92,18 @@
92
92
  }
93
93
  }
94
94
 
95
+ .gem-c-action-link--blue-arrow {
96
+ &:before {
97
+ width: 45px;
98
+ height: 35px;
99
+ background: image-url("govuk_publishing_components/action-link-arrow--blue.png");
100
+ background: image-url("govuk_publishing_components/action-link-arrow--blue.svg"), linear-gradient(transparent, transparent);
101
+ background-repeat: no-repeat;
102
+ background-size: 35px auto;
103
+ background-position: 0 0;
104
+ }
105
+ }
106
+
95
107
  .gem-c-action-link--simple {
96
108
  &:before {
97
109
  width: 30px;
@@ -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
+ }
@@ -9,6 +9,7 @@
9
9
  subtext_href ||= false
10
10
  mobile_subtext ||= false
11
11
  light_text ||= false
12
+ blue_arrow ||= false
12
13
  simple ||= false
13
14
  simple_light ||= false
14
15
  dark_icon ||= false
@@ -27,6 +28,7 @@
27
28
  css_classes << "gem-c-action-link--transparent-icon" if transparent_icon
28
29
  css_classes << "gem-c-action-link--nhs" if nhs_icon
29
30
  css_classes << "gem-c-action-link--brexit" if brexit_icon
31
+ css_classes << "gem-c-action-link--blue-arrow" if blue_arrow
30
32
  css_classes << "gem-c-action-link--simple" if simple
31
33
  css_classes << "gem-c-action-link--simple-light" if simple_light
32
34
  css_classes << "gem-c-action-link--with-subtext" if subtext
@@ -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 %>
@@ -78,6 +78,11 @@ examples:
78
78
  light_text: true
79
79
  context:
80
80
  dark_background: true
81
+ blue_arrow:
82
+ data:
83
+ text: Find out how to stay safe and help prevent the spread
84
+ href: "/something"
85
+ blue_arrow: true
81
86
  simple_arrow:
82
87
  data:
83
88
  text: Getting financial help and keeping your business safe
@@ -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:
@@ -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
@@ -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.3.1".freeze
2
+ VERSION = "27.7.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.3.1
4
+ version: 27.7.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-09-29 00:00:00.000000000 Z
11
+ date: 2021-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: govuk_app_config
@@ -378,6 +378,8 @@ files:
378
378
  - app/assets/config/govuk_publishing_components_manifest.js
379
379
  - app/assets/images/govuk_publishing_components/action-link--nhs.png
380
380
  - app/assets/images/govuk_publishing_components/action-link--nhs.svg
381
+ - app/assets/images/govuk_publishing_components/action-link-arrow--blue.png
382
+ - app/assets/images/govuk_publishing_components/action-link-arrow--blue.svg
381
383
  - app/assets/images/govuk_publishing_components/action-link-arrow--brexit.svg
382
384
  - app/assets/images/govuk_publishing_components/action-link-arrow--dark.png
383
385
  - app/assets/images/govuk_publishing_components/action-link-arrow--dark.svg