govuk_publishing_components 21.14.0 → 21.15.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: f3b8b720833271b00598f634fa50424361c265ea3f4bf42cef01184a5b36af26
4
- data.tar.gz: 6b4a2ae3ee350c4e4a45cbdac9ab04e9412a1c66fb361b05c706fdcca1ba6240
3
+ metadata.gz: a49f0b03464d55542eb09daf6d95f85059090ef2977fdd3e96b09b326c06fa52
4
+ data.tar.gz: 7856a1ec7759dee3ff52127cf836676777d2753593f49e2ba3692cd8e854c3e9
5
5
  SHA512:
6
- metadata.gz: e7840cdd577f7307231fc74e67aa8e0e0d81e5929fecd0408297e79c82e268a916466633ea8efce01b8f8d0dd8c1f4a73965b761f9d08df9c720334733fd4fe8
7
- data.tar.gz: 7ebb8a3c9a9442e323955a5b815e97d673e7fbb292da063dc0f14a513c6b91a49cfb418fc293c10149cd9c05002d9b46c5c3250044294b32ce75efd1b66d6d2d
6
+ metadata.gz: 1ef24d7b0418ef007e0871d405518c7666137d2b364b8660cfb16ce5930ddc56cc6061283bc459a4a44c15c97a252a57b35f9b406fd2fae87d924b8055213300
7
+ data.tar.gz: b8e911d17e93799b4fcc0bf46e3f50b20c96213bf97c8704a4d5ec9ab9771f3638c4c1461a8ba11429a4475c61ae081e3c66f2f8c7d451cff1456a7192d564c1
@@ -27,27 +27,19 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
27
27
  this.$acceptCookiesLink.addEventListener('click', this.$module.setCookieConsent)
28
28
  }
29
29
 
30
- // Force the new cookie banner to show if we don't think the user has seen it before
31
- // This involves resetting the seen_cookie_message cookie, which may be set to true if they've seen the old cookie banner
32
- if (!window.GOVUK.cookie('cookie_policy')) {
33
- if (window.GOVUK.cookie('seen_cookie_message') === 'true') {
34
- window.GOVUK.cookie('seen_cookie_message', false, { days: 365 })
35
- }
36
- }
37
-
38
30
  this.showCookieMessage()
39
31
  }
40
32
 
