govuk_publishing_components 23.10.1 → 23.12.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (22) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/govuk_publishing_components/analytics/external-link-tracker.js +0 -2
  3. data/app/assets/javascripts/govuk_publishing_components/analytics/pii.js +29 -1
  4. data/app/assets/stylesheets/govuk_publishing_components/components/_contextual-sidebar.scss +46 -6
  5. data/app/controllers/govuk_publishing_components/audit_controller.rb +3 -0
  6. data/app/models/govuk_publishing_components/audit_applications.rb +12 -5
  7. data/app/models/govuk_publishing_components/audit_comparer.rb +12 -0
  8. data/app/views/govuk_publishing_components/audit/show.html.erb +15 -0
  9. data/app/views/govuk_publishing_components/components/_contextual_sidebar.html.erb +5 -18
  10. data/app/views/govuk_publishing_components/components/_machine_readable_metadata.html.erb +1 -1
  11. data/app/views/govuk_publishing_components/components/contextual_sidebar/_brexit_cta.html.erb +17 -3
  12. data/app/views/govuk_publishing_components/components/contextual_sidebar/_brexit_related_links.html.erb +6 -0
  13. data/app/views/govuk_publishing_components/components/docs/contextual_sidebar.yml +2 -2
  14. data/config/locales/cy.yml +2 -5
  15. data/config/locales/en.yml +2 -5
  16. data/lib/govuk_publishing_components.rb +7 -6
  17. data/lib/govuk_publishing_components/presenters/contextual_navigation.rb +1 -1
  18. data/lib/govuk_publishing_components/version.rb +1 -1
  19. metadata +3 -5
  20. data/app/views/govuk_publishing_components/components/_transition_countdown.html.erb +0 -35
  21. data/app/views/govuk_publishing_components/components/docs/transition_countdown.yml +0 -17
  22. 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: d2f681b78ca039b8a55b58be79b935acbb1f8c1ca30e010d8cbc26eaaf1b26b4
4
- data.tar.gz: 0f7fdd2c05953ec4a4ccc73e7335d11195923a62fd959a1f99eebc5a944a0bc1
3
+ metadata.gz: f576e3d439679c36e70503acbdd7b7ae2bed87c9d2dea7a5bbdd11743e8f8161
4
+ data.tar.gz: f4b49a21872957da107631f6dc2d0f3ff38d624cde346e2f30ac9f0b4b26e572
5
5
  SHA512:
6
- metadata.gz: 070cf7a1d723b8d4aaddb9cfc366ab2f8b25445316efa000f8eacc4ea4c852aa764da637714ff29073fa016f2056b9a6083e1ed35b75629aea3156068f051232
7
- data.tar.gz: e5632bc51e2307471d9b48dd668f8b76ff3c1f52f138e4efd07f09580887d6df510153e13d3aa4bfe5f18396d3d7fedd7ab9067f73297752c950a2c2dd989098
6
+ metadata.gz: d26821d9c8fc386600981d8173bdd6e7cac6d9a4dc8a03c9c64128dc9ce5c66ecfbfcc079a7e03070dd81d5be4eaf9f9547becbafe148f7de1b1c2f38ee76a52
7
+ data.tar.gz: 544cdceba43441a149e1770abeb5074d1a8c40c4d87d023a0d47cd0b42c94a8d142a1a51b7e022293483f5ea9f6f54d64aba2cd63e121c33ea9ee5c6948c4296
@@ -10,7 +10,6 @@
10
10
  var externalLinkUploadCustomDimension = options.externalLinkUploadCustomDimension
11
11
  var currentHost = GOVUK.analyticsPlugins.externalLinkTracker.getHostname()
12
12
  var externalLinkSelector = 'a[href^="http"]:not(a[href*="' + currentHost + '"])'
13
-
14
13
  $('body').on('click', externalLinkSelector, trackClickEvent)
15
14
 
