govuk_publishing_components 23.9.1 → 23.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (23) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/govuk_publishing_components/analytics.js +1 -0
  3. data/app/assets/javascripts/govuk_publishing_components/analytics/explicit-cross-domain-links.js +34 -0
  4. data/app/assets/javascripts/govuk_publishing_components/components/show-password.js +1 -0
  5. data/app/assets/javascripts/govuk_publishing_components/lib/govspeak/youtube-link-enhancement.js +3 -1
  6. data/app/assets/stylesheets/govuk_publishing_components/components/_contextual-sidebar.scss +46 -6
  7. data/app/assets/stylesheets/govuk_publishing_components/components/_search.scss +6 -2
  8. data/app/assets/stylesheets/govuk_publishing_components/components/_show-password.scss +2 -0
  9. data/app/views/govuk_publishing_components/components/_contextual_sidebar.html.erb +5 -18
  10. data/app/views/govuk_publishing_components/components/contextual_sidebar/_brexit_cta.html.erb +17 -3
  11. data/app/views/govuk_publishing_components/components/contextual_sidebar/_brexit_related_links.html.erb +6 -0
  12. data/app/views/govuk_publishing_components/components/docs/contextual_sidebar.yml +2 -2
  13. data/app/views/govuk_publishing_components/components/docs/image_card.yml +4 -4
  14. data/app/views/govuk_publishing_components/components/docs/show_password.yml +3 -1
  15. data/config/locales/cy.yml +2 -5
  16. data/config/locales/en.yml +2 -5
  17. data/lib/govuk_publishing_components.rb +7 -6
  18. data/lib/govuk_publishing_components/presenters/contextual_navigation.rb +1 -1
  19. data/lib/govuk_publishing_components/version.rb +1 -1
  20. metadata +4 -5
  21. data/app/views/govuk_publishing_components/components/_transition_countdown.html.erb +0 -35
  22. data/app/views/govuk_publishing_components/components/docs/transition_countdown.yml +0 -17
  23. data/lib/govuk_publishing_components/app_helpers/countdown_helper.rb +0 -33
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4cd0fe20798b2b09a2fdb3859bf4f0ed0bf228b09eff59bcfcd3876040e2ccb3
4
- data.tar.gz: bf0634d46d9a7d2d238ab1db63c0501dd137a1caa6ee396b22ad64ebccc2ba3c
3
+ metadata.gz: 884556b32a54e514794dba01e0bbac985e9fae36beeea08e458e017ba20bc397
4
+ data.tar.gz: 920499e180389d7f7fb34ad3a84b018a3e8d02a69393244c18027a55a0272031
5
5
  SHA512:
6
- metadata.gz: 48ee8d3872e95988f9774f6587471cfd52949d235355d7c9da14f3d08d4d05e81304811840a54ce3a5f6f8a4c0753b2c75285e9d5526659c2dc88415c7a1ee1b
7
- data.tar.gz: fc1baafeebbb3cf0c3d9a3d79d782aa4b3e70e115d8b08f9c67594fbde3b9d60824eeadaf485a279620e90273117f00d10530e7c42a071d1bca9e4bdd9a92268
6
+ metadata.gz: e7f807097888f485b69167eadc138c279654952b4e67050312d8f12215d439a503471da4af64198201bc99c6c0b967d1203482350037d29eb1900c330c9af7f8
7
+ data.tar.gz: c360c8660c5e049177a15289856df34b84ccf25c3132361d8dcd5418a1947289afa76ff7ff0aff9ea103e8c8d8220ea57029fd790f7740169c9e6aa1aa9edf1b
@@ -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
@@ -1,11 +1,51 @@
1
- @import 'transition-countdown';
1
+ $transition-campaign-red: #ff003b;
2
+ $transition-campaign-dark-blue: #1e1348;
2
3
 
