govuk_publishing_components 23.9.0 → 23.10.2

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: 2f3f7a062896026a1d879ee8e13d35d6e123e5deb428e085eb54450494e8e354
4
- data.tar.gz: 4efbc1f947779c1f589b07aaf93022459d6376963c477cd054f76c0a78bc074b
3
+ metadata.gz: 737265f42ca1a81cb1a854d9858c053b36da1dd49096d4ab271880e40a0d265a
4
+ data.tar.gz: 53e08f6b824be9665c54eb1e421463d63d8a761cc0aa8b432fdea43025fe173f
5
5
  SHA512:
6
- metadata.gz: b8b9bb9042fd8c8091b66d68f47a2a19baf9bda42f4b7d381113aaa33028f6a3c6e4374b65f53647e61e5280a387fa1f02355ac3c78110092cc28a9faf98d85d
7
- data.tar.gz: b148efd5a2ef726a1d9dc26a478fe43c229b9066a8a96a2bd0cf2eb1ffe6b9d3654cfba6f1f02de4ee25ecccb33a2d2473837a686535cd701075f3bdfd4abc16
6
+ metadata.gz: d668236b7496da22426217927da594ff3dc3da9a903fafe647ca9ab47cc7877d779aef7dd841dde4b1f514571155a149a8d81bc40ff0b4e506ec8d90eeb6b80b
7
+ data.tar.gz: 5ea78e25ed6a8ca39346ce90b46262b96c793ebd0fcc84a83715378099f029aa2c72bc29f758ba1b414d81fc7a73a3b21e7bd35603313d621d8c7fb112b1364f
@@ -14,3 +14,4 @@
14
14
  //= require ./analytics/ecommerce
15
15
  //= require ./analytics/init
16
16
  //= require ./analytics/scroll-tracker
17
+ //= require ./analytics/explicit-cross-domain-links
@@ -0,0 +1,34 @@
1
+ ;(function (global) {
2
+ 'use strict'
3
+
4
+ var GOVUK = global.GOVUK || {}
5
+ GOVUK.Modules = GOVUK.Modules || {}
6
+
7
+ GOVUK.Modules.ExplicitCrossDomainLinks = function () {
8
+ this.start = function ($module) {
9
+ var element = $module[0]
10
+
11
+ if (!global.ga) { return }
12
+
13
+ global.ga(function () {
14
+ var trackers = global.ga.getAll()
15
+
16
+ if (!trackers.length) { return }
17
+
18
+ var linker = new global.gaplugins.Linker(trackers[0])
19
+
20
+ var attrAction = element.getAttribute('action')
21
+ if (attrAction) {
22
+ element.setAttribute('action', linker.decorate(attrAction))
23
+ }
24
+
25
+ var attrHref = element.getAttribute('href')
26
+ if (attrHref) {
27
+ element.href = linker.decorate(attrHref)
28
+ }
29
+ })
30
+ }
31
+ }
32
+
33
+ global.GOVUK = GOVUK
34
+ })(window)
@@ -26,6 +26,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
26
26
  this.showHide = document.createElement('button')
27
27
  this.showHide.className = 'gem-c-show-password__toggle'
28
28
  this.showHide.setAttribute('aria-controls', this.input.getAttribute('id'))
29
+ this.showHide.setAttribute('type', 'button')
29
30
  this.showHide.innerHTML = this.showPasswordText
30
31
  this.wrapper.insertBefore(this.showHide, this.input.nextSibling)
31
32
 
