govuk_publishing_components 29.15.1 → 30.0.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 +24 -13
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/gtm-page-views.js +10 -13
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/gtm-schemas.js +32 -0
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4.js +1 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_charts.scss +13 -2
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_typography.scss +0 -8
- 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/docs/govspeak.yml +6 -7
- data/app/views/govuk_publishing_components/components/docs/image_card.yml +1 -1
- data/lib/govuk_publishing_components/version.rb +1 -1
- metadata +5 -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: a9d5601a07939b79ec5f1d7f4251d9b7ad00628225282405c6e17bb95b3f7552
|
4
|
+
data.tar.gz: 866b2f17bc9cc6bab9e7a29bec0fbc9f5f72e96f99742556bed1d5ff8811e3b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a4cac8f96d558bf72da3a0f016d40341ea211a9e3895401b7980a260c125f4ccd898b720968e7c207c227128400440237ad0f1d4f6739834aac1923200b4e4a0
|
7
|
+
data.tar.gz: e97320af9673d84fd8324c66d88dc6d64b0fb9708a41fe9e42573a33cfca2deea1b6e34400e546c762485141b38c6a088a15be4e5425283206bdfef37141178a
|
@@ -7,7 +7,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
7
7
|
|
8
8
|
function GtmClickTracking (module) {
|
9
9
|
this.module = module
|
10
|
-
this.trackingTrigger = 'data-
|
10
|
+
this.trackingTrigger = 'data-ga4' // elements with this attribute get tracked
|
11
11
|
}
|
12
12
|
|
13
13
|
GtmClickTracking.prototype.init = function () {
|
@@ -18,12 +18,24 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
18
18
|
if (window.dataLayer) {
|
19
19
|
var target = this.findTrackingAttributes(event.target)
|
20
20
|
if (target) {
|
21
|
-
var
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
21
|
+
var schema = new window.GOVUK.analyticsGA4.Schemas().eventSchema()
|
22
|
+
|
23
|
+
try {
|
24
|
+
var data = target.getAttribute(this.trackingTrigger)
|
25
|
+
data = JSON.parse(data)
|
26
|
+
} catch (e) {
|
27
|
+
// if there's a problem with the config, don't start the tracker
|
28
|
+
console.error('GA4 configuration error: ' + e.message, window.location)
|
29
|
+
return
|
30
|
+
}
|
31
|
+
|
32
|
+
schema.event = 'event_data'
|
33
|
+
// get attributes from the data attribute to send to GA
|
34
|
+
// only allow it if it already exists in the schema
|
35
|
+
for (var property in data) {
|
36
|
+
if (schema.event_data[property]) {
|
37
|
+
schema.event_data[property] = data[property]
|
38
|
+
}
|
27
39
|
}
|
28
40
|
|
29
41
|
// Ensure it only tracks aria-expanded in an accordion element, instead of in any child of the clicked element
|
@@ -39,15 +51,14 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
39
51
|
var detailsElement = target.closest('details')
|
40
52
|
|
41
53
|
if (ariaExpanded) {
|
42
|
-
|
43
|
-
|
54
|
+
schema.event_data.text = data.text || target.innerText
|
55
|
+
schema.event_data.action = (ariaExpanded === 'false') ? 'opened' : 'closed'
|
44
56
|
} else if (detailsElement) {
|
45
|
-
|
57
|
+
schema.event_data.text = data.text || detailsElement.textContent
|
46
58
|
var openAttribute = detailsElement.getAttribute('open')
|
47
|
-
|
59
|
+
schema.event_data.action = (openAttribute == null) ? 'opened' : 'closed'
|
48
60
|
}
|
49
|
-
|
50
|
-
window.dataLayer.push(data)
|
61
|
+
window.dataLayer.push(schema)
|
51
62
|
}
|
52
63
|
}
|
53
64
|
}
|
@@ -9,29 +9,26 @@
|
|
9
9
|
sendPageView: function () {
|
10
10
|
if (window.dataLayer) {
|
11
11
|
var data = {
|
12
|
-
event: '
|
13
|
-
|
12
|
+
event: 'page_view',
|
13
|
+
page_view: {
|
14
14
|
location: this.getLocation(),
|
15
15
|
referrer: this.getReferrer(),
|
16
16
|
title: this.getTitle(),
|
17
|
-
status_code: this.getStatusCode()
|
18
|
-
|
19
|
-
publishing: {
|
17
|
+
status_code: this.getStatusCode(),
|
18
|
+
|
20
19
|
document_type: this.getMetaContent('format'),
|
21
20
|
publishing_app: this.getMetaContent('publishing-app'),
|
22
21
|
rendering_app: this.getMetaContent('rendering-app'),
|
23
22
|
schema_name: this.getMetaContent('schema-name'),
|
24
|
-
content_id: this.getMetaContent('content-id')
|
25
|
-
|
26
|
-
taxonomy: {
|
23
|
+
content_id: this.getMetaContent('content-id'),
|
24
|
+
|
27
25
|
section: this.getMetaContent('section'),
|
28
26
|
taxon_slug: this.getMetaContent('taxon-slug'),
|
29
27
|
taxon_id: this.getMetaContent('taxon-id'),
|
30
28
|
themes: this.getMetaContent('themes'),
|
31
29
|
taxon_slugs: this.getMetaContent('taxon-slugs'),
|
32
|
-
taxon_ids: this.getMetaContent('taxon-ids')
|
33
|
-
|
34
|
-
content: {
|
30
|
+
taxon_ids: this.getMetaContent('taxon-ids'),
|
31
|
+
|
35
32
|
language: this.getLanguage(),
|
36
33
|
history: this.getHistory(),
|
37
34
|
withdrawn: this.getWithDrawn(),
|
@@ -65,9 +62,9 @@
|
|
65
62
|
// https://github.com/alphagov/static/blob/main/app/views/root/_error_page.html.erb#L32
|
66
63
|
getStatusCode: function () {
|
67
64
|
if (window.httpStatusCode) {
|
68
|
-
return window.httpStatusCode
|
65
|
+
return window.httpStatusCode.toString()
|
69
66
|
} else {
|
70
|
-
return 200
|
67
|
+
return '200'
|
71
68
|
}
|
72
69
|
},
|
73
70
|
|
@@ -0,0 +1,32 @@
|
|
1
|
+
;(function (global) {
|
2
|
+
'use strict'
|
3
|
+
|
4
|
+
var GOVUK = global.GOVUK || {}
|
5
|
+
|
6
|
+
var Schemas = function () {
|
7
|
+
this.null = 'n/a'
|
8
|
+
}
|
9
|
+
|
10
|
+
Schemas.prototype.eventSchema = function () {
|
11
|
+
return {
|
12
|
+
event: this.null,
|
13
|
+
|
14
|
+
event_data: {
|
15
|
+
event_name: this.null,
|
16
|
+
type: this.null,
|
17
|
+
url: this.null,
|
18
|
+
text: this.null,
|
19
|
+
index: this.null,
|
20
|
+
index_total: this.null,
|
21
|
+
section: this.null,
|
22
|
+
action: this.null,
|
23
|
+
external: this.null
|
24
|
+
}
|
25
|
+
}
|
26
|
+
}
|
27
|
+
|
28
|
+
GOVUK.analyticsGA4 = GOVUK.analyticsGA4 || {}
|
29
|
+
GOVUK.analyticsGA4.Schemas = Schemas
|
30
|
+
|
31
|
+
global.GOVUK = GOVUK
|
32
|
+
})(window)
|
@@ -25,12 +25,23 @@
|
|
25
25
|
$caption-side: top; // Caption alignment. Top or bottom.
|
26
26
|
$key-width: 160px; // Only used by IE. Other browsers get smallest width that fits content
|
27
27
|
|
28
|
+
// The following accessible colour palette has been developed to meet the colour contrast requirements for adjacent colours (as set out in WCAG 2.1)
|
29
|
+
// For charts, the palette should be used instead of the GOV.UK colour palette - https://design-system.service.gov.uk/styles/colour/
|
30
|
+
// https://gss.civilservice.gov.uk/policy-store/data-visualisation-colours-in-charts/#section-5
|
31
|
+
|
32
|
+
$gss-colour-dark-blue: #12436d;
|
33
|
+
$gss-colour-turquoise: #28a197;
|
34
|
+
$gss-colour-dark-pink: #801650;
|
35
|
+
$gss-colour-orange: #f46a25;
|
36
|
+
$gss-colour-dark-grey: #3d3d3d;
|
37
|
+
$gss-colour-plum: #a285d1;
|
38
|
+
|
28
39
|
// CHART COLOUR SCHEME
|
29
40
|
|
30
41
|
$chart-border: govuk-colour("white"); // Chart border colour
|
31
42
|
$key-border: govuk-colour("white"); // Key border colour
|
32
|
-
$bar-colours:
|
33
|
-
$bar-text-colours: govuk-colour("white"), govuk-colour("
|
43
|
+
$bar-colours: $gss-colour-dark-blue, $gss-colour-turquoise, $gss-colour-dark-pink, $gss-colour-orange, $gss-colour-dark-grey, $gss-colour-plum;
|
44
|
+
$bar-text-colours: govuk-colour("white"), govuk-colour("white"), govuk-colour("white"), govuk-colour("black"), govuk-colour("white"), govuk-colour("black");
|
34
45
|
$bar-cell-colour: govuk-colour("black");
|
35
46
|
$bar-outdented-colour: govuk-colour("black");
|
36
47
|
|
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 %>
|
@@ -181,6 +181,11 @@ examples:
|
|
181
181
|
</tbody>
|
182
182
|
</table>
|
183
183
|
charts:
|
184
|
+
description: |
|
185
|
+
The Government Statistical Service (GSS) guidance recommends [a limit of four categories as best practice for basic data visualisations](https://gss.civilservice.gov.uk/policy-store/data-visualisation-colours-in-charts/#section-5).
|
186
|
+
|
187
|
+
Note that charts which have up to 7 categories, [chart with colours](http://govuk-publishing-components.dev.gov.uk/component-guide/govspeak/chart_with_colours/preview), for example, will display subsequent bars in `#3d3d3d`, `#a285d1` and the 7th bar in the default colour of `#0b0c0c` and will still meet the colour contrast requirements for adjacent colours.
|
188
|
+
Charts that have 8 or more categories will display additional bars in the default colour and will not meet colour contrast requirements for adjacent colours.
|
184
189
|
data:
|
185
190
|
block: |
|
186
191
|
<table class='js-barchart-table mc-auto-outdent'>
|
@@ -214,8 +219,6 @@ examples:
|
|
214
219
|
<th scope="col">Grapes</th>
|
215
220
|
<th scope="col">Strawberries</th>
|
216
221
|
<th scope="col">Plums</th>
|
217
|
-
<th scope="col">Apricots</th>
|
218
|
-
<th scope="col">Pineapples</th>
|
219
222
|
</tr>
|
220
223
|
</thead>
|
221
224
|
<tbody>
|
@@ -228,8 +231,6 @@ examples:
|
|
228
231
|
<td>24</td>
|
229
232
|
<td>10</td>
|
230
233
|
<td>62</td>
|
231
|
-
<td>29</td>
|
232
|
-
<td>81</td>
|
233
234
|
</tr>
|
234
235
|
<tr>
|
235
236
|
<td>Numbers outside bar</td>
|
@@ -238,10 +239,8 @@ examples:
|
|
238
239
|
<td>2</td>
|
239
240
|
<td>1</td>
|
240
241
|
<td>1</td>
|
241
|
-
<td>3</td>
|
242
|
-
<td>3</td>
|
243
|
-
<td>1</td>
|
244
242
|
<td>2</td>
|
243
|
+
<td>1</td>
|
245
244
|
</tr>
|
246
245
|
</tbody>
|
247
246
|
</table>
|
@@ -188,7 +188,7 @@ examples:
|
|
188
188
|
data:
|
189
189
|
large: true
|
190
190
|
href: "/still-not-a-page"
|
191
|
-
image_src: "https://assets.publishing.service.gov.uk/government/uploads/system/uploads/feature/image/
|
191
|
+
image_src: "https://assets.publishing.service.gov.uk/government/uploads/system/uploads/feature/image/91397/s712_SG_Swear_in_1_.jpg"
|
192
192
|
image_alt: "some meaningful alt text please"
|
193
193
|
context:
|
194
194
|
date: 2017-06-14 11:30:00
|
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.0.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-07-
|
11
|
+
date: 2022-07-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: govuk_app_config
|
@@ -438,6 +438,7 @@ files:
|
|
438
438
|
- app/assets/javascripts/govuk_publishing_components/analytics-ga4.js
|
439
439
|
- app/assets/javascripts/govuk_publishing_components/analytics-ga4/gtm-click-tracking.js
|
440
440
|
- app/assets/javascripts/govuk_publishing_components/analytics-ga4/gtm-page-views.js
|
441
|
+
- app/assets/javascripts/govuk_publishing_components/analytics-ga4/gtm-schemas.js
|
441
442
|
- app/assets/javascripts/govuk_publishing_components/analytics-ga4/pii-remover.js
|
442
443
|
- app/assets/javascripts/govuk_publishing_components/analytics.js
|
443
444
|
- app/assets/javascripts/govuk_publishing_components/analytics/analytics.js
|
@@ -494,7 +495,6 @@ files:
|
|
494
495
|
- app/assets/javascripts/govuk_publishing_components/lib/govspeak/magna-charta.js
|
495
496
|
- app/assets/javascripts/govuk_publishing_components/lib/govspeak/youtube-link-enhancement.js
|
496
497
|
- app/assets/javascripts/govuk_publishing_components/lib/initial-focus.js
|
497
|
-
- app/assets/javascripts/govuk_publishing_components/lib/primary-links.js
|
498
498
|
- app/assets/javascripts/govuk_publishing_components/lib/toggle-input-class-on-focus.js
|
499
499
|
- app/assets/javascripts/govuk_publishing_components/lib/toggle.js
|
500
500
|
- app/assets/javascripts/govuk_publishing_components/lib/trigger-event.js
|
@@ -645,6 +645,7 @@ files:
|
|
645
645
|
- app/views/govuk_publishing_components/audit/_applications.html.erb
|
646
646
|
- app/views/govuk_publishing_components/audit/_component_contents.html.erb
|
647
647
|
- app/views/govuk_publishing_components/audit/_components.html.erb
|
648
|
+
- app/views/govuk_publishing_components/audit/_items_in_applications.html.erb
|
648
649
|
- app/views/govuk_publishing_components/audit/show.html.erb
|
649
650
|
- app/views/govuk_publishing_components/component_guide/_application_stylesheet.html.erb
|
650
651
|
- app/views/govuk_publishing_components/component_guide/component_doc/_call.html.erb
|
@@ -1930,7 +1931,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
1930
1931
|
- !ruby/object:Gem::Version
|
1931
1932
|
version: '0'
|
1932
1933
|
requirements: []
|
1933
|
-
rubygems_version: 3.3.
|
1934
|
+
rubygems_version: 3.3.19
|
1934
1935
|
signing_key:
|
1935
1936
|
specification_version: 4
|
1936
1937
|
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)
|