3
- .gem-c-contextual-sidebar__brexit-cta {
4
+ .gem-c-contextual-sidebar__brexit-related-links {
4
5
  border-top: 2px solid $govuk-brand-colour;
6
+
7
+ .gem-c-contextual-sidebar__brexit-heading {
8
+ @include govuk-font(19, $weight: bold);
9
+ padding-top: govuk-spacing(3);
10
+ margin-bottom: govuk-spacing(2);
11
+ }
12
+ }
13
+
14
+ .gem-c-contextual-sidebar__brexit-cta {
15
+ @include govuk-font(19);
16
+ margin-bottom: govuk-spacing(6);
17
+ background-color: govuk-colour('light-grey', $legacy: 'grey-4');
18
+ border-top: 4px solid $transition-campaign-red;
19
+ display: block;
20
+ padding: govuk-spacing(3);
21
+ text-decoration: none;
22
+
23
+ .gem-c-contextual-sidebar__brexit-heading {
24
+ @extend %govuk-heading-m;
25
+ color: $transition-campaign-dark-blue;
26
+ }
27
+
28
+ .gem-c-contextual-sidebar__brexit-text {
29
+ @extend %govuk-link;
30
+
31
+ margin-top: 0;
32
+ margin-bottom: 0;
33
+ text-decoration: underline;
34
+
35
+ @include govuk-media-query($from: tablet) {
36
+ margin-bottom: govuk-spacing(2);
37
+ }
38
+ }
39
+
40
+ @include govuk-compatibility(govuk_template) {
41
+ .gem-c-contextual-sidebar__brexit-title {
42
+ margin-bottom: govuk-spacing(3);
43
+ }
44
+ }
5
45
  }
6
46
 
7
- .gem-c-contextual-sidebar__brexit-heading {
8
- @include govuk-font(19, $weight: bold);
9
- padding-top: govuk-spacing(3);
10
- margin-bottom: govuk-spacing(2);
47
+ .gem-c-contextual-sidebar__brexit-cta:focus {
48
+ .gem-c-contextual-sidebar__brexit-text {
49
+ text-decoration: none;
50
+ }
11
51
  }
@@ -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 {
@@ -2,23 +2,10 @@
2
2
  <% shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns) %>
3
3
 
4
4
  <div class="gem-c-contextual-sidebar">
5
- <% if navigation.show_brexit_cta? && navigation.step_by_step_count.zero? %>
6
- <%= render 'govuk_publishing_components/components/contextual_sidebar/brexit_cta' %>
5
+ <% if navigation.show_brexit_related_links? && navigation.step_by_step_count.zero? %>
6
+ <%= render 'govuk_publishing_components/components/contextual_sidebar/brexit_related_links' %>
7
7
  <% elsif navigation.step_by_step_count.zero? && !navigation.transition_countdown_exception? %>
8
- <%= render 'govuk_publishing_components/components/transition_countdown', {
9
- title: t("components.related_navigation.transition.title"),
10
- url: t("components.related_navigation.transition.link_path"),
11
- text: t("components.related_navigation.transition.link_text"),
12
- data_attributes: {
13
- "module": "track-click",
14
- "track-category": "relatedLinkClicked",
15
- "track-action": "1.0 Transition",
16
- "track-label": t("components.related_navigation.transition.link_path"),
17
- "track-dimension": t("components.related_navigation.transition.link_text"),
18
- "track-dimension-index": "29",
19
- },
20
- lang: shared_helper.t_locale("components.related_navigation.transition.title"),
21
- } %>
8
+ <%= render 'govuk_publishing_components/components/contextual_sidebar/brexit_cta' %>
22
9
  <% end %>
23
10
 
24
11
  <% if navigation.content_tagged_to_a_reasonable_number_of_step_by_steps? %>
@@ -43,7 +30,7 @@
43
30
  } %>
44
31
  <% end %>
45
32
 
46
- <% if navigation.show_brexit_cta? && navigation.step_by_step_count > 0 %>
47
- <%= render 'govuk_publishing_components/components/contextual_sidebar/brexit_cta' %>
33
+ <% if navigation.show_brexit_related_links? && navigation.step_by_step_count > 0 %>
34
+ <%= render 'govuk_publishing_components/components/contextual_sidebar/brexit_related_links' %>
48
35
  <% end %>
49
36
  </div>
@@ -1,6 +1,20 @@
1
+ <% shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns) %>
1
2
  <% link_text = t("components.related_navigation.transition.link_text") %>
