govuk_publishing_components 23.4.0 → 23.5.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/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/initial-focus.js +13 -0
- data/lib/govuk_publishing_components/version.rb +1 -1
- metadata +3 -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: ccb3ff988da8eed7ce14013d8f0a0f054661b7ee9322a2caa75ab49a5b064162
|
4
|
+
data.tar.gz: b115615020b7694cab625d98ee0abe11e98306d8776c7afb3ffd400d642fe32c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cfb2771a84017aca9fc781ea5d650a1402cbf1a88770993e222e42cfe0aa946e14569c14add10ae41dd5ee7619ce028dcfaf501049b7738e56d71afe65f7d2d0
|
7
|
+
data.tar.gz: 571a20b867d372fefc21d4dcf451fd59c56530146fb7c7e258a878320c905ff408f60ce793675a2fba6fbbdedc94fea17adc310eff84529d34b0529193a7f58c
|
@@ -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)
|
@@ -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)
|
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.5.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: 2020-11-
|
11
|
+
date: 2020-11-10 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
|
@@ -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)
|