16
15
  function trackClickEvent (evt) {
@@ -33,7 +32,6 @@
33
32
 
34
33
  GOVUK.analytics.setDimension(externalLinkUploadCustomDimension, externalLinkToJoinUploadOn)
35
34
  }
36
-
37
35
  GOVUK.analytics.trackEvent('External Link Clicked', href, options)
38
36
  }
39
37
 
@@ -5,8 +5,9 @@
5
5
 
6
6
  var GOVUK = global.GOVUK || {}
7
7
  var EMAIL_PATTERN = /[^\s=/?&]+(?:@|%40)[^\s=/?&]+/g
8
- var POSTCODE_PATTERN = /[A-PR-UWYZ][A-HJ-Z]?[0-9][0-9A-HJKMNPR-Y]?(?:[\s+]|%20)*[0-9][ABD-HJLNPQ-Z]{2}/gi
8
+ var POSTCODE_PATTERN = /[A-PR-UWYZ][A-HJ-Z]?[0-9][0-9A-HJKMNPR-Y]?(?:[\s+]|%20)*[0-9](?!refund)[ABD-HJLNPQ-Z]{2,3}/gi
9
9
  var DATE_PATTERN = /\d{4}(-?)\d{2}(-?)\d{2}/g
10
+ var ESCAPE_REGEX_PATTERN = /[|\\{}()[\]^$+*?.]/g
10
11
 
11
12
  // specific URL parameters to be redacted from accounts URLs
12
13
  var RESET_PASSWORD_TOKEN_PATTERN = /reset_password_token=[a-zA-Z0-9-]+/g
@@ -21,9 +22,24 @@
21
22
  return ($('meta[name="govuk:static-analytics:strip-postcodes"]').length > 0)
22
23
  }
23
24
 
25
+ function queryStringParametersToStrip () {
26
+ var value = $('meta[name="govuk:static-analytics:strip-query-string-parameters"]').attr('content')
27
+ var parameters = []
28
+
29
+ if (value) {
30
+ var split = value.split(',')
31
+ for (var i = 0; i < split.length; i++) {
32
+ parameters.push(split[i].trim())
33
+ }
34
+ }
35
+
36
+ return parameters
37
+ }
38
+
24
39
  var pii = function () {
25
40
  this.stripDatePII = shouldStripDates()
26
41
  this.stripPostcodePII = shouldStripPostcodes()
42
+ this.queryStringParametersToStrip = queryStringParametersToStrip()
27
43
  }
28
44
 
29
45
  pii.prototype.stripPII = function (value) {
@@ -43,6 +59,7 @@
43
59
  stripped = stripped.replace(RESET_PASSWORD_TOKEN_PATTERN, 'reset_password_token=[reset_password_token]')
44
60
  stripped = stripped.replace(UNLOCK_TOKEN_PATTERN, 'unlock_token=[unlock_token]')
45
61
  stripped = stripped.replace(STATE_PATTERN, 'state=[state]')
62
+ stripped = this.stripQueryStringParameters(stripped)
46
63
 
47
64
  if (this.stripDatePII === true) {
48
65
  stripped = stripped.replace(DATE_PATTERN, '[date]')
@@ -77,6 +94,17 @@
77
94
  return array
78
95
  }
79
96
 
97
+ pii.prototype.stripQueryStringParameters = function (string) {
98
+ for (var i = 0; i < this.queryStringParametersToStrip.length; i++) {
99
+ var parameter = this.queryStringParametersToStrip[i]
100
+ var escaped = parameter.replace(ESCAPE_REGEX_PATTERN, '\\$&')
101
+ var regexp = new RegExp('((?:\\?|&)' + escaped + '=)(?:[^&#\\s]*)', 'g')
102
+ string = string.replace(regexp, '$1[' + parameter + ']')
103
+ }
104
+
105
+ return string
106
+ }
107
+
80
108
  GOVUK.Pii = pii
81
109
 
82
110
  global.GOVUK = GOVUK
@@ -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
  }