2
3
  <% link_path = t("components.related_navigation.transition.link_path") %>
3
- <div class="gem-c-contextual-sidebar__brexit-cta govuk-!-margin-bottom-6" data-module="track-click" lang="en">
4
+
5
+ <% data_attributes = {
6
+ "module": "track-click",
7
+ "track-category": "relatedLinkClicked",
8
+ "track-action": "1.0 Transition",
9
+ "track-label": link_path,
10
+ "track-dimension": link_text,
11
+ "track-dimension-index": "29",
12
+ } %>
13
+
14
+ <%= link_to link_path,
15
+ class: "govuk-link gem-c-contextual-sidebar__brexit-cta",
16
+ data: data_attributes,
17
+ lang: shared_helper.t_locale("components.related_navigation.transition.title") do %>
4
18
  <h2 class="gem-c-contextual-sidebar__brexit-heading"><%= t("components.related_navigation.transition.title") %></h2>
5
- <a href="<%= link_path %>" class="govuk-link" data-track-category="relatedLinkClicked" data-track-action="1.0 Transition" data-track-label="<%= link_path %>" data-track-options='{"dimension29":"<%= link_text %>"}'><%= link_text %></a>
6
- </div>
19
+ <p class="gem-c-contextual-sidebar__brexit-text"><%= link_text %></p>
20
+ <% end %>
@@ -0,0 +1,6 @@
1
+ <% link_text = t("components.related_navigation.transition.link_text") %>
2
+ <% link_path = t("components.related_navigation.transition.link_path") %>
3
+ <div class="gem-c-contextual-sidebar__brexit-related-links govuk-!-margin-bottom-6" data-module="track-click" lang="en">
4
+ <h2 class="gem-c-contextual-sidebar__brexit-heading"><%= t("components.related_navigation.transition.title") %></h2>
5
+ <a href="<%= link_path %>" class="govuk-link" data-track-category="relatedLinkClicked" data-track-action="1.0 Transition" data-track-label="<%= link_path %>" data-track-options='{"dimension29":"<%= link_text %>"}'><%= link_text %></a>
6
+ </div>
@@ -81,7 +81,7 @@ examples:
81
81
  - text: The Highway Code
82
82
  href: "/guidance/the-highway-code"
83
83
  optional: false
84
- with_brexit_cta_and_related_links:
84
+ with_brexit_and_other_related_links:
85
85
  data:
86
86
  content_item:
87
87
  title: "A content item"
@@ -108,7 +108,7 @@ examples:
108
108
  - title: The future of jobs and skills
109
109
  base_path: /government/collections/the-future-of-jobs-and-skills
110
110
  document_type: document_collection
111
- with_brexit_cta_and_step_by_steps:
111
+ with_brexit_related_links_and_step_by_steps:
112
112
  data:
113
113
  content_item:
114
114
  title: "A content item"
@@ -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
 
@@ -10,9 +10,6 @@ cy:
10
10
  contents: Cynnwys
11
11
  related_navigation:
12
12
  transition:
13
- title: "Pontio Brexit"
13
+ title: "Brexit"
14
14
  link_path: "/transition.cy"
15
- link_text: "Gwiriwch eich bod chi'n barod ar gyfer 2021"
16
- transition_countdown:
17
- day_to_go: "diwrnod i fynd"
18
- days_to_go: "diwrnod i fynd"
15
+ link_text: "Darganfyddwch sut mae’r rheolau newydd yn effeithio arnoch chi"
@@ -77,9 +77,9 @@ en:
77
77
  topical_events: "Topical event"
78
78
  world_locations: "World locations"
79
79
  transition:
80
- title: "Brexit transition"
80
+ title: "Brexit"
81
81
  link_path: "/transition"
82
- link_text: "Check you’re ready for 2021"
82
+ link_text: "Check how the new rules affect you"
83
83
  related_footer_navigation:
