govuk_publishing_components 29.15.2 → 30.1.0
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-ga4/gtm-click-tracking.js +1 -1
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/gtm-page-views.js +22 -7
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/gtm-schemas.js +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/_all_components.scss +1 -0
- data/app/assets/stylesheets/govuk_publishing_components/_all_components_print.scss +1 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_emergency-banner.scss +76 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_typography.scss +0 -8
- data/app/assets/stylesheets/govuk_publishing_components/components/print/_emergency-banner.scss +3 -0
- data/app/models/govuk_publishing_components/audit_applications.rb +18 -0
- data/app/models/govuk_publishing_components/audit_comparer.rb +33 -1
- data/app/views/govuk_publishing_components/audit/_components.html.erb +12 -49
- data/app/views/govuk_publishing_components/audit/_items_in_applications.html.erb +50 -0
- data/app/views/govuk_publishing_components/components/_emergency_banner.html.erb +51 -0
- data/app/views/govuk_publishing_components/components/docs/accordion.yml +5 -5
- data/app/views/govuk_publishing_components/components/docs/emergency_banner.yml +45 -0
- data/lib/govuk_publishing_components/presenters/emergency_banner_helper.rb +17 -0
- data/lib/govuk_publishing_components/version.rb +1 -1
- data/lib/govuk_publishing_components.rb +1 -0
- metadata +9 -4
- data/app/assets/javascripts/govuk_publishing_components/lib/primary-links.js +0 -74
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 98ffd65de2a6ab2a76338534b51c8a25a9c45bbf7c15ea2eb59363067929846f
|
4
|
+
data.tar.gz: 7b0e8e36604bd2666bfe8171b1e06334af902135028115afdbc59838d36ebb94
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cbd879810fbb5845aeb9ad610b1afe41dd4324ed9148895bfe5da773599e87f593c606ffd364fb54623cde60f6e340689eab3168aebf229e210e8fc4612c0b49
|
7
|
+
data.tar.gz: 4c179f7d646a332d7ea36c6383bd8d808a001590280ba40c747e248a62ed29ece82580331ab6b0f509c99835ef3fcfd72d31ccb1cccf91fc1d39fa688b328172
|
@@ -33,7 +33,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
33
33
|
// get attributes from the data attribute to send to GA
|
34
34
|
// only allow it if it already exists in the schema
|
35
35
|
for (var property in data) {
|
36
|
-
if (schema.event_data
|
36
|
+
if (property in schema.event_data) {
|
37
37
|
schema.event_data[property] = data[property]
|
38
38
|
}
|
39
39
|
}
|
@@ -5,12 +5,13 @@
|
|
5
5
|
|
6
6
|
GOVUK.Gtm = {
|
7
7
|
PIIRemover: new GOVUK.analyticsGA4.PIIRemover(), // imported in analytics-ga4.js
|
8
|
+
nullValue: null,
|
8
9
|
|
9
10
|
sendPageView: function () {
|
10
11
|
if (window.dataLayer) {
|
11
12
|
var data = {
|
12
13
|
event: 'page_view',
|
13
|
-
|
14
|
+
page_view: {
|
14
15
|
location: this.getLocation(),
|
15
16
|
referrer: this.getReferrer(),
|
16
17
|
title: this.getTitle(),
|
@@ -32,9 +33,9 @@
|
|
32
33
|
language: this.getLanguage(),
|
33
34
|
history: this.getHistory(),
|
34
35
|
withdrawn: this.getWithDrawn(),
|
35
|
-
first_published_at: this.getMetaContent('first-published-at'),
|
36
|
-
updated_at: this.getMetaContent('updated-at'),
|
37
|
-
public_updated_at: this.getMetaContent('public-updated-at'),
|
36
|
+
first_published_at: this.stripTimeFrom(this.getMetaContent('first-published-at')),
|
37
|
+
updated_at: this.stripTimeFrom(this.getMetaContent('updated-at')),
|
38
|
+
public_updated_at: this.stripTimeFrom(this.getMetaContent('public-updated-at')),
|
38
39
|
publishing_government: this.getMetaContent('publishing-government'),
|
39
40
|
political_status: this.getMetaContent('political-status'),
|
40
41
|
primary_publishing_organisation: this.getMetaContent('primary-publishing-organisation'),
|
@@ -73,13 +74,17 @@
|
|
73
74
|
if (tag) {
|
74
75
|
return tag.getAttribute('content')
|
75
76
|
} else {
|
76
|
-
return
|
77
|
+
return this.nullValue
|
77
78
|
}
|
78
79
|
},
|
79
80
|
|
80
81
|
getLanguage: function () {
|
81
|
-
var
|
82
|
-
|
82
|
+
var content = document.getElementById('content')
|
83
|
+
if (content) {
|
84
|
+
return content.getAttribute('lang') || this.nullValue
|
85
|
+
} else {
|
86
|
+
return this.nullValue
|
87
|
+
}
|
83
88
|
},
|
84
89
|
|
85
90
|
getHistory: function () {
|
@@ -90,6 +95,16 @@
|
|
90
95
|
getWithDrawn: function () {
|
91
96
|
var withdrawn = this.getMetaContent('withdrawn')
|
92
97
|
return (withdrawn === 'withdrawn') ? 'true' : 'false'
|
98
|
+
},
|
99
|
+
|
100
|
+
// return only the date from given timestamps of the form
|
101
|
+
// 2022-03-28T19:11:00.000+00:00
|
102
|
+
stripTimeFrom: function (value) {
|
103
|
+
if (value !== null) {
|
104
|
+
return value.split('T')[0]
|
105
|
+
} else {
|
106
|
+
return this.nullValue
|
107
|
+
}
|
93
108
|
}
|
94
109
|
}
|
95
110
|
|
@@ -31,6 +31,7 @@ $govuk-new-link-styles: true;
|
|
31
31
|
@import "components/details";
|
32
32
|
@import "components/devolved-nations";
|
33
33
|
@import "components/document-list";
|
34
|
+
@import "components/emergency-banner";
|
34
35
|
@import "components/error-alert";
|
35
36
|
@import "components/error-message";
|
36
37
|
@import "components/error-summary";
|
@@ -7,6 +7,7 @@
|
|
7
7
|
@import "components/print/button";
|
8
8
|
@import "components/print/cards";
|
9
9
|
@import "components/print/contents-list";
|
10
|
+
@import "components/print/emergency-banner";
|
10
11
|
@import "components/print/govspeak-html-publication";
|
11
12
|
@import "components/print/govspeak";
|
12
13
|
@import "components/print/layout-super-navigation-header";
|
@@ -0,0 +1,76 @@
|
|
1
|
+
.gem-c-emergency-banner {
|
2
|
+
@include govuk-font(19);
|
3
|
+
background-color: govuk-colour("mid-grey");
|
4
|
+
color: govuk-colour("white");
|
5
|
+
margin-top: 2px;
|
6
|
+
padding: govuk-spacing(3) 0;
|
7
|
+
|
8
|
+
@include govuk-media-query($from: tablet) {
|
9
|
+
padding: govuk-spacing(6) 0;
|
10
|
+
}
|
11
|
+
}
|
12
|
+
|
13
|
+
.gem-c-emergency-banner--homepage {
|
14
|
+
border-bottom: govuk-spacing(1) solid govuk-colour("white");
|
15
|
+
border-top: govuk-spacing(1) solid govuk-colour("white");
|
16
|
+
margin-bottom: govuk-spacing(-2);
|
17
|
+
margin-top: 0;
|
18
|
+
position: relative;
|
19
|
+
z-index: 10;
|
20
|
+
}
|
21
|
+
|
22
|
+
.gem-c-emergency-banner__heading {
|
23
|
+
@include govuk-font(24, $weight: bold);
|
24
|
+
margin: 0;
|
25
|
+
}
|
26
|
+
|
27
|
+
.gem-c-emergency-banner__heading--homepage {
|
28
|
+
@include govuk-font(48, $weight: bold);
|
29
|
+
|
30
|
+
@include govuk-media-query($from: tablet) {
|
31
|
+
margin-bottom: govuk-spacing(4);
|
32
|
+
}
|
33
|
+
}
|
34
|
+
|
35
|
+
.gem-c-emergency-banner__description {
|
36
|
+
@include govuk-font(19);
|
37
|
+
color: govuk-colour("white");
|
38
|
+
margin-top: 0;
|
39
|
+
margin-bottom: govuk-spacing(4);
|
40
|
+
|
41
|
+
&:last-child {
|
42
|
+
margin-bottom: 0;
|
43
|
+
}
|
44
|
+
}
|
45
|
+
|
46
|
+
.gem-c-emergency-banner__description--homepage {
|
47
|
+
margin: govuk-spacing(4) 0;
|
48
|
+
}
|
49
|
+
|
50
|
+
.gem-c-emergency-banner__link {
|
51
|
+
@include govuk-font(19);
|
52
|
+
}
|
53
|
+
|
54
|
+
.gem-c-emergency-banner__link:link,
|
55
|
+
.gem-c-emergency-banner__link:visited {
|
56
|
+
color: govuk-colour("white");
|
57
|
+
}
|
58
|
+
|
59
|
+
.gem-c-emergency-banner__link:focus {
|
60
|
+
@include govuk-focused-text;
|
61
|
+
}
|
62
|
+
|
63
|
+
.gem-c-emergency-banner--notable-death {
|
64
|
+
background-color: govuk-colour("black");
|
65
|
+
}
|
66
|
+
|
67
|
+
.gem-c-emergency-banner--national-emergency {
|
68
|
+
// Not using govuk-colour("red") aka #d4351c as that's a slightly different red.
|
69
|
+
background-color: #b10e1e;
|
70
|
+
}
|
71
|
+
|
72
|
+
.gem-c-emergency-banner--local-emergency {
|
73
|
+
// Not using govuk-colour("turquoise") for background colour as
|
74
|
+
// the contrast was too low with white text
|
75
|
+
background-color: #00847d;
|
76
|
+
}
|
data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_typography.scss
CHANGED
@@ -108,11 +108,3 @@
|
|
108
108
|
@include govuk-link-style-inverse;
|
109
109
|
}
|
110
110
|
}
|
111
|
-
|
112
|
-
// This helper class is for use by the primary links js module
|
113
|
-
// We have this custom helper here with a single rule over using the design system helper class govuk-!-display-none
|
114
|
-
// because jasmine tests don't like the "!" in the distributed helper class
|
115
|
-
|
116
|
-
.primary-links--display-none {
|
117
|
-
display: none;
|
118
|
-
}
|
@@ -9,6 +9,7 @@ module GovukPublishingComponents
|
|
9
9
|
@component_locations = {}
|
10
10
|
@gem_style_references = []
|
11
11
|
@jquery_references = []
|
12
|
+
@helper_references = {}
|
12
13
|
|
13
14
|
if application_found
|
14
15
|
templates = Dir["#{path}/app/views/**/*.erb"]
|
@@ -69,6 +70,7 @@ module GovukPublishingComponents
|
|
69
70
|
gem_style_references: @gem_style_references.flatten.uniq.sort,
|
70
71
|
jquery_references: @jquery_references.flatten.uniq.sort,
|
71
72
|
component_locations: @component_locations,
|
73
|
+
helper_references: @helper_references,
|
72
74
|
}
|
73
75
|
end
|
74
76
|
|
@@ -95,6 +97,8 @@ module GovukPublishingComponents
|
|
95
97
|
components_found << find_match(find, src, type)
|
96
98
|
end
|
97
99
|
|
100
|
+
get_helper_references(file, src) if %w[ruby templates].include?(type)
|
101
|
+
|
98
102
|
if type == "javascripts"
|
99
103
|
jquery_references = find_code_references(file, src, /\$\(/)
|
100
104
|
@jquery_references << jquery_references if jquery_references
|
@@ -109,6 +113,20 @@ module GovukPublishingComponents
|
|
109
113
|
components_found.flatten.uniq.sort
|
110
114
|
end
|
111
115
|
|
116
|
+
def get_helper_references(file, src)
|
117
|
+
helper_use = find_match(/GovukPublishingComponents::(?:AppHelpers|Presenters)::[a-zA-Z]+/, src, "helper")
|
118
|
+
if helper_use.any?
|
119
|
+
helper_use.each do |helper|
|
120
|
+
class_name = helper.gsub(/GovukPublishingComponents::(AppHelpers)?(Presenters)?::+/, "")
|
121
|
+
helper_sym = class_name.to_sym
|
122
|
+
@helper_references[helper_sym] = [] unless @helper_references[helper_sym]
|
123
|
+
@helper_references[helper_sym] << clean_file_path(file)
|
124
|
+
@helper_references[helper_sym].uniq!
|
125
|
+
@helper_references[helper_sym].sort!
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
112
130
|
# looks for components in the given src of a file
|
113
131
|
# returns an array of component names or an empty array
|
114
132
|
def find_match(find, src, type)
|
@@ -22,6 +22,7 @@ module GovukPublishingComponents
|
|
22
22
|
@gem_data = gem_data
|
23
23
|
@applications_data = sort_results(results)
|
24
24
|
@gem_data[:components_by_application] = get_components_by_application || []
|
25
|
+
@gem_data[:helpers_used_by_applications] = get_helpers_used_by_applications || []
|
25
26
|
end
|
26
27
|
end
|
27
28
|
|
@@ -107,6 +108,7 @@ module GovukPublishingComponents
|
|
107
108
|
gem_style_references: result[:gem_style_references],
|
108
109
|
jquery_references: result[:jquery_references],
|
109
110
|
component_locations: result[:component_locations],
|
111
|
+
helper_references: result[:helper_references],
|
110
112
|
}
|
111
113
|
else
|
112
114
|
data << {
|
@@ -269,7 +271,7 @@ module GovukPublishingComponents
|
|
269
271
|
locations = locations.flatten
|
270
272
|
|
271
273
|
results << {
|
272
|
-
|
274
|
+
name: component_name,
|
273
275
|
count: locations.length,
|
274
276
|
locations: locations,
|
275
277
|
}
|
@@ -277,5 +279,35 @@ module GovukPublishingComponents
|
|
277
279
|
|
278
280
|
results if found_something
|
279
281
|
end
|
282
|
+
|
283
|
+
# returns data of components gem helpers used in applications
|
284
|
+
def get_helpers_used_by_applications
|
285
|
+
results = []
|
286
|
+
|
287
|
+
@applications_data.each do |application|
|
288
|
+
next unless application[:application_found] && !application[:helper_references].blank?
|
289
|
+
|
290
|
+
application[:helper_references].each do |key, value|
|
291
|
+
location = {
|
292
|
+
name: application[:name],
|
293
|
+
locations: value,
|
294
|
+
}
|
295
|
+
|
296
|
+
match = results.find { |x| x[:name] == key }
|
297
|
+
if match
|
298
|
+
match[:locations] << location
|
299
|
+
match[:count] = match[:count] + 1
|
300
|
+
else
|
301
|
+
results << {
|
302
|
+
name: key,
|
303
|
+
count: 1,
|
304
|
+
locations: [location],
|
305
|
+
}
|
306
|
+
end
|
307
|
+
end
|
308
|
+
end
|
309
|
+
|
310
|
+
results
|
311
|
+
end
|
280
312
|
end
|
281
313
|
end
|
@@ -56,56 +56,19 @@
|
|
56
56
|
}
|
57
57
|
%>
|
58
58
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
<dt class="govuk-summary-list__key">
|
66
|
-
<%= component[:component] %> (<%= pluralize(component[:count], 'use') %>)
|
67
|
-
</dt>
|
68
|
-
<dd class="govuk-summary-list__value">
|
69
|
-
<% component[:locations].each do |application| %>
|
70
|
-
<% github_link = 'https://github.com/alphagov/' + application[:name] + '/blob/main/' %>
|
71
|
-
<details class="govuk-details govuk-!-margin-bottom-2" data-module="govuk-details">
|
72
|
-
<summary class="govuk-details__summary">
|
73
|
-
<span class="govuk-details__summary-text">
|
74
|
-
<%= application[:name] %> (<%= application[:locations].length %>)
|
75
|
-
</span>
|
76
|
-
</summary>
|
77
|
-
<div class="govuk-details__text">
|
78
|
-
<ul class="govuk-list govuk-list--bullet">
|
79
|
-
<% application[:locations].each do |location| %>
|
80
|
-
<li>
|
81
|
-
<a href="<%= github_link %><%= location %>" class="govuk-link"><%= location %></a>
|
82
|
-
</li>
|
83
|
-
<% end %>
|
84
|
-
</ul>
|
85
|
-
</div>
|
86
|
-
</details>
|
87
|
-
<% end %>
|
88
|
-
</dd>
|
89
|
-
</div>
|
90
|
-
<% end %>
|
91
|
-
</dl>
|
92
|
-
<% end %>
|
93
|
-
<% end %>
|
59
|
+
<%= render 'items_in_applications',
|
60
|
+
heading: 'Components by application',
|
61
|
+
summary: 'Shows which applications use each component',
|
62
|
+
content: @components[:components_by_application],
|
63
|
+
items: component_items
|
64
|
+
%>
|
94
65
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
text: "Shows which applications use each component",
|
102
|
-
},
|
103
|
-
content: {
|
104
|
-
html: components_by_application
|
105
|
-
},
|
106
|
-
}
|
107
|
-
%>
|
108
|
-
<% end %>
|
66
|
+
<%= render 'items_in_applications',
|
67
|
+
heading: 'Helpers by application',
|
68
|
+
summary: 'Shows any applications that use helper classes from the components gem',
|
69
|
+
content: @components[:helpers_used_by_applications],
|
70
|
+
items: component_items
|
71
|
+
%>
|
109
72
|
|
110
73
|
<%= render "govuk_publishing_components/components/accordion", {
|
111
74
|
items: component_items
|
@@ -0,0 +1,50 @@
|
|
1
|
+
<% if @other_applications %>
|
2
|
+
<% accordion_content = capture do %>
|
3
|
+
<% if content.any? %>
|
4
|
+
<dl class="govuk-summary-list">
|
5
|
+
<% content.each do |item| %>
|
6
|
+
<div class="govuk-summary-list__row">
|
7
|
+
<dt class="govuk-summary-list__key">
|
8
|
+
<%= item[:name] %> (<%= pluralize(item[:count], 'use') %>)
|
9
|
+
</dt>
|
10
|
+
<dd class="govuk-summary-list__value">
|
11
|
+
<% item[:locations].each do |application| %>
|
12
|
+
<% github_link = 'https://github.com/alphagov/' + application[:name] + '/blob/main/' %>
|
13
|
+
<details class="govuk-details govuk-!-margin-bottom-2" data-module="govuk-details">
|
14
|
+
<summary class="govuk-details__summary">
|
15
|
+
<span class="govuk-details__summary-text">
|
16
|
+
<%= application[:name] %> (<%= application[:locations].length %>)
|
17
|
+
</span>
|
18
|
+
</summary>
|
19
|
+
<div class="govuk-details__text">
|
20
|
+
<ul class="govuk-list govuk-list--bullet">
|
21
|
+
<% application[:locations].each do |location| %>
|
22
|
+
<li>
|
23
|
+
<a href="<%= github_link %><%= location %>" class="govuk-link"><%= location %></a>
|
24
|
+
</li>
|
25
|
+
<% end %>
|
26
|
+
</ul>
|
27
|
+
</div>
|
28
|
+
</details>
|
29
|
+
<% end %>
|
30
|
+
</dd>
|
31
|
+
</div>
|
32
|
+
<% end %>
|
33
|
+
</dl>
|
34
|
+
<% end %>
|
35
|
+
<% end %>
|
36
|
+
|
37
|
+
<%
|
38
|
+
items << {
|
39
|
+
heading: {
|
40
|
+
text: heading,
|
41
|
+
},
|
42
|
+
summary: {
|
43
|
+
text: summary,
|
44
|
+
},
|
45
|
+
content: {
|
46
|
+
html: accordion_content
|
47
|
+
},
|
48
|
+
}
|
49
|
+
%>
|
50
|
+
<% end %>
|
@@ -0,0 +1,51 @@
|
|
1
|
+
<%
|
2
|
+
heading ||= ""
|
3
|
+
short_description ||= nil
|
4
|
+
link ||= nil
|
5
|
+
link_text ||= "More information"
|
6
|
+
campaign_class ||= nil
|
7
|
+
homepage ||= false
|
8
|
+
|
9
|
+
emergency_banner_helper = GovukPublishingComponents::Presenters::EmergencyBannerHelper.new()
|
10
|
+
|
11
|
+
if !campaign_class
|
12
|
+
raise ArgumentError, "Need to specify an emergency_type"
|
13
|
+
end
|
14
|
+
|
15
|
+
if !emergency_banner_helper.is_a_valid_emergency_type?(campaign_class)
|
16
|
+
raise ArgumentError, "Emergency type #{campaign_class} is not in list of valid emergency types (#{emergency_banner_helper.emergency_types.join(', ')})"
|
17
|
+
end
|
18
|
+
|
19
|
+
banner_classes = %w[gem-c-emergency-banner]
|
20
|
+
banner_classes << "gem-c-emergency-banner--#{campaign_class}"
|
21
|
+
banner_classes << "gem-c-emergency-banner--homepage" if homepage
|
22
|
+
|
23
|
+
heading_classes = %w[gem-c-emergency-banner__heading]
|
24
|
+
heading_classes << "gem-c-emergency-banner__heading--homepage" if homepage
|
25
|
+
|
26
|
+
description_classes = %w[gem-c-emergency-banner__description]
|
27
|
+
description_classes << "gem-c-emergency-banner__description--homepage" if homepage
|
28
|
+
|
29
|
+
%>
|
30
|
+
|
31
|
+
<%= content_tag('div', class: banner_classes, "aria-label": "emergency banner", "role": "region", "data-nosnippet": true ) do %>
|
32
|
+
<div class="govuk-width-container">
|
33
|
+
<div class="govuk-grid-row">
|
34
|
+
<div class="govuk-grid-column-two-thirds">
|
35
|
+
<%= content_tag('h2', class: heading_classes) do %>
|
36
|
+
<%= heading %>
|
37
|
+
<% end %>
|
38
|
+
<% if short_description %>
|
39
|
+
<%= content_tag('p', class: description_classes) do %>
|
40
|
+
<%= short_description %>
|
41
|
+
<% end %>
|
42
|
+
<% end %>
|
43
|
+
<% if link %>
|
44
|
+
<a href="<%= link %>" class="gem-c-emergency-banner__link">
|
45
|
+
<%= link_text %>
|
46
|
+
</a>
|
47
|
+
<% end %>
|
48
|
+
</div>
|
49
|
+
</div>
|
50
|
+
</div>
|
51
|
+
<% end %>
|
@@ -185,15 +185,15 @@ examples:
|
|
185
185
|
description: |
|
186
186
|
Adds custom data attributes to each section of the accordion. Accepts a hash, so multiple attributes can be added.
|
187
187
|
|
188
|
-
The `data_attributes`
|
188
|
+
The `data_attributes` option applies attributes to the outermost element in the accordion. Each item can also have a `data_attributes` hash, which are placed on the `button` that triggers the opening and closing - useful for differentiating between each section of the accordion.
|
189
189
|
|
190
|
-
|
190
|
+
Data attributes can be added to the 'Show/hide all' link using the `data_attributes_show_all` option, primarily where custom tracking is required. These attributes are read from the accordion markup and then added to the link by JavaScript (which is how the link is created). More details on how this can be used with the GA4 click tracking can be found in the 'Advanced' section of the [click tracking documentation](https://github.com/alphagov/govuk_publishing_components/blob/main/docs/analytics-gtm/gtm-click-tracking.md).
|
191
191
|
|
192
|
-
|
192
|
+
If `track_options` within `data_attributes_show_all` is set, then it is possible to pass a custom dimension when 'Show/Hide all' is clicked.
|
193
193
|
data:
|
194
194
|
data_attributes:
|
195
|
-
|
196
|
-
|
195
|
+
gtm: gtm-accordion
|
196
|
+
ga: ga-accordion
|
197
197
|
data_attributes_show_all:
|
198
198
|
gtm-event-name: example
|
199
199
|
gtm-attributes: "{ 'ui': { 'type': 'type value', 'section': 'section value' } }"
|
@@ -0,0 +1,45 @@
|
|
1
|
+
name: Emergency banner
|
2
|
+
description: A site-wide banner used in the event of an emergency
|
3
|
+
body: |
|
4
|
+
There are three types of events that would lead GOV.UK to add an emergency banner to the top of each page on the web site; a notable death, a national emergency or a local emergency.
|
5
|
+
|
6
|
+
See the [opsmanual](https://docs.publishing.service.gov.uk/manual/emergency-publishing.html#adding-emergency-publishing-banners) for information about what the Emergency Banner is and when it should be deployed.
|
7
|
+
|
8
|
+
shared_accessibility_criteria:
|
9
|
+
- link
|
10
|
+
|
11
|
+
examples:
|
12
|
+
default:
|
13
|
+
description: |
|
14
|
+
Death of a notable person
|
15
|
+
data:
|
16
|
+
campaign_class: "notable-death"
|
17
|
+
heading: "His Royal Highness Henry VIII"
|
18
|
+
short_description: "1491 to 1547"
|
19
|
+
link_text: "Override Link Text"
|
20
|
+
link: "https://www.gov.uk/"
|
21
|
+
national_emergency:
|
22
|
+
description: |
|
23
|
+
National emergency (level 1 or category 2)
|
24
|
+
data:
|
25
|
+
campaign_class: "national-emergency"
|
26
|
+
heading: "National emergency"
|
27
|
+
short_description: "This is a level 1 incident"
|
28
|
+
link: "https://www.gov.uk/"
|
29
|
+
local_emergency:
|
30
|
+
description: |
|
31
|
+
Localised large-scale emergency (level 2 or category 1)
|
32
|
+
data:
|
33
|
+
campaign_class: "local-emergency"
|
34
|
+
heading: "Local emergency"
|
35
|
+
short_description: "This is a level 2 incident"
|
36
|
+
link: "https://www.gov.uk/"
|
37
|
+
notable_death_homepage:
|
38
|
+
description: |
|
39
|
+
When presenting any type of emergency banner on homepage the styling is slightly different.
|
40
|
+
data:
|
41
|
+
campaign_class: "notable-death"
|
42
|
+
heading: "His Royal Highness Henry VIII"
|
43
|
+
short_description: "1491 to 1547"
|
44
|
+
link: "https://www.gov.uk/"
|
45
|
+
homepage: true
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module GovukPublishingComponents
|
2
|
+
module Presenters
|
3
|
+
class EmergencyBannerHelper
|
4
|
+
EMERGENCY_TYPES = %w[notable-death national-emergency local-emergency].freeze
|
5
|
+
|
6
|
+
def initialize; end
|
7
|
+
|
8
|
+
def emergency_types
|
9
|
+
EMERGENCY_TYPES
|
10
|
+
end
|
11
|
+
|
12
|
+
def is_a_valid_emergency_type?(type)
|
13
|
+
EMERGENCY_TYPES.include?(type)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -12,6 +12,7 @@ require "govuk_publishing_components/presenters/breadcrumb_selector"
|
|
12
12
|
require "govuk_publishing_components/presenters/button_helper"
|
13
13
|
require "govuk_publishing_components/presenters/contextual_navigation"
|
14
14
|
require "govuk_publishing_components/presenters/devolved_nations_helper"
|
15
|
+
require "govuk_publishing_components/presenters/emergency_banner_helper"
|
15
16
|
require "govuk_publishing_components/presenters/related_navigation_helper"
|
16
17
|
require "govuk_publishing_components/presenters/step_by_step_nav_helper"
|
17
18
|
require "govuk_publishing_components/presenters/page_with_step_by_step_navigation"
|
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:
|
4
|
+
version: 30.1.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: 2022-
|
11
|
+
date: 2022-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: govuk_app_config
|
@@ -495,7 +495,6 @@ files:
|
|
495
495
|
- app/assets/javascripts/govuk_publishing_components/lib/govspeak/magna-charta.js
|
496
496
|
- app/assets/javascripts/govuk_publishing_components/lib/govspeak/youtube-link-enhancement.js
|
497
497
|
- app/assets/javascripts/govuk_publishing_components/lib/initial-focus.js
|
498
|
-
- app/assets/javascripts/govuk_publishing_components/lib/primary-links.js
|
499
498
|
- app/assets/javascripts/govuk_publishing_components/lib/toggle-input-class-on-focus.js
|
500
499
|
- app/assets/javascripts/govuk_publishing_components/lib/toggle.js
|
501
500
|
- app/assets/javascripts/govuk_publishing_components/lib/trigger-event.js
|
@@ -535,6 +534,7 @@ files:
|
|
535
534
|
- app/assets/stylesheets/govuk_publishing_components/components/_details.scss
|
536
535
|
- app/assets/stylesheets/govuk_publishing_components/components/_devolved-nations.scss
|
537
536
|
- app/assets/stylesheets/govuk_publishing_components/components/_document-list.scss
|
537
|
+
- app/assets/stylesheets/govuk_publishing_components/components/_emergency-banner.scss
|
538
538
|
- app/assets/stylesheets/govuk_publishing_components/components/_error-alert.scss
|
539
539
|
- app/assets/stylesheets/govuk_publishing_components/components/_error-message.scss
|
540
540
|
- app/assets/stylesheets/govuk_publishing_components/components/_error-summary.scss
|
@@ -623,6 +623,7 @@ files:
|
|
623
623
|
- app/assets/stylesheets/govuk_publishing_components/components/print/_button.scss
|
624
624
|
- app/assets/stylesheets/govuk_publishing_components/components/print/_cards.scss
|
625
625
|
- app/assets/stylesheets/govuk_publishing_components/components/print/_contents-list.scss
|
626
|
+
- app/assets/stylesheets/govuk_publishing_components/components/print/_emergency-banner.scss
|
626
627
|
- app/assets/stylesheets/govuk_publishing_components/components/print/_govspeak-html-publication.scss
|
627
628
|
- app/assets/stylesheets/govuk_publishing_components/components/print/_govspeak.scss
|
628
629
|
- app/assets/stylesheets/govuk_publishing_components/components/print/_layout-super-navigation-header.scss
|
@@ -646,6 +647,7 @@ files:
|
|
646
647
|
- app/views/govuk_publishing_components/audit/_applications.html.erb
|
647
648
|
- app/views/govuk_publishing_components/audit/_component_contents.html.erb
|
648
649
|
- app/views/govuk_publishing_components/audit/_components.html.erb
|
650
|
+
- app/views/govuk_publishing_components/audit/_items_in_applications.html.erb
|
649
651
|
- app/views/govuk_publishing_components/audit/show.html.erb
|
650
652
|
- app/views/govuk_publishing_components/component_guide/_application_stylesheet.html.erb
|
651
653
|
- app/views/govuk_publishing_components/component_guide/component_doc/_call.html.erb
|
@@ -678,6 +680,7 @@ files:
|
|
678
680
|
- app/views/govuk_publishing_components/components/_details.html.erb
|
679
681
|
- app/views/govuk_publishing_components/components/_devolved_nations.html.erb
|
680
682
|
- app/views/govuk_publishing_components/components/_document_list.html.erb
|
683
|
+
- app/views/govuk_publishing_components/components/_emergency_banner.html.erb
|
681
684
|
- app/views/govuk_publishing_components/components/_error_alert.html.erb
|
682
685
|
- app/views/govuk_publishing_components/components/_error_message.html.erb
|
683
686
|
- app/views/govuk_publishing_components/components/_error_summary.html.erb
|
@@ -760,6 +763,7 @@ files:
|
|
760
763
|
- app/views/govuk_publishing_components/components/docs/details.yml
|
761
764
|
- app/views/govuk_publishing_components/components/docs/devolved_nations.yml
|
762
765
|
- app/views/govuk_publishing_components/components/docs/document_list.yml
|
766
|
+
- app/views/govuk_publishing_components/components/docs/emergency_banner.yml
|
763
767
|
- app/views/govuk_publishing_components/components/docs/error_alert.yml
|
764
768
|
- app/views/govuk_publishing_components/components/docs/error_message.yml
|
765
769
|
- app/views/govuk_publishing_components/components/docs/error_summary.yml
|
@@ -922,6 +926,7 @@ files:
|
|
922
926
|
- lib/govuk_publishing_components/presenters/contextual_navigation.rb
|
923
927
|
- lib/govuk_publishing_components/presenters/curated_taxonomy_sidebar_links.rb
|
924
928
|
- lib/govuk_publishing_components/presenters/devolved_nations_helper.rb
|
929
|
+
- lib/govuk_publishing_components/presenters/emergency_banner_helper.rb
|
925
930
|
- lib/govuk_publishing_components/presenters/heading_helper.rb
|
926
931
|
- lib/govuk_publishing_components/presenters/image_card_helper.rb
|
927
932
|
- lib/govuk_publishing_components/presenters/intervention_helper.rb
|
@@ -1931,7 +1936,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
1931
1936
|
- !ruby/object:Gem::Version
|
1932
1937
|
version: '0'
|
1933
1938
|
requirements: []
|
1934
|
-
rubygems_version: 3.3.
|
1939
|
+
rubygems_version: 3.3.19
|
1935
1940
|
signing_key:
|
1936
1941
|
specification_version: 4
|
1937
1942
|
summary: A gem to document components in GOV.UK frontend applications
|
@@ -1,74 +0,0 @@
|
|
1
|
-
// migrated from govuk_frontend_toolkit
|
2
|
-
;(function (global) {
|
3
|
-
'use strict'
|
4
|
-
|
5
|
-
var GOVUK = global.GOVUK || {}
|
6
|
-
|
7
|
-
// Only show the first {n} items in a list, documentation is in the README.md
|
8
|
-
var PrimaryList = function (el, selector) {
|
9
|
-
this.el = el
|
10
|
-
this.extraLinks = this.el.querySelectorAll('li:not(' + selector + ')')
|
11
|
-
// only hide more than one extra link
|
12
|
-
if (this.extraLinks.length > 1) {
|
13
|
-
this.addToggleLink()
|
14
|
-
this.hideExtraLinks()
|
15
|
-
}
|
16
|
-
}
|
17
|
-
|
18
|
-
PrimaryList.prototype = {
|
19
|
-
toggleText: function () {
|
20
|
-
if (this.extraLinks.length > 1) {
|
21
|
-
return '+' + this.extraLinks.length + ' others'
|
22
|
-
} else {
|
23
|
-
return '+' + this.extraLinks.length + ' other'
|
24
|
-
}
|
25
|
-
},
|
26
|
-
addToggleLink: function () {
|
27
|
-
this.toggleLink = document.createElement('a')
|
28
|
-
this.toggleLink.href = '#'
|
29
|
-
this.toggleLink.setAttribute('aria-expanded', 'false')
|
30
|
-
this.toggleLink.innerText = this.toggleText()
|
31
|
-
|
32
|
-
this.el.parentNode.insertBefore(this.toggleLink, this.el.nextSibling)
|
33
|
-
this.toggleLink.addEventListener('click', this.toggleLinks.bind(this))
|
34
|
-
},
|
35
|
-
toggleLinks: function (e) {
|
36
|
-
e.preventDefault()
|
37
|
-
this.toggleLink.remove()
|
38
|
-
this.showExtraLinks()
|
39
|
-
},
|
40
|
-
hideExtraLinks: function () {
|
41
|
-
for (var i = 0; i < this.extraLinks.length; i++) {
|
42
|
-
this.extraLinks[i].className = 'primary-links--display-none'
|
43
|
-
}
|
44
|
-
},
|
45
|
-
showExtraLinks: function () {
|
46
|
-
for (var i = 0; i < this.extraLinks.length; i++) {
|
47
|
-
this.extraLinks[i].className = ''
|
48
|
-
}
|
49
|
-
}
|
50
|
-
}
|
51
|
-
|
52
|
-
GOVUK.PrimaryList = PrimaryList
|
53
|
-
|
54
|
-
GOVUK.primaryLinks = {
|
55
|
-
init: function (selector) {
|
56
|
-
var allListItems = document.querySelectorAll(selector)
|
57
|
-
var AllLists = []
|
58
|
-
|
59
|
-
for (var i = 0; i < allListItems.length; i++) {
|
60
|
-
var parent = allListItems[i].parentNode
|
61
|
-
|
62
|
-
if (AllLists.indexOf(parent) < 0) {
|
63
|
-
AllLists.push(parent)
|
64
|
-
}
|
65
|
-
}
|
66
|
-
|
67
|
-
AllLists.forEach(function (el, i) {
|
68
|
-
new GOVUK.PrimaryList(el, selector) // eslint-disable-line no-new
|
69
|
-
})
|
70
|
-
}
|
71
|
-
}
|
72
|
-
|
73
|
-
global.GOVUK = GOVUK
|
74
|
-
})(window)
|