@@ -21,12 +21,15 @@ module GovukPublishingComponents
21
21
  collections-publisher
22
22
  content-data-admin
23
23
  content-publisher
24
+ datagovuk_find
24
25
  email-alert-frontend
25
26
  feedback
26
27
  finder-frontend
27
28
  frontend
28
29
  government-frontend
29
30
  govspeak-preview
31
+ govuk-account-manager-prototype
32
+ govuk-coronavirus-vulnerable-people-form
30
33
  info-frontend
31
34
  licence-finder
32
35
  manuals-frontend
@@ -7,6 +7,7 @@ module GovukPublishingComponents
7
7
  application_found = application_exists(path)
8
8
  components_found = []
9
9
  @gem_style_references = []
10
+ @jquery_references = []
10
11
 
11
12
  if application_found
12
13
  templates = Dir["#{path}/app/views/**/*.erb"]
@@ -65,6 +66,7 @@ module GovukPublishingComponents
65
66
  application_found: application_found,
66
67
  components_found: components_found,
67
68
  gem_style_references: @gem_style_references.flatten.uniq.sort,
69
+ jquery_references: @jquery_references.flatten.uniq.sort,
68
70
  }
69
71
  end
70
72
 
@@ -76,8 +78,14 @@ module GovukPublishingComponents
76
78
  files.each do |file|
77
79
  src = File.read(file)
78
80
  components_found << find_match(find, src, type)