84
84
  collections: "Collections"
85
85
  policies: "Policies"
@@ -103,6 +103,3 @@ en:
103
103
  summary_list:
104
104
  edit: "Change"
105
105
  delete: "Delete"
106
- transition_countdown:
107
- day_to_go: "day to go"
108
- days_to_go: "days to go"
@@ -34,18 +34,19 @@ require "govuk_publishing_components/presenters/taxonomy_list_helper"
34
34
  require "govuk_publishing_components/app_helpers/taxon_breadcrumbs"
35
35
  require "govuk_publishing_components/app_helpers/table_helper"
36
36
  require "govuk_publishing_components/app_helpers/brand_helper"
37
- require "govuk_publishing_components/app_helpers/countdown_helper"
38
37
  require "govuk_publishing_components/app_helpers/environment"
39
38
 
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
-
39
+ # Add i18n paths and views for usage outside of a Rails app
45
40
  I18n.load_path.unshift(
46
41
  *Dir.glob(File.expand_path("config/locales/*.yml", GovukPublishingComponents::Config.gem_directory)),
47
42
  )
48
43
 
44
+ ActiveSupport.on_load(:action_controller) do
45
+ ActionController::Base.append_view_path(
46
+ File.expand_path("app/views", GovukPublishingComponents::Config.gem_directory),
47
+ )
48
+ end
49
+
49
50
  module GovukPublishingComponents
50
51
  def self.render(component, options = {})
51
52
  I18n.with_locale(options.fetch(:locale, "en")) do
@@ -104,7 +104,7 @@ module GovukPublishingComponents
104
104
  false
105
105
  end
106
106
 
107
- def show_brexit_cta?
107
+ def show_brexit_related_links?
108
108
  # If tagged directly to /brexit or /world/brexit
109
109
  # Or if tagged to a taxon which has /brexit as a parent
110
110
  # And is not the brexit checker start page
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = "23.9.1".freeze
2
+ VERSION = "23.11.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: 23.9.1
4
+ version: 23.11.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: 2020-12-11 00:00:00.000000000 Z
11
+ date: 2020-12-31 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
@@ -677,13 +678,13 @@ files:
677
678
  - app/views/govuk_publishing_components/components/_taxonomy_list.html.erb
678
679
  - app/views/govuk_publishing_components/components/_textarea.html.erb
679
680
  - app/views/govuk_publishing_components/components/_title.html.erb
680
- - app/views/govuk_publishing_components/components/_transition_countdown.html.erb
681
681
  - app/views/govuk_publishing_components/components/_translation-nav.html.erb
682
682
  - app/views/govuk_publishing_components/components/_warning_text.html.erb
683
683
  - app/views/govuk_publishing_components/components/attachment/_thumbnail_document.svg
684
684
  - app/views/govuk_publishing_components/components/attachment/_thumbnail_generic.svg
685
685
  - app/views/govuk_publishing_components/components/attachment/_thumbnail_spreadsheet.svg
686
686
  - app/views/govuk_publishing_components/components/contextual_sidebar/_brexit_cta.html.erb
687
+ - app/views/govuk_publishing_components/components/contextual_sidebar/_brexit_related_links.html.erb
687
688
  - app/views/govuk_publishing_components/components/docs/accordion.yml
688
689
  - app/views/govuk_publishing_components/components/docs/action_link.yml
689
690
  - app/views/govuk_publishing_components/components/docs/admin_analytics.yml
@@ -757,7 +758,6 @@ files:
757
758
  - app/views/govuk_publishing_components/components/docs/taxonomy_list.yml
758
759
  - app/views/govuk_publishing_components/components/docs/textarea.yml
759
760
  - app/views/govuk_publishing_components/components/docs/title.yml
760
- - app/views/govuk_publishing_components/components/docs/transition_countdown.yml
761
761
  - app/views/govuk_publishing_components/components/docs/translation-nav.yml
762
762
  - app/views/govuk_publishing_components/components/docs/warning_text.yml