41
33
  CookieBanner.prototype.showCookieMessage = function () {
42
34
  // Show the cookie banner if not in the cookie settings page or in an iframe
43
35
  if (!this.isInCookiesPage() && !this.isInIframe()) {
44
- var shouldHaveCookieMessage = (this.$module && window.GOVUK.cookie('seen_cookie_message') !== 'true')
36
+ var shouldHaveCookieMessage = (this.$module && window.GOVUK.cookie('cookies_preferences_set') !== 'true')
45
37
 
46
38
  if (shouldHaveCookieMessage) {
47
39
  this.$module.style.display = 'block'
48
40
 
49
41
  // Set the default consent cookie if it isn't already present
50
- if (!window.GOVUK.cookie('cookie_policy')) {
42
+ if (!window.GOVUK.cookie('cookies_policy')) {
51
43
  window.GOVUK.setDefaultConsentCookie()
52
44
  }
53
45
  } else {
@@ -61,7 +53,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
61
53
  CookieBanner.prototype.hideCookieMessage = function (event) {
62
54
  if (this.$module) {
63
55
  this.$module.style.display = 'none'
64
- window.GOVUK.cookie('seen_cookie_message', 'true', { days: 365 })
56
+ window.GOVUK.cookie('cookies_preferences_set', 'true', { days: 365 })
65
57
  }
66
58
 
67
59
  if (event.target) {
@@ -73,7 +65,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
73
65
  window.GOVUK.approveAllCookieTypes()
74
66
  this.$module.showConfirmationMessage()
75
67
  this.$module.cookieBannerConfirmationMessage.focus()
76
- window.GOVUK.cookie('seen_cookie_message', 'true', { days: 365 })
68
+ window.GOVUK.cookie('cookies_preferences_set', 'true', { days: 365 })
77
69
  }
78
70
 
79
71
  CookieBanner.prototype.showConfirmationMessage = function () {
@@ -6,29 +6,30 @@
6
6
 
7
7
  var DEFAULT_COOKIE_CONSENT = {
8
8
  'essential': true,
9
- 'settings': true,
10
- 'usage': true,
11
- 'campaigns': true
9
+ 'settings': false,
10
+ 'usage': false,
11
+ 'campaigns': false
12
12
  }
13
13
 
14
14
  var COOKIE_CATEGORIES = {
15
- 'TLSversion': 'usage',
16
- 'cookie_policy': 'essential',
17
- 'govuk_not_first_visit': 'essential',
18
- 'govuk_browser_upgrade_dismisssed': 'essential',
15
+ 'cookies_policy': 'essential',
19
16
  'seen_cookie_message': 'essential',
20
17
  'cookie_preferences_set': 'essential',
21
- 'govuk_surveySeenUserSatisfactionSurvey': 'essential',
22
- 'govuk_takenUserSatisfactionSurvey': 'essential',
18
+ 'cookies_preferences_set': 'essential',
23
19
  '_email-alert-frontend_session': 'essential',
24
- 'global_bar_seen': 'essential',
25
20
  'licensing_session': 'essential',
26
21
  'govuk_contact_referrer': 'essential',
27
- 'JS-Detection': 'usage',
22
+ 'global_bar_seen': 'settings',
23
+ 'govuk_browser_upgrade_dismisssed': 'settings',
24
+ 'govuk_not_first_visit': 'settings',
25
+ 'govuk_surveySeenUserSatisfactionSurvey': 'settings',
26
+ 'govuk_takenUserSatisfactionSurvey': 'settings',
27
+ 'analytics_next_page_call': 'usage',
28
28
  '_ga': 'usage',
29
29
  '_gid': 'usage',
30
30
  '_gat': 'usage',
31
- 'analytics_next_page_call': 'usage'
31
+ 'JS-Detection': 'usage',
32
+ 'TLSversion': 'usage'
32
33
  }
33
34
 
34
35
  /*
@@ -63,7 +64,7 @@
63
64
  }
64
65
 
65
66
  window.GOVUK.setDefaultConsentCookie = function () {
66
- window.GOVUK.setCookie('cookie_policy', JSON.stringify(DEFAULT_COOKIE_CONSENT), { days: 365 })
67
+ window.GOVUK.setConsentCookie(DEFAULT_COOKIE_CONSENT)
67
68
  }
68
69
 
69
70
  window.GOVUK.approveAllCookieTypes = function () {
@@ -74,11 +75,11 @@
74
75
  'campaigns': true
75
76
  }
76
77
 
77
- window.GOVUK.setCookie('cookie_policy', JSON.stringify(approvedConsent), { days: 365 })
78
+ window.GOVUK.setCookie('cookies_policy', JSON.stringify(approvedConsent), { days: 365 })
78
79
  }
79
80
 
80
81
  window.GOVUK.getConsentCookie = function () {
81
- var consentCookie = window.GOVUK.cookie('cookie_policy')
82
+ var consentCookie = window.GOVUK.cookie('cookies_policy')
82
83
  var consentCookieObj
83
84
 
84
85
  if (consentCookie) {
@@ -122,7 +123,7 @@
122
123
  }
123
124
  }
124
125
 
125
- window.GOVUK.setCookie('cookie_policy', JSON.stringify(cookieConsent), { days: 365 })
126
+ window.GOVUK.setCookie('cookies_policy', JSON.stringify(cookieConsent), { days: 365 })
126
127
  }
127
128
 
128
129
  window.GOVUK.checkConsentCookieCategory = function (cookieName, cookieCategory) {
@@ -146,7 +147,7 @@
146
147
 
147
148
  window.GOVUK.checkConsentCookie = function (cookieName, cookieValue) {
148
149
  // If we're setting the consent cookie OR deleting a cookie, allow by default
149
- if (cookieName === 'cookie_policy' || (cookieValue === null || cookieValue === false)) {
150
+ if (cookieName === 'cookies_policy' || (cookieValue === null || cookieValue === false)) {
150
151
  return true
151
152
  }
152
153
 
@@ -1,5 +1,4 @@
1
- $govuk-cookie-banner-background: govuk-colour("white");
2
- $govuk-cookie-banner-text-green: #00823b;
1
+ $govuk-cookie-banner-background: govuk-colour("light-grey", "grey-4");
3
2
 
4
3
  .js-enabled {
5
4
  .gem-c-cookie-banner {
@@ -11,60 +10,41 @@ $govuk-cookie-banner-text-green: #00823b;
11
10
  @include govuk-font($size: 16);
12
11
  padding: govuk-spacing(2) 0;
13
12
  background-color: $govuk-cookie-banner-background;
14
- border: 2px solid govuk-colour("black");
15
13
  }
16
14
 
17
15
  .gem-c-cookie-banner__message {
18
16
  display: inline-block;
19
- margin-bottom: govuk-spacing(1);
17
+ @include govuk-font($size: 16);
20
18
  padding-right: govuk-spacing(4);
21
19
  padding-bottom: govuk-spacing(2);
22
- color: $govuk-cookie-banner-text-green;
23
20
  }
24
21
 
25
- .gem-c-cookie-banner__buttons {
26
- @include govuk-clearfix;
22
+ .gem-c-cookie-banner__button {
27
23
 
28
- @include govuk-media-query($from: desktop) {
29
- display: inline-block;
24
+ &.govuk-grid-column-one-half-from-desktop {
25
+ padding: 0;
30
26
  }
31
- }
32
27
 
33
- .gem-c-cookie-banner__button {
34
- display: inline-block;
35
- width: 100%;
28
+ .govuk-button {
29
+ width: 90%;
36
30
 
37
- @include govuk-media-query($from: mobile, $until: desktop) {
38
- &.gem-c-cookie-banner__button-accept {
39
- float: left;
40
- width: 49%;
31
+ @include govuk-media-query($until: desktop) {
32
+ margin-bottom: govuk-spacing(4);
41
33
  }
42
34
 
43
- &.gem-c-cookie-banner__button-settings {
44
- .js-enabled & {
45
- float: right;
46
- width: 49%;
47
- }
48
- }
49
- }
50
-
51
- @include govuk-media-query($from: desktop) {
52
- width: auto;
53
- }
54
-
55
- @include govuk-media-query($until: 455px) {
56
- width: 100%;
57
35
  }
58
36
  }
59
37
 
38
+ // Only show accept button if users have js and can accept
60
39
  .gem-c-cookie-banner__button-accept {
61
40
  display: none;
41
+ }
62
42
 
63
- .js-enabled & {
64
- display: inline-block;
65
- }
43
+ .js-enabled .gem-c-cookie-banner__button-accept {
44
+ display: inline-block;
66
45
  }
67
46
 
47
+
68
48
  .gem-c-cookie-banner__confirmation {
69
49
  display: none;
70
50
  position: relative;
@@ -137,8 +117,10 @@ $govuk-cookie-banner-text-green: #00823b;
137
117
  }
138
118
 
139
119
  p {
140
- margin: 0;
120
+ @include govuk-font($size: 19);
121
+ margin: 0 0 govuk-spacing(2) 0;
141
122
  }
123
+
142
124
  }
143
125
  // sass-lint:enable no-ids
144
126
  // scss-lint:enable IdSelector
@@ -4,6 +4,7 @@
4
4
  content ||= nil
5
5
  data_attributes ||= {}
6
6
  data_attributes[:module] = "contextual-guidance"
7
+ guidance_id ||= nil
7
8
  %>
8
9
 
9
10
  <%= tag.div class: "gem-c-contextual-guidance", id: id, data: data_attributes do %>
@@ -14,7 +15,7 @@
14
15
  <% end %>
15
16
  <% end %>
16
17
  <%= tag.div class: "govuk-grid-column-one-third" do %>
17
- <%= tag.div class: "gem-c-contextual-guidance__wrapper", for: html_for do %>
18
+ <%= tag.div class: "gem-c-contextual-guidance__wrapper", for: html_for, id: guidance_id do %>
18
19
  <%= tag.div class: "gem-c-contextual-guidance__guidance" do %>
19
20
  <%= tag.h2 title, class: "govuk-heading-s" %>
20
21
  <%= content %>
@@ -1,37 +1,41 @@
1
1
  <%
2
2
  id ||= 'global-cookie-message'
3
- message ||= "GOV.UK uses cookies which are essential for the site to work. We also use non-essential cookies to help us improve government digital services. Any data collected is anonymised. By continuing to use this site, you agree to our use of cookies."
4
3
  %>
5
4
 
6
- <div id="<%= id %>" class="gem-c-cookie-banner" data-module="cookie-banner" role="region" aria-label="cookie banner" data-nosnippet>
5
+ <div id="<%= id %>" class="gem-c-cookie-banner govuk-clearfix" data-module="cookie-banner" role="region" aria-label="cookie banner" data-nosnippet>
7
6
  <div class="gem-c-cookie-banner__wrapper govuk-width-container">
8
- <p class="gem-c-cookie-banner__message"><%= message %></p>
9
- <div class="gem-c-cookie-banner__buttons">
10
- <div class="gem-c-cookie-banner__button gem-c-cookie-banner__button-accept">
11
- <%= render "govuk_publishing_components/components/button", {
12
- text: "Accept cookies",
13
- secondary: true,
14
- inline_layout: true,
15
- data_attributes: {
16
- module: "track-click",
17
- "accept-cookies": "true",
18
- "track-category": "cookieBanner",
19
- "track-action": "Cookie banner accepted"
20
- }
21
- } %>
22
- </div>
23
- <div class="gem-c-cookie-banner__button gem-c-cookie-banner__button-settings">
24
- <%= render "govuk_publishing_components/components/button", {
25
- text: "Cookie settings",
26
- href: "/help/cookies",
27
- secondary: true,
28
- inline_layout: true,
29
- data_attributes: {
30
- module: "track-click",
31
- "track-category": "cookieBanner",
32
- "track-action": "Cookie banner settings clicked"
33
- }
34
- } %>
7
+ <div class="govuk-row">
8
+ <div class=" govuk-grid-column-two-thirds">
9
+ <div class="gem-c-cookie-banner__message">
10
+ <span class="govuk-heading-m">Tell us whether you accept cookies</span>
11
+ <p class="govuk-body">We use <a class="govuk-link" href="help/cookies">cookies to collect information</a> about how you use GOV.UK. We use this information to make the website work as well as possible and improve government services.</p>
12
+ </div>
13
+ <div class="gem-c-cookie-banner__buttons">
14
+ <div class="gem-c-cookie-banner__button gem-c-cookie-banner__button-accept govuk-grid-column-full govuk-grid-column-one-half-from-desktop">
15
+ <%= render "govuk_publishing_components/components/button", {
16
+ text: "Accept all cookies",
17
+ inline_layout: true,
18
+ data_attributes: {
19
+ module: "track-click",
20
+ "accept-cookies": "true",
21
+ "track-category": "cookieBanner",
22
+ "track-action": "Cookie banner accepted"
23
+ }
24
+ } %>
25
+ </div>
26
+ <div class="gem-c-cookie-banner__button gem-c-cookie-banner__button-settings govuk-grid-column-full govuk-grid-column-one-half-from-desktop">
27
+ <%= render "govuk_publishing_components/components/button", {
28
+ text: "Set cookie preferences",
29
+ href: "/help/cookies",
30
+ inline_layout: true,
31
+ data_attributes: {
32
+ module: "track-click",
33
+ "track-category": "cookieBanner",
34
+ "track-action": "Cookie banner settings clicked"
35
+ }
36
+ } %>
37
+ </div>
38
+ </div>
35
39
  </div>
36
40
  </div>
37
41
  </div>
@@ -2,6 +2,7 @@
2
2
  id ||= "textarea-#{SecureRandom.hex(4)}"
3
3
  value ||= nil
4
4
  rows ||= 5
5
+ describedby ||= nil
5
6
  data ||= nil
6
7
  spellcheck ||= "true"
7
8
 
@@ -27,10 +28,11 @@
27
28
  form_group_css_classes << (shared_helper.get_margin_bottom)
28
29
 
29
30
  aria_described_by ||= nil
30
- if hint || has_error
31
+ if hint || has_error || describedby
31
32
  aria_described_by = []
32
33
  aria_described_by << hint_id if hint
33
34
  aria_described_by << error_id if has_error
35
+ aria_described_by << describedby if describedby
34
36
  aria_described_by = aria_described_by.join(" ")
35
37
  end
36
38
  %>
@@ -19,10 +19,11 @@ examples:
19
19
  data:
20
20
  html_for: news-title
21
21
  title: Writing a news title
22
+ guidance_id: news-title-guidance
22
23
  content: |
23
24
  <p>The title must make clear what the content offers users. Use the words your users do to help them find this. Avoid wordplay or teases.</p>
24
25
  block: |
25
26
  <div class="govuk-form-group">
26
27
  <label class="gem-c-label govuk-label" for="news-title">News title</label>
27
- <input id="news-title" type="text" class="gem-c-input govuk-input">
28
+ <input id="news-title" type="text" class="gem-c-input govuk-input" aria-describedby="news-title-guidance">
28
29
  </div>
@@ -17,7 +17,3 @@ accessibility_excluded_rules:
17
17
  examples:
18
18
  default:
19
19
  data: {}
20
- custom_message:
21
- data:
22
- id: custom-message
23
- message: GOV.UK uses cookies to make the site simpler. <a class="govuk-link" href="/help/cookies">Find out more about cookies</a>
@@ -76,3 +76,15 @@ examples:
76
76
  name: "maxlength"
77
77
  value: "You can't type more"
78
78
  maxlength: 19
79
+ with_aria_attributes:
80
+ description: Use `describedby` when the textarea is described by an element outside the component; for example, when used in conjunction with a [contextual guidance](/component-guide/contextual_guidance).
81
+ embed: |
82
+ <%= component %>
83
+ <p class="govuk-body" id="contextual-guidance">The title must make clear what the content offers users. Use the words your users do to help them find this. Avoid wordplay or teases.</p>
84
+ data:
85
+ label:
86
+ text: "Title"
87
+ bold: true
88
+ name: "described"
89
+ rows: 2
90
+ describedby: "contextual-guidance"
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = '21.14.0'.freeze
2
+ VERSION = '21.15.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: 21.14.0
4
+ version: 21.15.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: 2019-12-13 00:00:00.000000000 Z
11
+ date: 2019-12-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gds-api-adapters