79
- gem_references = find_gem_references(file, src)
80
- @gem_style_references << gem_references if gem_references
81
+
82
+ if type == "javascripts"
83
+ jquery_references = find_code_references(file, src, /\$\(/)
84
+ @jquery_references << jquery_references if jquery_references
85
+ else
86
+ gem_style_references = find_code_references(file, src, /gem-c-[-_a-zA-Z]+/)
87
+ @gem_style_references << gem_style_references if gem_style_references
88
+ end
81
89
  rescue StandardError
82
90
  puts "File #{file} not found"
83
91
  end
@@ -99,11 +107,10 @@ module GovukPublishingComponents
99
107
  all_matches
100
108
  end
101
109
 
102
- def find_gem_references(file, src)
103
- find_gem_classes = /gem-c-[-_a-zA-Z]+/
110
+ def find_code_references(file, src, regex)
104
111
  clean_file_path = /(?<=#{Regexp.escape(@path)}\/)[\/a-zA-Z_-]+.[a-zA-Z.]+/
105
112
 
106
- return file[clean_file_path] if find_gem_classes.match?(src)
113
+ return file[clean_file_path] if regex.match?(src)
107
114
  end
108
115
 
109
116
  def clean_file_name(name)
@@ -37,6 +37,7 @@ module GovukPublishingComponents
37
37
  warnings << warn_about_missing_components(result[:components_found])
38
38
  warnings << warn_about_missing_assets(result[:components_found])
39
39
  warnings << warn_about_style_overrides(result[:gem_style_references])
40
+ warnings << warn_about_jquery_references(result[:jquery_references])
40
41
  warnings = warnings.flatten
41
42
 
42
43
  data << {
@@ -67,6 +68,7 @@ module GovukPublishingComponents
67
68
  warnings: warnings,
68
69
  warning_count: warnings.length,
69
70
  gem_style_references: result[:gem_style_references],
71
+ jquery_references: result[:jquery_references],
70
72
  }
71
73
  else
72
74
  data << {
@@ -163,6 +165,16 @@ module GovukPublishingComponents
163
165
  warnings
164
166
  end
165
167
 
168
+ def warn_about_jquery_references(results)
169
+ warnings = []
170
+
171
+ results.each do |result|
172
+ warnings << create_warning("Possible jQuery", result)
173
+ end
174
+
175
+ warnings
176
+ end
177
+
166
178
  def find_missing(needle, haystack)
167
179
  (haystack - needle).flatten.sort
168
180
  end
@@ -109,6 +109,21 @@
109
109
  <% end %>
110
110
  </ul>
111
111
  <% end %>
112
+
113
+ <% if application[:jquery_references].any? %>
114
+ <%= render "govuk_publishing_components/components/heading", {
115
+ text: "jQuery references",
116
+ font_size: "m",
117
+ margin_bottom: 4,
118
+ heading_level: 3,
119
+ } %>
120
+ <p class="govuk-body">This shows JavaScript files that might contain jQuery, which we are trying to remove our dependency on.</p>
121
+ <ul class="govuk-list govuk-list--bullet">
122
+ <% application[:jquery_references].each do |ref| %>
123
+ <li><%= ref %></li>
124
+ <% end %>
125
+ </ul>
126
+ <% end %>
112
127
  <% else %>
113
128
  <p class="govuk-body">This application was not found. This could be because you do not have this repository checked out locally.</p>
114
129
  <% end %>
@@ -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>
@@ -9,7 +9,7 @@
9
9
  <% structured_data = GovukPublishingComponents::Presenters::SchemaOrg.new(page).structured_data %>
10
10
 
11
11
  <script type="application/ld+json">
12
- <%= raw JSON.pretty_generate(structured_data) %>
12
+ <%= raw(json_escape(JSON.pretty_generate(structured_data))) %>
13
13
  </script>
14
14
 
15
15
  <link rel="canonical" href="<%= page.canonical_url %>" />
@@ -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"
@@ -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 Brexit 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 Brexit 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.10.1".freeze
2
+ VERSION = "23.12.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: 23.10.1
4
+ version: 23.12.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: 2020-12-17 00:00:00.000000000 Z
11
+ date: 2021-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: govuk_app_config
@@ -678,13 +678,13 @@ files:
678
678
  - app/views/govuk_publishing_components/components/_taxonomy_list.html.erb
679
679
  - app/views/govuk_publishing_components/components/_textarea.html.erb
680
680
  - app/views/govuk_publishing_components/components/_title.html.erb
681
- - app/views/govuk_publishing_components/components/_transition_countdown.html.erb
682
681
  - app/views/govuk_publishing_components/components/_translation-nav.html.erb
683
682
  - app/views/govuk_publishing_components/components/_warning_text.html.erb
684
683
  - app/views/govuk_publishing_components/components/attachment/_thumbnail_document.svg
685
684
  - app/views/govuk_publishing_components/components/attachment/_thumbnail_generic.svg
686
685
  - app/views/govuk_publishing_components/components/attachment/_thumbnail_spreadsheet.svg
687
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
688
688
  - app/views/govuk_publishing_components/components/docs/accordion.yml
689
689
  - app/views/govuk_publishing_components/components/docs/action_link.yml
690
690
  - app/views/govuk_publishing_components/components/docs/admin_analytics.yml
@@ -758,7 +758,6 @@ files:
758
758
  - app/views/govuk_publishing_components/components/docs/taxonomy_list.yml
759
759
  - app/views/govuk_publishing_components/components/docs/textarea.yml
760
760
  - app/views/govuk_publishing_components/components/docs/title.yml
761
- - app/views/govuk_publishing_components/components/docs/transition_countdown.yml
762
761
  - app/views/govuk_publishing_components/components/docs/translation-nav.yml
763
762
  - app/views/govuk_publishing_components/components/docs/warning_text.yml
764
763
  - app/views/govuk_publishing_components/components/feedback/_problem_form.html.erb
@@ -783,7 +782,6 @@ files:
783
782
  - lib/generators/govuk_publishing_components/templates/component.yml.erb
784
783
  - lib/govuk_publishing_components.rb
785
784
  - lib/govuk_publishing_components/app_helpers/brand_helper.rb
786
- - lib/govuk_publishing_components/app_helpers/countdown_helper.rb
787
785
  - lib/govuk_publishing_components/app_helpers/environment.rb
788
786
  - lib/govuk_publishing_components/app_helpers/table_helper.rb
789
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