govuk_publishing_components 23.4.0 → 23.7.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/components/copy-to-clipboard.js +16 -14
- data/app/assets/javascripts/govuk_publishing_components/components/details.js +38 -34
- data/app/assets/javascripts/govuk_publishing_components/components/print-link.js +8 -7
- data/app/assets/javascripts/govuk_publishing_components/lib/govspeak/magna-charta.js +1 -1
- data/app/assets/javascripts/govuk_publishing_components/lib/initial-focus.js +13 -0
- data/app/assets/stylesheets/govuk_publishing_components/_all_components.scss +1 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_contextual-sidebar.scss +2 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_transition-countdown.scss +125 -0
- data/app/views/govuk_publishing_components/component_guide/show.html.erb +1 -2
- data/app/views/govuk_publishing_components/components/_attachment.html.erb +5 -4
- data/app/views/govuk_publishing_components/components/_contextual_sidebar.html.erb +16 -1
- data/app/views/govuk_publishing_components/components/_transition_countdown.html.erb +34 -0
- data/app/views/govuk_publishing_components/components/contextual_sidebar/_brexit_cta.html.erb +5 -3
- data/app/views/govuk_publishing_components/components/docs/attachment.yml +10 -0
- data/app/views/govuk_publishing_components/components/docs/contextual_sidebar.yml +0 -1
- data/app/views/govuk_publishing_components/components/docs/govspeak.yml +41 -0
- data/app/views/govuk_publishing_components/components/docs/transition_countdown.yml +17 -0
- data/config/locales/cy.yml +9 -1
- data/config/locales/en.yml +7 -0
- data/lib/govuk_publishing_components.rb +1 -0
- data/lib/govuk_publishing_components/app_helpers/countdown_helper.rb +33 -0
- data/lib/govuk_publishing_components/version.rb +1 -1
- metadata +7 -3
- data/app/assets/javascripts/govuk_publishing_components/components/initial-focus.js +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 63eb3e251bfdd3c16215cc72dbe7a225ba84dff4d1aac2fecfa393a17f737a59
|
4
|
+
data.tar.gz: 6645fbe499447ded996095c91e01a4e34ba1fc83e9b14bb872f1bc713798d2b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 552b029895c0c121224f830891ac14c874557765be7abadb8e9527bb9ad658b7e3bf8ce142bc278391da411b25b3750578b386814c151ece65cd0588570a90d4
|
7
|
+
data.tar.gz: e339ad09ad94a7286ae59a559ba2b172068998f6e98c2c3f0257b4991e99e8e6dfde8781dfdc256478764c2cee5d107705a07f1dee02b05cb9d1c03554840e1a
|
@@ -2,22 +2,24 @@ window.GOVUK = window.GOVUK || {}
|
|
2
2
|
window.GOVUK.Modules = window.GOVUK.Modules || {};
|
3
3
|
|
4
4
|
(function (Modules) {
|
5
|
-
|
5
|
+
function CopyToClipboard () { }
|
6
6
|
|
7
|
-
|
8
|
-
this
|
9
|
-
var input = element[0].querySelector('.gem-c-input')
|
10
|
-
var copyButton = element[0].querySelector('.gem-c-button')
|
7
|
+
CopyToClipboard.prototype.start = function ($module) {
|
8
|
+
this.$module = $module[0]
|
11
9
|
|
12
|
-
|
13
|
-
|
14
|
-
})
|
10
|
+
var input = this.$module.querySelector('.gem-c-input')
|
11
|
+
var copyButton = this.$module.querySelector('.gem-c-button')
|
15
12
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
13
|
+
input.addEventListener('click', function () {
|
14
|
+
input.select()
|
15
|
+
})
|
16
|
+
|
17
|
+
copyButton.addEventListener('click', function (event) {
|
18
|
+
event.preventDefault()
|
19
|
+
input.select()
|
20
|
+
document.execCommand('copy')
|
21
|
+
})
|
22
22
|
}
|
23
|
+
|
24
|
+
Modules.CopyToClipboard = CopyToClipboard
|
23
25
|
})(window.GOVUK.Modules)
|
@@ -4,47 +4,51 @@ window.GOVUK = window.GOVUK || {}
|
|
4
4
|
window.GOVUK.Modules = window.GOVUK.Modules || {};
|
5
5
|
|
6
6
|
(function (Modules) {
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
this
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
})
|
27
|
-
}
|
7
|
+
function GovukDetails () { }
|
8
|
+
|
9
|
+
GovukDetails.prototype.start = function ($module) {
|
10
|
+
this.$module = $module[0]
|
11
|
+
|
12
|
+
var customTrackLabel = this.$module.getAttribute('data-track-label')
|
13
|
+
|
14
|
+
// If a custom label has been provided, we can simply call the tracking module
|
15
|
+
if (customTrackLabel) {
|
16
|
+
var trackDetails = new window.GOVUK.Modules.TrackClick()
|
17
|
+
trackDetails.start($module)
|
18
|
+
} else {
|
19
|
+
// If no custom label is set, we use the open/close status as the label
|
20
|
+
var detailsClick = this.$module.querySelector('[data-details-track-click]')
|
21
|
+
|
22
|
+
if (detailsClick) {
|
23
|
+
detailsClick.addEventListener('click', function (event) {
|
24
|
+
this.trackDefault(this.$module)
|
25
|
+
}.bind(this))
|
28
26
|
}
|
29
27
|
}
|
28
|
+
}
|
30
29
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
30
|
+
GovukDetails.prototype.trackDefault = function (element) {
|
31
|
+
if (window.GOVUK.analytics && window.GOVUK.analytics.trackEvent) {
|
32
|
+
var componentStatus = (element.getAttribute('open') == null) ? 'open' : 'closed'
|
33
|
+
var trackCategory = element.getAttribute('data-track-category')
|
34
|
+
var trackAction = element.getAttribute('data-track-action')
|
35
|
+
var trackOptions = element.getAttribute('data-track-options')
|
37
36
|
|
38
|
-
|
39
|
-
|
40
|
-
|
37
|
+
if (trackOptions) {
|
38
|
+
trackOptions = JSON.parse(trackOptions)
|
39
|
+
}
|
40
|
+
|
41
|
+
if (typeof trackOptions !== 'object' || trackOptions === null) {
|
42
|
+
trackOptions = {}
|
43
|
+
}
|
41
44
|
|
42
|
-
|
45
|
+
trackOptions.label = componentStatus
|
43
46
|
|
44
|
-
|
45
|
-
|
46
|
-
}
|
47
|
+
if (trackAction && trackCategory) {
|
48
|
+
window.GOVUK.analytics.trackEvent(trackCategory, trackAction, trackOptions)
|
47
49
|
}
|
48
50
|
}
|
49
51
|
}
|
52
|
+
|
53
|
+
Modules.GovukDetails = GovukDetails
|
50
54
|
})(window.GOVUK.Modules)
|
@@ -2,13 +2,14 @@ window.GOVUK = window.GOVUK || {}
|
|
2
2
|
window.GOVUK.Modules = window.GOVUK.Modules || {};
|
3
3
|
|
4
4
|
(function (Modules) {
|
5
|
-
|
5
|
+
function PrintLink () { }
|
6
6
|
|
7
|
-
|
8
|
-
this
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
}
|
7
|
+
PrintLink.prototype.start = function ($module) {
|
8
|
+
this.$module = $module[0]
|
9
|
+
this.$module.addEventListener('click', function () {
|
10
|
+
window.print()
|
11
|
+
})
|
13
12
|
}
|
13
|
+
|
14
|
+
Modules.PrintLink = PrintLink
|
14
15
|
})(window.GOVUK.Modules)
|
@@ -413,7 +413,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
413
413
|
}
|
414
414
|
} else {
|
415
415
|
// if it's a stacked graph
|
416
|
-
if (spanWidth > cellWidth && cellVal > 0) {
|
416
|
+
if ((spanWidth > cellWidth && cellVal > 0) || (cellVal < 1)) {
|
417
417
|
$cell.classList.add('mc-value-overflow')
|
418
418
|
}
|
419
419
|
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
window.GOVUK = window.GOVUK || {}
|
2
|
+
window.GOVUK.Modules = window.GOVUK.Modules || {};
|
3
|
+
|
4
|
+
(function (Modules) {
|
5
|
+
function InitialFocus () { }
|
6
|
+
|
7
|
+
InitialFocus.prototype.start = function ($module) {
|
8
|
+
this.$module = $module[0]
|
9
|
+
this.$module.focus()
|
10
|
+
}
|
11
|
+
|
12
|
+
Modules.InitialFocus = InitialFocus
|
13
|
+
})(window.GOVUK.Modules)
|
@@ -0,0 +1,125 @@
|
|
1
|
+
$transition-campaign-red: #ff003b;
|
2
|
+
$transition-campaign-dark-blue: #1e1348;
|
3
|
+
|
4
|
+
.gem-c-transition-countdown {
|
5
|
+
@include govuk-font(19);
|
6
|
+
margin-bottom: govuk-spacing(6);
|
7
|
+
}
|
8
|
+
|
9
|
+
.gem-c-transition-countdown--cta {
|
10
|
+
background-color: govuk-colour('light-grey', $legacy: 'grey-4');
|
11
|
+
border-top: 4px solid $transition-campaign-red;
|
12
|
+
display: block;
|
13
|
+
padding: govuk-spacing(3);
|
14
|
+
text-decoration: none;
|
15
|
+
}
|
16
|
+
|
17
|
+
.gem-c-transition-countdown__title {
|
18
|
+
@extend %govuk-heading-m;
|
19
|
+
color: $transition-campaign-dark-blue;
|
20
|
+
}
|
21
|
+
|
22
|
+
.gem-c-transition-countdown__countdown {
|
23
|
+
margin-top: 0;
|
24
|
+
margin-bottom: govuk-spacing(2);
|
25
|
+
|
26
|
+
@include govuk-media-query($from: tablet) {
|
27
|
+
margin-bottom: govuk-spacing(0);
|
28
|
+
}
|
29
|
+
}
|
30
|
+
|
31
|
+
.gem-c-transition-countdown__countdown-number {
|
32
|
+
@include govuk-font($size: 80, $weight: bold, $line-height: 60px);
|
33
|
+
|
34
|
+
min-width: 50px;
|
35
|
+
text-align: center;
|
36
|
+
display: inline-block;
|
37
|
+
background: $transition-campaign-dark-blue;
|
38
|
+
color: govuk-colour('white');
|
39
|
+
position: relative;
|
40
|
+
margin-bottom: govuk-spacing(2);
|
41
|
+
|
42
|
+
@include govuk-media-query($from: tablet) {
|
43
|
+
padding: govuk-spacing(2) govuk-spacing(1);
|
44
|
+
}
|
45
|
+
|
46
|
+
&:after {
|
47
|
+
position: absolute;
|
48
|
+
left: 0;
|
49
|
+
top: 50%;
|
50
|
+
margin-top: -1px;
|
51
|
+
height: 3px;
|
52
|
+
background: govuk-colour('white');
|
53
|
+
content: '';
|
54
|
+
width: 100%;
|
55
|
+
display: block;
|
56
|
+
}
|
57
|
+
|
58
|
+
&:first-child {
|
59
|
+
margin-right: 3px;
|
60
|
+
}
|
61
|
+
|
62
|
+
&:nth-child(2) {
|
63
|
+
margin-right: govuk-spacing(2);
|
64
|
+
}
|
65
|
+
}
|
66
|
+
|
67
|
+
.gem-c-transition-countdown__countdown-text {
|
68
|
+
@extend %govuk-heading-m;
|
69
|
+
|
70
|
+
display: inline-block;
|
71
|
+
margin-bottom: 0;
|
72
|
+
height: 45px;
|
73
|
+
vertical-align: middle;
|
74
|
+
color: $transition-campaign-dark-blue;
|
75
|
+
|
76
|
+
@include govuk-media-query($from: tablet) {
|
77
|
+
height: 80px;
|
78
|
+
}
|
79
|
+
|
80
|
+
&:after {
|
81
|
+
content: '' / '.'; // Wrap up the countdown-text element in a statement for screen readers
|
82
|
+
}
|
83
|
+
}
|
84
|
+
|
85
|
+
.gem-c-transition-countdown__text {
|
86
|
+
@extend %govuk-link;
|
87
|
+
|
88
|
+
margin-top: 0;
|
89
|
+
margin-bottom: 0;
|
90
|
+
text-decoration: underline;
|
91
|
+
|
92
|
+
@include govuk-media-query($from: tablet) {
|
93
|
+
margin-bottom: govuk-spacing(2);
|
94
|
+
}
|
95
|
+
}
|
96
|
+
|
97
|
+
.gem-c-transition-countdown:focus {
|
98
|
+
.gem-c-transition-countdown__countdown-number:after {
|
99
|
+
background-color: $govuk-focus-colour;
|
100
|
+
}
|
101
|
+
|
102
|
+
.gem-c-transition-countdown__text {
|
103
|
+
text-decoration: none;
|
104
|
+
}
|
105
|
+
}
|
106
|
+
|
107
|
+
@include govuk-compatibility(govuk_template) {
|
108
|
+
.gem-c-transition-countdown__title {
|
109
|
+
margin-bottom: govuk-spacing(3);
|
110
|
+
}
|
111
|
+
|
112
|
+
.gem-c-transition-countdown__countdown-number {
|
113
|
+
padding: govuk-spacing(1) 0 0;
|
114
|
+
|
115
|
+
@include govuk-media-query($from: tablet) {
|
116
|
+
padding: govuk-spacing(3) govuk-spacing(1) govuk-spacing(1);
|
117
|
+
}
|
118
|
+
}
|
119
|
+
|
120
|
+
.gem-c-transition-countdown__countdown-text {
|
121
|
+
@include govuk-media-query($from: tablet) {
|
122
|
+
height: 75px;
|
123
|
+
}
|
124
|
+
}
|
125
|
+
}
|
@@ -22,10 +22,9 @@
|
|
22
22
|
<div class="component-markdown">
|
23
23
|
<%= raw(@component_doc.html_body) %>
|
24
24
|
</div>
|
25
|
-
|
26
|
-
<p class="govuk-body"><%= link_to "Search for usage of this component on GitHub", @component_doc.github_search_url, class: "govuk-link" %></p>
|
27
25
|
</div>
|
28
26
|
<% end %>
|
27
|
+
<p class="govuk-body"><%= link_to "Search for usage of this component on GitHub", @component_doc.github_search_url, class: "govuk-link" %></p>
|
29
28
|
</div>
|
30
29
|
</div>
|
31
30
|
|
@@ -5,6 +5,7 @@
|
|
5
5
|
hide_order_copy_link ||= false
|
6
6
|
attributes = []
|
7
7
|
data_attributes ||= {}
|
8
|
+
shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
|
8
9
|
|
9
10
|
if attachment.content_type_name
|
10
11
|
content = if attachment.content_type_abbr
|
@@ -50,11 +51,11 @@
|
|
50
51
|
<% end %>
|
51
52
|
|
52
53
|
<%= tag.div class: "gem-c-attachment__details" do %>
|
53
|
-
<%=
|
54
|
+
<%= content_tag(shared_helper.get_heading_level, class: "gem-c-attachment__title") do %>
|
54
55
|
<%= link_to attachment.title, attachment.url,
|
55
|
-
|
56
|
-
|
57
|
-
|
56
|
+
class: "govuk-link gem-c-attachment__link",
|
57
|
+
target: target,
|
58
|
+
data: data_attributes %>
|
58
59
|
<% end %>
|
59
60
|
|
60
61
|
<% if attachment.reference.present? %>
|
@@ -1,8 +1,23 @@
|
|
1
1
|
<% navigation = GovukPublishingComponents::Presenters::ContextualNavigation.new(content_item, request) %>
|
2
2
|
|
3
3
|
<div class="gem-c-contextual-sidebar">
|
4
|
-
<% if navigation.show_brexit_cta? && navigation.step_by_step_count.
|
4
|
+
<% if navigation.show_brexit_cta? && navigation.step_by_step_count.zero? %>
|
5
5
|
<%= render 'govuk_publishing_components/components/contextual_sidebar/brexit_cta' %>
|
6
|
+
<% elsif navigation.step_by_step_count.zero? %>
|
7
|
+
<%= render 'govuk_publishing_components/components/transition_countdown', {
|
8
|
+
title: t("components.related_navigation.transition.title"),
|
9
|
+
url: t("components.related_navigation.transition.link_path"),
|
10
|
+
text: t("components.related_navigation.transition.link_text"),
|
11
|
+
data_attributes: {
|
12
|
+
"module": "track-click",
|
13
|
+
"track-category": "relatedLinkClicked",
|
14
|
+
"track-action": "1.0 Transition",
|
15
|
+
"track-label": t("components.related_navigation.transition.link_path"),
|
16
|
+
"track-dimension": t("components.related_navigation.transition.link_text"),
|
17
|
+
"track-dimension-index": "29",
|
18
|
+
},
|
19
|
+
lang: I18n.locale,
|
20
|
+
} %>
|
6
21
|
<% end %>
|
7
22
|
|
8
23
|
<% if navigation.content_tagged_to_a_reasonable_number_of_step_by_steps? %>
|
@@ -0,0 +1,34 @@
|
|
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
|
+
css_classes = %w(gem-c-transition-countdown)
|
12
|
+
css_classes << 'gem-c-transition-countdown--cta' if url
|
13
|
+
css_classes << 'govuk-link' if url
|
14
|
+
%>
|
15
|
+
|
16
|
+
<% countdown = capture do %>
|
17
|
+
<%= content_tag(shared_helper.get_heading_level, title, class: "gem-c-transition-countdown__title") if title %>
|
18
|
+
<% if countdown_clock.show? %>
|
19
|
+
<%= tag.p class: "gem-c-transition-countdown__countdown" do %>
|
20
|
+
<%= 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" %>
|
21
|
+
<% end %>
|
22
|
+
<% end %>
|
23
|
+
<%= tag.p text, class: "gem-c-transition-countdown__text" if text %>
|
24
|
+
<% end %>
|
25
|
+
|
26
|
+
<% if url %>
|
27
|
+
<%= link_to url, class: css_classes, data: data_attributes, lang: lang do %>
|
28
|
+
<%= countdown %>
|
29
|
+
<% end %>
|
30
|
+
<% else %>
|
31
|
+
<%= tag.div class: css_classes, lang: lang do %>
|
32
|
+
<%= countdown %>
|
33
|
+
<% end %>
|
34
|
+
<% end %>
|
data/app/views/govuk_publishing_components/components/contextual_sidebar/_brexit_cta.html.erb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
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-cta 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>
|
4
6
|
</div>
|
@@ -158,3 +158,13 @@ examples:
|
|
158
158
|
unique_reference: "2942"
|
159
159
|
unnumbered_hoc_paper: true
|
160
160
|
hide_order_copy_link: true
|
161
|
+
with_custom_heading_level:
|
162
|
+
description: Default is `h2`.
|
163
|
+
data:
|
164
|
+
heading_level: 3
|
165
|
+
attachment:
|
166
|
+
title: "Department for Transport information asset register"
|
167
|
+
url: https://assets.publishing.service.gov.uk/government/uploads/system/uploads/attachment_data/file/747661/department-for-transport-information-asset-register.csv
|
168
|
+
filename: department-for-transport-information-asset-register.csv
|
169
|
+
content_type: text/csv
|
170
|
+
file_size: 20000
|
@@ -236,6 +236,47 @@ examples:
|
|
236
236
|
</tr>
|
237
237
|
</tbody>
|
238
238
|
</table>
|
239
|
+
stacked_chart:
|
240
|
+
data:
|
241
|
+
block: |
|
242
|
+
<table class="js-barchart-table mc-stacked mc-auto-outdent">
|
243
|
+
<thead>
|
244
|
+
<tr>
|
245
|
+
<th scope="col">Colours</th>
|
246
|
+
<th scope="col">Fruits</th>
|
247
|
+
<th scope="col">Vegetables</th>
|
248
|
+
<th scope="col">Beans</th>
|
249
|
+
<th scope="col">Nuts</th>
|
250
|
+
<th scope="col">Total</th>
|
251
|
+
</tr>
|
252
|
+
</thead>
|
253
|
+
<tbody>
|
254
|
+
<tr>
|
255
|
+
<td>Red</td>
|
256
|
+
<td>23</td>
|
257
|
+
<td>9</td>
|
258
|
+
<td>2</td>
|
259
|
+
<td>1</td>
|
260
|
+
<td>35</td>
|
261
|
+
</tr>
|
262
|
+
<tr>
|
263
|
+
<td>Green</td>
|
264
|
+
<td>5</td>
|
265
|
+
<td>33</td>
|
266
|
+
<td>8</td>
|
267
|
+
<td>0</td>
|
268
|
+
<td>46</td>
|
269
|
+
</tr>
|
270
|
+
<tr>
|
271
|
+
<td>Yellow</td>
|
272
|
+
<td>2</td>
|
273
|
+
<td>10</td>
|
274
|
+
<td>0</td>
|
275
|
+
<td>15</td>
|
276
|
+
<td>27</td>
|
277
|
+
</tr>
|
278
|
+
</tbody>
|
279
|
+
</table>
|
239
280
|
chart_with_multiple_headings:
|
240
281
|
data:
|
241
282
|
block: |
|
@@ -0,0 +1,17 @@
|
|
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"
|
data/config/locales/cy.yml
CHANGED
@@ -6,5 +6,13 @@ cy:
|
|
6
6
|
or: 'neu'
|
7
7
|
back_link:
|
8
8
|
back: "Yn ôl"
|
9
|
-
contents_list:
|
9
|
+
contents_list:
|
10
10
|
contents: Cynnwys
|
11
|
+
related_navigation:
|
12
|
+
transition:
|
13
|
+
title: "Pontio Brexit"
|
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"
|
data/config/locales/en.yml
CHANGED
@@ -71,6 +71,10 @@ en:
|
|
71
71
|
topics: "Explore the topic"
|
72
72
|
topical_events: "Topical event"
|
73
73
|
world_locations: "World locations"
|
74
|
+
transition:
|
75
|
+
title: "Brexit transition"
|
76
|
+
link_path: "/transition"
|
77
|
+
link_text: "Check you’re ready for 2021"
|
74
78
|
related_footer_navigation:
|
75
79
|
collections: "Collections"
|
76
80
|
policies: "Policies"
|
@@ -94,3 +98,6 @@ en:
|
|
94
98
|
summary_list:
|
95
99
|
edit: "Change"
|
96
100
|
delete: "Delete"
|
101
|
+
transition_countdown:
|
102
|
+
day_to_go: "day to go"
|
103
|
+
days_to_go: "days to go"
|
@@ -34,6 +34,7 @@ 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"
|
37
38
|
require "govuk_publishing_components/app_helpers/environment"
|
38
39
|
|
39
40
|
# Add view and i18n paths for usage outside of a Rails app
|
@@ -0,0 +1,33 @@
|
|
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
|
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.7.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-11-
|
11
|
+
date: 2020-11-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: govuk_app_config
|
@@ -425,7 +425,6 @@ files:
|
|
425
425
|
- app/assets/javascripts/govuk_publishing_components/components/feedback.js
|
426
426
|
- app/assets/javascripts/govuk_publishing_components/components/govspeak.js
|
427
427
|
- app/assets/javascripts/govuk_publishing_components/components/header.js
|
428
|
-
- app/assets/javascripts/govuk_publishing_components/components/initial-focus.js
|
429
428
|
- app/assets/javascripts/govuk_publishing_components/components/modal-dialogue.js
|
430
429
|
- app/assets/javascripts/govuk_publishing_components/components/print-link.js
|
431
430
|
- app/assets/javascripts/govuk_publishing_components/components/radio.js
|
@@ -441,6 +440,7 @@ files:
|
|
441
440
|
- app/assets/javascripts/govuk_publishing_components/lib/govspeak/magna-charta.js
|
442
441
|
- app/assets/javascripts/govuk_publishing_components/lib/govspeak/youtube-link-enhancement.js
|
443
442
|
- app/assets/javascripts/govuk_publishing_components/lib/header-navigation.js
|
443
|
+
- app/assets/javascripts/govuk_publishing_components/lib/initial-focus.js
|
444
444
|
- app/assets/javascripts/govuk_publishing_components/lib/primary-links.js
|
445
445
|
- app/assets/javascripts/govuk_publishing_components/lib/select.js
|
446
446
|
- app/assets/javascripts/govuk_publishing_components/lib/toggle-input-class-on-focus.js
|
@@ -522,6 +522,7 @@ files:
|
|
522
522
|
- app/assets/stylesheets/govuk_publishing_components/components/_taxonomy-list.scss
|
523
523
|
- app/assets/stylesheets/govuk_publishing_components/components/_textarea.scss
|
524
524
|
- app/assets/stylesheets/govuk_publishing_components/components/_title.scss
|
525
|
+
- app/assets/stylesheets/govuk_publishing_components/components/_transition-countdown.scss
|
525
526
|
- app/assets/stylesheets/govuk_publishing_components/components/_translation-nav.scss
|
526
527
|
- app/assets/stylesheets/govuk_publishing_components/components/_warning-text.scss
|
527
528
|
- app/assets/stylesheets/govuk_publishing_components/components/govspeak/_advisory.scss
|
@@ -673,6 +674,7 @@ files:
|
|
673
674
|
- app/views/govuk_publishing_components/components/_taxonomy_list.html.erb
|
674
675
|
- app/views/govuk_publishing_components/components/_textarea.html.erb
|
675
676
|
- app/views/govuk_publishing_components/components/_title.html.erb
|
677
|
+
- app/views/govuk_publishing_components/components/_transition_countdown.html.erb
|
676
678
|
- app/views/govuk_publishing_components/components/_translation-nav.html.erb
|
677
679
|
- app/views/govuk_publishing_components/components/_warning_text.html.erb
|
678
680
|
- app/views/govuk_publishing_components/components/attachment/_thumbnail_document.svg
|
@@ -751,6 +753,7 @@ files:
|
|
751
753
|
- app/views/govuk_publishing_components/components/docs/taxonomy_list.yml
|
752
754
|
- app/views/govuk_publishing_components/components/docs/textarea.yml
|
753
755
|
- app/views/govuk_publishing_components/components/docs/title.yml
|
756
|
+
- app/views/govuk_publishing_components/components/docs/transition_countdown.yml
|
754
757
|
- app/views/govuk_publishing_components/components/docs/translation-nav.yml
|
755
758
|
- app/views/govuk_publishing_components/components/docs/warning_text.yml
|
756
759
|
- app/views/govuk_publishing_components/components/feedback/_problem_form.html.erb
|
@@ -775,6 +778,7 @@ files:
|
|
775
778
|
- lib/generators/govuk_publishing_components/templates/component.yml.erb
|
776
779
|
- lib/govuk_publishing_components.rb
|
777
780
|
- lib/govuk_publishing_components/app_helpers/brand_helper.rb
|
781
|
+
- lib/govuk_publishing_components/app_helpers/countdown_helper.rb
|
778
782
|
- lib/govuk_publishing_components/app_helpers/environment.rb
|
779
783
|
- lib/govuk_publishing_components/app_helpers/table_helper.rb
|
780
784
|
- lib/govuk_publishing_components/app_helpers/taxon_breadcrumbs.rb
|
@@ -1,12 +0,0 @@
|
|
1
|
-
window.GOVUK = window.GOVUK || {}
|
2
|
-
window.GOVUK.Modules = window.GOVUK.Modules || {};
|
3
|
-
|
4
|
-
(function (Modules) {
|
5
|
-
'use strict'
|
6
|
-
|
7
|
-
Modules.InitialFocus = function () {
|
8
|
-
this.start = function (element) {
|
9
|
-
element.focus()
|
10
|
-
}
|
11
|
-
}
|
12
|
-
})(window.GOVUK.Modules)
|