763
763
  - app/views/govuk_publishing_components/components/feedback/_problem_form.html.erb
@@ -782,7 +782,6 @@ files:
782
782
  - lib/generators/govuk_publishing_components/templates/component.yml.erb
783
783
  - lib/govuk_publishing_components.rb
784
784
  - lib/govuk_publishing_components/app_helpers/brand_helper.rb
785
- - lib/govuk_publishing_components/app_helpers/countdown_helper.rb
786
785
  - lib/govuk_publishing_components/app_helpers/environment.rb
787
786
  - lib/govuk_publishing_components/app_helpers/table_helper.rb
788
787
  - lib/govuk_publishing_components/app_helpers/taxon_breadcrumbs.rb
@@ -1,35 +0,0 @@
1
- <%
2
- countdown_clock = GovukPublishingComponents::AppHelpers::CountdownHelper.new
3
- shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
4
-
5
- heading_level ||= 2
6
- title ||= nil
7
- text ||= nil
8
- url ||= nil
9
- data_attributes ||= {}
10
- lang ||= "en"
11
- direction ||= "ltr"
12
- css_classes = %w(gem-c-transition-countdown)
13
- css_classes << "gem-c-transition-countdown--cta" if url
14
- css_classes << "govuk-link" if url
15
- %>
16
-
17
- <% countdown = capture do %>
18
- <%= content_tag(shared_helper.get_heading_level, title, class: "gem-c-transition-countdown__title") if title %>
19
- <% if countdown_clock.show? %>
20
- <%= tag.p class: "gem-c-transition-countdown__countdown" do %>
21
- <%= tag.span countdown_clock.days_left.first, class: "gem-c-transition-countdown__countdown-number" %><%= tag.span countdown_clock.days_left.last, class: "gem-c-transition-countdown__countdown-number" %> <%= tag.span countdown_clock.days_text, class: "gem-c-transition-countdown__countdown-text" %>
22
- <% end %>
23
- <% end %>
24
- <%= tag.p text, class: "gem-c-transition-countdown__text" if text %>
25
- <% end %>
26
-
27
- <% if url %>
28
- <%= link_to url, class: css_classes, data: data_attributes, lang: lang, dir: direction do %>
29
- <%= countdown %>
30
- <% end %>
31
- <% else %>
32
- <%= tag.div class: css_classes, lang: lang, dir: direction do %>
33
- <%= countdown %>
34
- <% end %>
35
- <% end %>
@@ -1,17 +0,0 @@
1
- name: Transition countdown
2
- description: A countdown to 01 January 2021 used in the Brexit transition campaign
3
- body: When a URL is set it acts as a link to actions users need to take to prepare for brexit during the transition period
4
- shared_accessibility_criteria:
5
- - link
6
- examples:
7
- default:
8
- data:
9
- call_to_action:
10
- data:
11
- title: Brexit transition
12
- text: Check you’re ready for 2021
13
- url: "https://www.gov.uk/transition"
14
- data_attributes:
15
- "track-category": "Transition"
16
- "track-action": "Brexit transition"
17
- "track-label": "Check you’re ready for 2021"
@@ -1,33 +0,0 @@
1
- module GovukPublishingComponents
2
- module AppHelpers
3
- class CountdownHelper
4
- END_OF_TRANSITION_PERIOD = Date.new(2021, 1, 1)
5
-
6
- def days_left
7
- sprintf "%02d", days_left_integer
8
- end
9
-
10
- def show?
11
- days_left_integer.positive?
12
- end
13
-
14
- def days_text
15
- if days_left_integer == 1
16
- I18n.t!("components.transition_countdown.day_to_go")
17
- else
18
- I18n.t!("components.transition_countdown.days_to_go")
19
- end
20
- end
21
-
22
- private
23
-
24
- def days_left_integer
25
- (END_OF_TRANSITION_PERIOD - today_in_london).to_i
26
- end
27
-
28
- def today_in_london
29
- Time.find_zone("Europe/London").today
30
- end
31
- end
32
- end
33
- end