@@ -105,8 +105,10 @@
105
105
  events: {
106
106
  onReady: function (event) {
107
107
  // update iframe title attribute once video is ready
108
+ // this is done to let screen reader users know that they are focused on a video
109
+ // https://github.com/alphagov/govuk_publishing_components/pull/908#discussion_r302913995
108
110
  var videoTitle = options.title
109
- event.target.f.title = videoTitle + ' (video)'
111
+ event.target.getIframe().title = videoTitle + ' (video)'
110
112
  },
111
113
  onStateChange: function (event) {
112
114
  var eventData = event.data
@@ -36,10 +36,10 @@ $large-input-size: 50px;
36
36
 
37
37
  .gem-c-search__input[type="search"] { // overly specific to prevent some overrides from outside
38
38
  @include govuk-font($size: 19, $line-height: (28 / 19));
39
- padding: 6px;
40
39
  margin: 0;
41
40
  width: 100%;
42
- height: em(34, 16);
41
+ height: em(40, 16);
42
+ padding: em(6, 16);
43
43
  border: $govuk-border-width-form-element solid $govuk-input-border-colour;
44
44
  background: govuk-colour("white");
45
45
  border-radius: 0; //otherwise iphones apply an automatic border radius
@@ -47,6 +47,10 @@ $large-input-size: 50px;
47
47
  -webkit-appearance: none;
48
48
  -moz-appearance: none;
49
49
  appearance: none;
50
+ @include govuk-media-query($from: tablet) {
51
+ height: em(40, 19);
52
+ padding: em(6, 19);
53
+ }
50
54
 
51
55
  // the .focus class is added by JS and ensures that the input remains above the label once clicked/filled in
52
56
  &:focus,
@@ -39,6 +39,8 @@
39
39
 
40
40
  @include govuk-media-query($from: mobile) {
41
41
  margin-left: -2px;
42
+ margin-top: 0;
43
+ margin-bottom: 0;
42
44
  }
43
45
 
44
46
  &:hover {
@@ -4,7 +4,7 @@
4
4
  <div class="gem-c-contextual-sidebar">
5
5
  <% if navigation.show_brexit_cta? && navigation.step_by_step_count.zero? %>
6
6
  <%= render 'govuk_publishing_components/components/contextual_sidebar/brexit_cta' %>
7
- <% elsif navigation.step_by_step_count.zero? %>
7
+ <% elsif navigation.step_by_step_count.zero? && !navigation.transition_countdown_exception? %>
8
8
  <%= render 'govuk_publishing_components/components/transition_countdown', {
9
9
  title: t("components.related_navigation.transition.title"),
10
10
  url: t("components.related_navigation.transition.link_path"),
@@ -144,3 +144,23 @@ examples:
144
144
  - text: Find out what you’ll get
145
145
  href: "/settled-status-eu-citizens-families/what-settled-and-presettled-status-means"
146
146
  optional: false
147
+ transition_countdown_exception:
148
+ data:
149
+ content_item:
150
+ title: "30 creative teams awarded up to £100,000 each for Festival UK* 2022 R&D project"
151
+ content_id: "c3752802-f091-43a9-ba90-33568fccf391"
152
+ links:
153
+ ordered_related_items:
154
+ - title: Find an apprenticeship
155
+ base_path: /apply-apprenticeship
156
+ - title: Training and study at work
157
+ base_path: /training-study-work-your-rights
158
+ - title: Careers helpline for teenagers
159
+ base_path: /careers-helpline-for-teenagers
160
+ document_collections:
161
+ - title: Recruit an apprentice (formerly apprenticeship vacancies)
162
+ base_path: /government/collections/apprenticeship-vacancies
163
+ document_type: document_collection
164
+ - title: The future of jobs and skills
165
+ base_path: /government/collections/the-future-of-jobs-and-skills
166
+ document_type: document_collection
@@ -70,7 +70,7 @@ examples:
70
70
  description: Don't indent the extra links. Used for links to people pages.
71
71
  data:
72
72
  href: "/government/people/"
73
- image_src: "http://placekitten.com/215/140"
73
+ image_src: "https://assets.publishing.service.gov.uk/government/uploads/system/uploads/feature/image/62756/s300_courts-of-justice.JPG"
74
74
  image_alt: "some meaningful alt text please"
75
75
  context:
76
76
  text: "The Rt Hon"
@@ -85,7 +85,7 @@ examples:
85
85
  extra_links_with_no_main_link:
86
86
  description: If extra links are included, the main link is not needed. Note that in this configuration the image is not a link as no link has been supplied.
87
87
  data:
88
- image_src: "http://placekitten.com/215/140"
88
+ image_src: "https://assets.publishing.service.gov.uk/government/uploads/system/uploads/feature/image/62756/s300_courts-of-justice.JPG"
89
89
  image_alt: "some meaningful alt text please"
90
90
  heading_text: "John Whiskers MP"
91
91
  extra_links: [
@@ -151,7 +151,7 @@ examples:
151
151
  data:
152
152
  large: true
153
153
  href: "/still-not-a-page"
154
- image_src: "https://assets.publishing.service.gov.uk/frontend/homepage/uk-leaves-the-eu-d84d2981a9953d8b1261c9d25016223b0a8af3c096fa2d5e03510d73a78e3c60.jpg"
154
+ image_src: "https://assets.publishing.service.gov.uk/government/uploads/system/uploads/feature/image/62756/s300_courts-of-justice.JPG"
155
155
  image_alt: "some meaningful alt text please"
156
156
  context:
157
157
  date: 2017-06-14 11:30:00
@@ -208,7 +208,7 @@ examples:
208
208
  with_lang:
209
209
  description: |
210
210
  Pass through an appropriate `lang` to set a HTML lang attribute for the component.
211
-
211
+
212
212
  The `lang` attribute **must** be set to a [valid BCP47 string](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/lang#Language_tag_syntax). A valid code can be the two or three letter language code - for example, English is `en` or `eng`, Korean is `ko` or `kor` - but if in doubt please check.
213
213
  data:
214
214
  href: "/not-a-page"
@@ -1,9 +1,11 @@
1
- name: Show password input
1
+ name: Show password input (experimental)
2
2
  description: A password input field that allows the password to be shown.
3
3
  body: |
4
4
  Adds a password reveal button to an input that toggles its type from password to text, revealing the password. Does not appear if JavaScript is disabled.
5
5
 
6
6
  Uses a visually hidden bit of text to inform screen reader users of the state of the input rather than announcing the content of the password input when toggled.
7
+
8
+ This component is currently experimental. If you are using it, please feed back any research findings to the Accounts team.
7
9
  accessibility_criteria: |
8
10
  The component must:
9
11
 
@@ -37,15 +37,17 @@ require "govuk_publishing_components/app_helpers/brand_helper"
37
37
  require "govuk_publishing_components/app_helpers/countdown_helper"
38
38
  require "govuk_publishing_components/app_helpers/environment"
39
39
 
40
- # Add view and i18n paths for usage outside of a Rails app
41
- ActionController::Base.append_view_path(
42
- File.expand_path("app/views", GovukPublishingComponents::Config.gem_directory),
43
- )
44
-
40
+ # Add i18n paths and views for usage outside of a Rails app
45
41
  I18n.load_path.unshift(
46
42
  *Dir.glob(File.expand_path("config/locales/*.yml", GovukPublishingComponents::Config.gem_directory)),
47
43
  )
48
44
 
45
+ ActiveSupport.on_load(:action_controller) do
46
+ ActionController::Base.append_view_path(
47
+ File.expand_path("app/views", GovukPublishingComponents::Config.gem_directory),
48
+ )
49
+ end
50
+
49
51
  module GovukPublishingComponents
50
52
  def self.render(component, options = {})
51
53
  I18n.with_locale(options.fetch(:locale, "en")) do
@@ -1,18 +1,18 @@
1
1
  module GovukPublishingComponents
2
2
  module AppHelpers
3
3
  class CountdownHelper
4
- END_OF_TRANSITION_PERIOD = Date.new(2021, 1, 1)
4
+ DEADLINE = Time.new(2020, 12, 31, 23, 59)
5
5
 
6
6
  def days_left
7
- sprintf "%02d", days_left_integer
7
+ sprintf "%02d", days_left_until_deadline
8
8
  end
9
9
 
10
10
  def show?
11
- days_left_integer.positive?
11
+ minutes_left_until_deadline >= 30
12
12
  end
13
13
 
14
14
  def days_text
15
- if days_left_integer == 1
15
+ if days_left_until_deadline == 1
16
16
  I18n.t!("components.transition_countdown.day_to_go")
17
17
  else
18
18
  I18n.t!("components.transition_countdown.days_to_go")
@@ -21,12 +21,28 @@ module GovukPublishingComponents
21
21
 
22
22
  private
23
23
 
24
- def days_left_integer
25
- (END_OF_TRANSITION_PERIOD - today_in_london).to_i
24
+ def days_left_until_deadline
25
+ (minutes_left_until_deadline / 60 / 24).ceil
26
26
  end
27
27
 
28
- def today_in_london
29
- Time.find_zone("Europe/London").today
28
+ def minutes_left_until_deadline
29
+ (seconds_left_until_deadline / 60)
30
+ end
31
+
32
+ def seconds_left_until_deadline
33
+ end_of_transition_period - now_in_london
34
+ end
35
+
36
+ def end_of_transition_period
37
+ london_time_zone(DEADLINE)
38
+ end
39
+
40
+ def now_in_london
41
+ london_time_zone(Time.now)
42
+ end
43
+
44
+ def london_time_zone(time)
45
+ time.in_time_zone("Europe/London")
30
46
  end
31
47
  end
32
48
  end
@@ -113,6 +113,10 @@ module GovukPublishingComponents
113
113
  tagged_to_brexit? && (page_content_id != brexit_start_page_content_id)
114
114
  end
115
115
 
116
+ def transition_countdown_exception?
117
+ content_item["content_id"] == "c3752802-f091-43a9-ba90-33568fccf391"
118
+ end
119
+
116
120
  def step_by_step_count
117
121
  step_nav_helper.step_navs.count
118
122
  end
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = "23.9.0".freeze
2
+ VERSION = "23.10.2".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: 23.9.0
4
+ version: 23.10.2
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: 2020-12-09 00:00:00.000000000 Z
11
+ date: 2020-12-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: govuk_app_config
@@ -404,6 +404,7 @@ files:
404
404
  - app/assets/javascripts/govuk_publishing_components/analytics/download-link-tracker.js
405
405
  - app/assets/javascripts/govuk_publishing_components/analytics/ecommerce.js
406
406
  - app/assets/javascripts/govuk_publishing_components/analytics/error-tracking.js
407
+ - app/assets/javascripts/govuk_publishing_components/analytics/explicit-cross-domain-links.js
407
408
  - app/assets/javascripts/govuk_publishing_components/analytics/external-link-tracker.js
408
409
  - app/assets/javascripts/govuk_publishing_components/analytics/google-analytics-universal-tracker.js
409
410
  - app/assets/javascripts/govuk_publishing_components/analytics/init.js