govuk_publishing_components 27.8.0 → 27.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/javascripts/govuk_publishing_components/analytics/google-analytics-universal-tracker.js +9 -0
- data/app/assets/javascripts/govuk_publishing_components/analytics/init.js +12 -8
- data/app/assets/javascripts/govuk_publishing_components/components/intervention.js +1 -0
- data/app/assets/javascripts/govuk_publishing_components/components/layout-super-navigation-header.js +20 -40
- data/app/assets/stylesheets/govuk_publishing_components/components/_intervention.scss +13 -10
- data/app/assets/stylesheets/govuk_publishing_components/components/_layout-for-public.scss +0 -12
- data/app/assets/stylesheets/govuk_publishing_components/components/_layout-super-navigation-header.scss +434 -366
- data/app/assets/stylesheets/govuk_publishing_components/components/_search.scss +17 -10
- data/app/assets/stylesheets/govuk_publishing_components/components/print/_layout-super-navigation-header.scss +2 -2
- data/app/assets/stylesheets/govuk_publishing_components/components/print/_organisation-logo.scss +3 -0
- data/app/views/govuk_publishing_components/components/_intervention.html.erb +39 -26
- data/app/views/govuk_publishing_components/components/_layout_for_public.html.erb +1 -4
- data/app/views/govuk_publishing_components/components/_layout_super_navigation_header.html.erb +80 -74
- data/app/views/govuk_publishing_components/components/_search.html.erb +1 -0
- data/app/views/govuk_publishing_components/components/docs/intervention.yml +45 -6
- data/app/views/govuk_publishing_components/components/docs/layout_for_public.yml +0 -8
- data/app/views/govuk_publishing_components/components/docs/layout_super_navigation_header.yml +12 -3
- data/app/views/govuk_publishing_components/components/docs/title.yml +0 -11
- data/app/views/govuk_publishing_components/components/layout_for_public/_account-layout.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/layout_for_public/_account-navigation.html.erb +0 -9
- data/app/views/govuk_publishing_components/components/search/_search_icon.html.erb +28 -0
- data/config/locales/en.yml +3 -14
- data/lib/govuk_publishing_components/presenters/intervention_helper.rb +19 -0
- data/lib/govuk_publishing_components/version.rb +1 -1
- data/lib/govuk_publishing_components.rb +1 -0
- metadata +5 -3
- data/app/views/govuk_publishing_components/components/layout_for_public/_account-feedback-footer.html.erb +0 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1972033395616c1023a78e4452ac636b90a5bc7f9c7739c2a1d258e76691b900
|
4
|
+
data.tar.gz: 0c9ce6602fc0811249802d4c4db210ac2df342d35ce2b6bc2a796315d5b0213f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ea760c12bc9de04e792adfa8f37c6ffbb2a14ec58bde29a4419afcc7bdc72e7ef47b8c2f7408fddf8a2b0f494aad26947d4d5d2b896c485f72bbea2f37cebdf
|
7
|
+
data.tar.gz: c27b47624a8c10554bf33af5099f5aebc14144410692823e84c7f59a4abb009d82ec9ac1b54c707e30dcd71423e465ced00e405df1abf0ffc325db1f1d9743b0
|
@@ -36,11 +36,20 @@
|
|
36
36
|
fieldsObject = { cookieDomain: fieldsObject }
|
37
37
|
}
|
38
38
|
|
39
|
+
function setLinkedDomains () {
|
40
|
+
var domains = window.GOVUK.analyticsVars.primaryLinkedDomains
|
41
|
+
if (domains && domains.length > 0) {
|
42
|
+
sendToGa('require', 'linker')
|
43
|
+
sendToGa('linker:autoLink', domains)
|
44
|
+
}
|
45
|
+
}
|
46
|
+
|
39
47
|
configureProfile()
|
40
48
|
anonymizeIp()
|
41
49
|
disableAdFeatures()
|
42
50
|
stripTitlePII()
|
43
51
|
stripLocationPII()
|
52
|
+
setLinkedDomains()
|
44
53
|
}
|
45
54
|
|
46
55
|
GoogleAnalyticsUniversalTracker.load = function () {
|
@@ -3,9 +3,12 @@ var analyticsInit = function () {
|
|
3
3
|
|
4
4
|
var analyticsVars = window.GOVUK.analyticsVars || false
|
5
5
|
if (analyticsVars) {
|
6
|
-
|
7
|
-
|
8
|
-
var
|
6
|
+
// the property naming convention here isn't consistent, but used in static and
|
7
|
+
// govuk-account-manager-prototype, so hard to change
|
8
|
+
var primaryGaProperty = window.GOVUK.analyticsVars.gaProperty || false
|
9
|
+
|
10
|
+
var crossDomainGaProperty = window.GOVUK.analyticsVars.gaPropertyCrossDomain || false
|
11
|
+
var crossDomainLinkedDomains = window.GOVUK.analyticsVars.linkedDomains || false
|
9
12
|
}
|
10
13
|
|
11
14
|
window.GOVUK.Analytics.checkDigitalIdentityConsent = function (location) {
|
@@ -39,7 +42,7 @@ var analyticsInit = function () {
|
|
39
42
|
|
40
43
|
// Disable analytics by default
|
41
44
|
// This will be reversed below, if the consent cookie says usage cookies are allowed
|
42
|
-
var disabler = 'ga-disable-' +
|
45
|
+
var disabler = 'ga-disable-' + primaryGaProperty
|
43
46
|
window[disabler] = true
|
44
47
|
|
45
48
|
if (consentCookie && consentCookie.usage) {
|
@@ -48,14 +51,14 @@ var analyticsInit = function () {
|
|
48
51
|
// Load Google Analytics libraries
|
49
52
|
window.GOVUK.StaticAnalytics.load()
|
50
53
|
|
51
|
-
if (
|
54
|
+
if (primaryGaProperty) {
|
52
55
|
// Use document.domain in dev, preview and staging so that tracking works
|
53
56
|
// Otherwise explicitly set the domain as www.gov.uk (and not gov.uk).
|
54
57
|
var cookieDomain = (document.domain === 'www.gov.uk') ? '.www.gov.uk' : document.domain
|
55
58
|
|
56
59
|
// Configure profiles, setup custom vars, track initial pageview
|
57
60
|
var analytics = new window.GOVUK.StaticAnalytics({
|
58
|
-
universalId:
|
61
|
+
universalId: primaryGaProperty,
|
59
62
|
cookieDomain: cookieDomain,
|
60
63
|
allowLinker: true
|
61
64
|
})
|
@@ -63,8 +66,9 @@ var analyticsInit = function () {
|
|
63
66
|
// Make interface public for virtual pageviews and events
|
64
67
|
window.GOVUK.analytics = analytics
|
65
68
|
|
66
|
-
|
67
|
-
|
69
|
+
// set up linking of domains for cross domain ga property
|
70
|
+
if (crossDomainLinkedDomains && crossDomainLinkedDomains.length > 0) {
|
71
|
+
window.GOVUK.analytics.addLinkedTrackerDomain(crossDomainGaProperty, 'govuk', crossDomainLinkedDomains)
|
68
72
|
}
|
69
73
|
}
|
70
74
|
} else {
|
@@ -8,6 +8,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
8
8
|
|
9
9
|
Intervention.prototype.init = function () {
|
10
10
|
if (window.GOVUK.analytics && window.GOVUK.analytics.trackEvent) {
|
11
|
+
// Send a tracking event when this component is shown
|
11
12
|
window.GOVUK.analytics.trackEvent('interventionBanner', 'interventionShown')
|
12
13
|
}
|
13
14
|
}
|
data/app/assets/javascripts/govuk_publishing_components/components/layout-super-navigation-header.js
CHANGED
@@ -124,25 +124,11 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
124
124
|
|
125
125
|
this.hiddenButtons = this.$module.querySelectorAll('button[hidden]')
|
126
126
|
|
127
|
-
this.lastWindowSize =
|
127
|
+
this.lastWindowSize = null
|
128
128
|
}
|
129
129
|
|
130
130
|
SuperNavigationMegaMenu.prototype.windowSize = windowSize
|
131
131
|
|
132
|
-
// Resizes the space needed for the dropdown menu so that it doesn't overlap
|
133
|
-
// with the page content. As this is an event that needs to be added and
|
134
|
-
// removed it can't be be bound to `this` because that changes the fingerprint
|
135
|
-
// of the function, and makes it unable to be removed with
|
136
|
-
// `removeEventListener`.
|
137
|
-
SuperNavigationMegaMenu.prototype.resizeHandler = function () {
|
138
|
-
var $module = document.querySelector('[data-module="super-navigation-mega-menu"]')
|
139
|
-
var $openButton = $module.querySelector('[aria-expanded="true"][data-toggle-desktop-group="top"]')
|
140
|
-
var $openMenu = $openButton ? $module.querySelector('#' + $openButton.getAttribute('aria-controls')) : null
|
141
|
-
var margin = $openMenu && windowSize() === 'desktop' ? $openMenu.offsetHeight : 0
|
142
|
-
|
143
|
-
$module.style.marginBottom = margin + 'px'
|
144
|
-
}
|
145
|
-
|
146
132
|
SuperNavigationMegaMenu.prototype.updateStates = function () {
|
147
133
|
if (this.windowSize() === 'mobile' && this.lastWindowSize !== 'mobile') {
|
148
134
|
this.$navigationToggle.removeAttribute('hidden')
|
@@ -161,8 +147,21 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
161
147
|
if (this.windowSize() === 'desktop' && this.lastWindowSize !== 'desktop') {
|
162
148
|
this.$navigationToggle.setAttribute('hidden', 'hidden')
|
163
149
|
this.$navigationMenu.removeAttribute('hidden')
|
150
|
+
}
|
164
151
|
|
165
|
-
|
152
|
+
// The dropdown menu height is only needed when in desktop mode as this is
|
153
|
+
// when the dropdown menu is using `absolute` positioning. This requires
|
154
|
+
// JavaScript to work out the height and make space for the dropdown menu.
|
155
|
+
if (windowSize() === 'desktop') {
|
156
|
+
// Check whether any of the dropdown menus are open.
|
157
|
+
var $openButton = this.$module.querySelector('[aria-expanded="true"][data-toggle-desktop-group="top"]')
|
158
|
+
// Gets the open dropdown menu
|
159
|
+
var $openMenu = $openButton ? this.$module.querySelector('#' + $openButton.getAttribute('aria-controls')) : null
|
160
|
+
// If there is an open dropdown menu, get the height of the dropdown menu.
|
161
|
+
var margin = $openMenu ? $openMenu.offsetHeight : 0
|
162
|
+
|
163
|
+
// Make space for the dropdown menu.
|
164
|
+
this.$module.style.marginBottom = margin + 'px'
|
166
165
|
}
|
167
166
|
|
168
167
|
this.lastWindowSize = this.windowSize()
|
@@ -231,30 +230,11 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
231
230
|
|
232
231
|
this.lastWindowSize = this.windowSize()
|
233
232
|
|
234
|
-
// The menu needs to be updated when the window is resized
|
235
|
-
// the
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
// only does things when moving from mobile to desktop view.
|
240
|
-
var setupResizeListener = function () {
|
241
|
-
window.addEventListener('resize', this.updateStates.bind(this), { passive: true })
|
242
|
-
}.bind(this)
|
243
|
-
|
244
|
-
if (typeof window.matchMedia === 'function') {
|
245
|
-
// Internet Explorer 11 supports `matchMedia`, but doesn't support
|
246
|
-
// the `change` event[1] - so we try it, and then fail back to using
|
247
|
-
// `window.resize`.
|
248
|
-
// [1]: https://developer.mozilla.org/en-US/docs/Web/API/MediaQueryList/onchange
|
249
|
-
try {
|
250
|
-
window.matchMedia('screen and (min-width:' + SETTINGS.breakpoint.desktop + 'px)')
|
251
|
-
.addEventListener('change', this.updateStates.bind(this))
|
252
|
-
} catch (error) {
|
253
|
-
setupResizeListener()
|
254
|
-
}
|
255
|
-
} else {
|
256
|
-
setupResizeListener()
|
257
|
-
}
|
233
|
+
// The menu needs to be updated when the window is resized to make sure that
|
234
|
+
// the space needed for the dropdown menu is correct.
|
235
|
+
window.addEventListener('resize', this.updateStates.bind(this), { passive: true })
|
236
|
+
|
237
|
+
this.$module.classList.add('js-module-initialised')
|
258
238
|
}
|
259
239
|
|
260
240
|
Modules.SuperNavigationMegaMenu = SuperNavigationMegaMenu
|
@@ -1,18 +1,21 @@
|
|
1
1
|
.gem-c-intervention {
|
2
2
|
@include govuk-text-colour;
|
3
|
-
@include govuk-responsive-padding(
|
4
|
-
@include govuk-responsive-padding(6, "right");
|
5
|
-
@include govuk-responsive-padding(4, "top");
|
6
|
-
@include govuk-responsive-padding(4, "bottom");
|
3
|
+
@include govuk-responsive-padding(3);
|
7
4
|
@include govuk-responsive-margin(6, "bottom");
|
8
5
|
background-color: govuk-colour("light-grey", $legacy: "grey-4");
|
9
|
-
|
10
|
-
.gem-c-intervention__title {
|
11
|
-
@include govuk-responsive-margin(0);
|
12
|
-
@include govuk-responsive-padding(4, "bottom");
|
13
|
-
}
|
6
|
+
border-left: 10px solid $govuk-success-colour;
|
14
7
|
|
15
8
|
.govuk-body:last-of-type {
|
16
|
-
|
9
|
+
margin-bottom: 0;
|
17
10
|
}
|
18
11
|
}
|
12
|
+
|
13
|
+
.gem-c-intervention__textwrapper {
|
14
|
+
display: block;
|
15
|
+
}
|
16
|
+
|
17
|
+
.gem-c-intervention__dismiss-icon {
|
18
|
+
width: 1em;
|
19
|
+
height: 1em;
|
20
|
+
margin-bottom: -2px;
|
21
|
+
}
|
@@ -52,15 +52,3 @@ $current-indicator-width: 4px;
|
|
52
52
|
color: $govuk-link-colour;
|
53
53
|
}
|
54
54
|
}
|
55
|
-
|
56
|
-
.gem-c-layout-for-public-account-feedback-footer {
|
57
|
-
margin-bottom: govuk-spacing(4);
|
58
|
-
padding: govuk-spacing(3);
|
59
|
-
background: govuk-colour("light-grey");
|
60
|
-
|
61
|
-
@include govuk-media-query($from: tablet) {
|
62
|
-
padding: govuk-spacing(6);
|
63
|
-
margin-top: govuk-spacing(2);
|
64
|
-
margin-bottom: govuk-spacing(8);
|
65
|
-
}
|
66
|
-
}
|