govuk_publishing_components 23.9.2 → 23.11.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/govuk_publishing_components/analytics.js +1 -0
- data/app/assets/javascripts/govuk_publishing_components/analytics/explicit-cross-domain-links.js +34 -0
- data/app/assets/javascripts/govuk_publishing_components/lib/govspeak/youtube-link-enhancement.js +3 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_contextual-sidebar.scss +46 -6
- data/app/controllers/govuk_publishing_components/audit_controller.rb +3 -0
- data/app/models/govuk_publishing_components/audit_applications.rb +12 -5
- data/app/models/govuk_publishing_components/audit_comparer.rb +12 -0
- data/app/views/govuk_publishing_components/audit/show.html.erb +15 -0
- data/app/views/govuk_publishing_components/components/_contextual_sidebar.html.erb +5 -18
- data/app/views/govuk_publishing_components/components/contextual_sidebar/_brexit_cta.html.erb +17 -3
- data/app/views/govuk_publishing_components/components/contextual_sidebar/_brexit_related_links.html.erb +6 -0
- data/app/views/govuk_publishing_components/components/docs/contextual_sidebar.yml +2 -2
- data/app/views/govuk_publishing_components/components/docs/show_password.yml +3 -1
- data/config/locales/cy.yml +2 -5
- data/config/locales/en.yml +2 -5
- data/lib/govuk_publishing_components.rb +7 -6
- data/lib/govuk_publishing_components/presenters/contextual_navigation.rb +1 -1
- data/lib/govuk_publishing_components/version.rb +1 -1
- metadata +4 -5
- data/app/views/govuk_publishing_components/components/_transition_countdown.html.erb +0 -35
- data/app/views/govuk_publishing_components/components/docs/transition_countdown.yml +0 -17
- 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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bfc403e4ae4e502dac4d0bbc51a5e3c0e454097ea602ef00a1cf0fd3e1ff98fb
|
4
|
+
data.tar.gz: 2b19a5969e18d37c3643fc800fb24a549487af3443074e7729d541184e16c315
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e9e7ee289c6a1cb4be8fdfba47fe6ca937654ee7fb379c8b1c2b88ff9a2cb890187a9ff7a2b5f850f17ef051f2b6d6e89fc3541acd8317aa7e991f52e6d10a0
|
7
|
+
data.tar.gz: e35c4c8554dbac78e610c31423d3b7e97f1bc8bfce31a32d3340ce99424d034694fbe868f0d70358d56b61604bfe5374d7be1d20b911b67539c6c9b93f1038a0
|
data/app/assets/javascripts/govuk_publishing_components/analytics/explicit-cross-domain-links.js
ADDED
@@ -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)
|
data/app/assets/javascripts/govuk_publishing_components/lib/govspeak/youtube-link-enhancement.js
CHANGED
@@ -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.
|
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
|
-
|
1
|
+
$transition-campaign-red: #ff003b;
|
2
|
+
$transition-campaign-dark-blue: #1e1348;
|
2
3
|
|
3
|
-
.gem-c-contextual-sidebar__brexit-
|
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-
|
8
|
-
|
9
|
-
|
10
|
-
|
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
|
-
|
80
|
-
|
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
|
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
|
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.
|
6
|
-
<%= render 'govuk_publishing_components/components/contextual_sidebar/
|
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/
|
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.
|
47
|
-
<%= render 'govuk_publishing_components/components/contextual_sidebar/
|
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>
|
data/app/views/govuk_publishing_components/components/contextual_sidebar/_brexit_cta.html.erb
CHANGED
@@ -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
|
-
|
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
|
-
<
|
6
|
-
|
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
|
-
|
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
|
-
|
111
|
+
with_brexit_related_links_and_step_by_steps:
|
112
112
|
data:
|
113
113
|
content_item:
|
114
114
|
title: "A content item"
|
@@ -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
|
|
data/config/locales/cy.yml
CHANGED
@@ -10,9 +10,6 @@ cy:
|
|
10
10
|
contents: Cynnwys
|
11
11
|
related_navigation:
|
12
12
|
transition:
|
13
|
-
title: "
|
13
|
+
title: "Brexit"
|
14
14
|
link_path: "/transition.cy"
|
15
|
-
link_text: "
|
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"
|
data/config/locales/en.yml
CHANGED
@@ -77,9 +77,9 @@ en:
|
|
77
77
|
topical_events: "Topical event"
|
78
78
|
world_locations: "World locations"
|
79
79
|
transition:
|
80
|
-
title: "Brexit
|
80
|
+
title: "Brexit"
|
81
81
|
link_path: "/transition"
|
82
|
-
link_text: "Check
|
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
|
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
|
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
|
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.
|
4
|
+
version: 23.11.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:
|
11
|
+
date: 2021-01-06 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
|