govuk_publishing_components 63.1.2 → 63.3.0
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/images/govuk_publishing_components/app-promo-banner/govuk-app-icon.png +0 -0
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-page-views.js +3 -2
- data/app/assets/javascripts/govuk_publishing_components/components/app-promo-banner.js +134 -0
- data/app/assets/javascripts/govuk_publishing_components/lib/cookie-functions.js +1 -0
- data/app/assets/stylesheets/govuk_publishing_components/_all_components.scss +1 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_app-promo-banner.scss +64 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_feedback.scss +0 -13
- data/app/assets/stylesheets/govuk_publishing_components/components/_input.scss +0 -14
- data/app/assets/stylesheets/govuk_publishing_components/components/_summary-list.scss +2 -12
- data/app/controllers/govuk_publishing_components/applications_page_controller.rb +1 -2
- data/app/controllers/govuk_publishing_components/audit_controller.rb +0 -2
- data/app/models/govuk_publishing_components/applications_page.rb +0 -4
- data/app/models/govuk_publishing_components/audit_comparer.rb +3 -54
- data/app/views/govuk_publishing_components/applications_page/_table-content.html.erb +0 -7
- data/app/views/govuk_publishing_components/applications_page/show.html.erb +0 -1
- data/app/views/govuk_publishing_components/audit/_applications.html.erb +2 -6
- data/app/views/govuk_publishing_components/components/_app_promo_banner.html.erb +72 -0
- data/app/views/govuk_publishing_components/components/_layout_for_public.html.erb +4 -10
- data/app/views/govuk_publishing_components/components/_summary_card.html.erb +4 -2
- data/app/views/govuk_publishing_components/components/_summary_list.html.erb +2 -2
- data/app/views/govuk_publishing_components/components/docs/accordion.yml +1 -1
- data/app/views/govuk_publishing_components/components/docs/app_promo_banner.yml +30 -0
- data/app/views/govuk_publishing_components/components/docs/layout_for_public.yml +0 -16
- data/app/views/govuk_publishing_components/components/docs/organisation_logo.yml +4 -6
- data/app/views/govuk_publishing_components/components/docs/summary_card.yml +7 -0
- data/app/views/govuk_publishing_components/components/docs/tabs.yml +1 -1
- data/app/views/govuk_publishing_components/components/layout_for_public/_account-layout.html.erb +1 -7
- data/config/locales/ar.yml +10 -4
- data/config/locales/az.yml +10 -4
- data/config/locales/be.yml +10 -4
- data/config/locales/bg.yml +10 -4
- data/config/locales/bn.yml +10 -4
- data/config/locales/cs.yml +10 -4
- data/config/locales/cy.yml +10 -4
- data/config/locales/da.yml +10 -4
- data/config/locales/de.yml +10 -4
- data/config/locales/dr.yml +10 -4
- data/config/locales/el.yml +10 -4
- data/config/locales/en.yml +6 -0
- data/config/locales/es-419.yml +10 -4
- data/config/locales/es.yml +10 -4
- data/config/locales/et.yml +10 -4
- data/config/locales/fa.yml +10 -4
- data/config/locales/fi.yml +10 -4
- data/config/locales/fr.yml +10 -4
- data/config/locales/gd.yml +10 -4
- data/config/locales/gu.yml +10 -4
- data/config/locales/he.yml +10 -4
- data/config/locales/hi.yml +10 -4
- data/config/locales/hr.yml +10 -4
- data/config/locales/hu.yml +10 -4
- data/config/locales/hy.yml +10 -4
- data/config/locales/id.yml +10 -4
- data/config/locales/is.yml +10 -4
- data/config/locales/it.yml +10 -4
- data/config/locales/ja.yml +10 -4
- data/config/locales/ka.yml +10 -4
- data/config/locales/kk.yml +10 -4
- data/config/locales/ko.yml +10 -4
- data/config/locales/ku.yml +10 -4
- data/config/locales/ky.yml +10 -4
- data/config/locales/lt.yml +10 -4
- data/config/locales/lv.yml +10 -4
- data/config/locales/ms.yml +10 -4
- data/config/locales/mt.yml +10 -4
- data/config/locales/ne.yml +10 -4
- data/config/locales/nl.yml +10 -4
- data/config/locales/no.yml +10 -4
- data/config/locales/pa-pk.yml +10 -4
- data/config/locales/pa.yml +10 -4
- data/config/locales/pl.yml +10 -4
- data/config/locales/ps.yml +10 -4
- data/config/locales/pt.yml +10 -4
- data/config/locales/ro.yml +10 -4
- data/config/locales/ru.yml +10 -4
- data/config/locales/si.yml +10 -4
- data/config/locales/sk.yml +10 -4
- data/config/locales/sl.yml +10 -4
- data/config/locales/so.yml +10 -4
- data/config/locales/sq.yml +10 -4
- data/config/locales/sr.yml +10 -4
- data/config/locales/sv.yml +10 -4
- data/config/locales/sw.yml +10 -4
- data/config/locales/ta.yml +10 -4
- data/config/locales/th.yml +10 -4
- data/config/locales/ti.yml +10 -4
- data/config/locales/tk.yml +10 -4
- data/config/locales/tr.yml +10 -4
- data/config/locales/uk.yml +10 -4
- data/config/locales/ur.yml +10 -4
- data/config/locales/uz.yml +10 -4
- data/config/locales/vi.yml +10 -4
- data/config/locales/zh-hk.yml +10 -4
- data/config/locales/zh-tw.yml +10 -4
- data/config/locales/zh.yml +10 -4
- data/lib/govuk_publishing_components/app_helpers/asset_helper.rb +0 -27
- data/lib/govuk_publishing_components/presenters/organisation_logo_helper.rb +17 -13
- data/lib/govuk_publishing_components/version.rb +1 -1
- data/node_modules/axe-core/axe.d.ts +4 -2
- data/node_modules/axe-core/axe.js +80 -39
- data/node_modules/axe-core/axe.min.js +3 -3
- data/node_modules/axe-core/locales/_template.json +4 -2
- data/node_modules/axe-core/package.json +3 -5
- data/node_modules/axe-core/sri-history.json +4 -0
- metadata +7 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 165109e571c6ba5445e74e15f2be52f24c787509790ad41a4ea88664e9efdb65
|
|
4
|
+
data.tar.gz: be9e4eafdc824e8cc3ae4e3ad5829f33a85a4df2e6ad3ac86a0c89fd52a2a084
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a4b8872ec44bbe165d2962f38157b1919f3c6433e13c14a714738bfe001b46cab9ea75d0a6d4e7f8c4fd42f98e8e2a4a3c174ff39e6f8dc1fcdcd2d987613eca
|
|
7
|
+
data.tar.gz: 2a6335737c699d6a6c5d397a1149e1e8f30e02dae6ba84f11f49edb41bc69743f26b98d22cde3e227447f4dafc00ac90e754384d307a9041586730fcbf720d9c
|
|
Binary file
|
|
@@ -59,6 +59,7 @@ window.GOVUK.analyticsGa4.analyticsModules = window.GOVUK.analyticsGa4.analytics
|
|
|
59
59
|
emergency_banner: document.querySelector('[data-ga4-emergency-banner]') ? 'true' : undefined,
|
|
60
60
|
phase_banner: this.getElementAttribute('data-ga4-phase-banner') || undefined,
|
|
61
61
|
devolved_nations_banner: this.getElementAttribute('data-ga4-devolved-nations-banner') || undefined,
|
|
62
|
+
app_promo_banner: this.getBannerPresence('[data-ga4-app-promo-banner]'),
|
|
62
63
|
cookie_banner: this.getBannerPresence('[data-ga4-cookie-banner]'),
|
|
63
64
|
intervention: this.getBannerPresence('[data-ga4-intervention-banner]'),
|
|
64
65
|
global_bar: this.getBannerPresence('[data-ga4-global-banner]'),
|
|
@@ -172,8 +173,8 @@ window.GOVUK.analyticsGa4.analyticsModules = window.GOVUK.analyticsGa4.analytics
|
|
|
172
173
|
return this.PIIRemover.stripPIIWithOverride(document.title, false, true)
|
|
173
174
|
},
|
|
174
175
|
|
|
175
|
-
// window.httpStatusCode is set in the source of the error page
|
|
176
|
-
// https://github.com/alphagov/
|
|
176
|
+
// window.httpStatusCode is set in the source of the error page
|
|
177
|
+
// https://github.com/alphagov/frontend/blob/1d92fe5f0ada726d1c95dae645e1dc2195d9d3fe/app/views/static_error_pages/_error_page.html.erb#L26
|
|
177
178
|
getStatusCode: function () {
|
|
178
179
|
if (window.httpStatusCode) {
|
|
179
180
|
return window.httpStatusCode.toString()
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
window.GOVUK = window.GOVUK || {}
|
|
2
|
+
window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
3
|
+
|
|
4
|
+
(function (Modules) {
|
|
5
|
+
class AppPromoBanner {
|
|
6
|
+
constructor ($module) {
|
|
7
|
+
this.$module = $module
|
|
8
|
+
/** @type {HTMLButtonElement | null} */
|
|
9
|
+
this.$closeButton = this.$module.querySelector('.js-close-app-promo-banner')
|
|
10
|
+
this.APP_PROMO_BANNER_COOKIE = 'app_promo_banner'
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Initialise the app promo banner
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
init () {
|
|
18
|
+
// Only display the banner on Android devices
|
|
19
|
+
if (!this.isAndroidDevice()) return
|
|
20
|
+
|
|
21
|
+
// Do not display the app promo banner if the cookie banner is visible
|
|
22
|
+
if (this.isCookieBannerVisible()) return
|
|
23
|
+
|
|
24
|
+
// Do not display the banner if it was previously closed
|
|
25
|
+
const cookieContents = this.getAppPromoBannerCookieContent()
|
|
26
|
+
if (cookieContents && cookieContents.closed === true) return
|
|
27
|
+
|
|
28
|
+
// Do not display the banner if the close button is not found
|
|
29
|
+
if (!this.$closeButton) return
|
|
30
|
+
|
|
31
|
+
this.$closeButton.addEventListener('click', (event) => this.handleClick(event))
|
|
32
|
+
this.showBanner()
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Checks if the current device is an Android device
|
|
37
|
+
*
|
|
38
|
+
* @returns Boolean
|
|
39
|
+
*/
|
|
40
|
+
isAndroidDevice () {
|
|
41
|
+
return (/Android/i.test(navigator.userAgent))
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Checks if the user has accepted cookies and the cookie
|
|
46
|
+
* category the app promo banner is in
|
|
47
|
+
*
|
|
48
|
+
* @returns Boolean
|
|
49
|
+
*/
|
|
50
|
+
isCookiesAndCategoryPermitted () {
|
|
51
|
+
const cookieConsent = window.GOVUK.getConsentCookie()
|
|
52
|
+
const cookieCategory = window.GOVUK.getCookieCategory(this.APP_PROMO_BANNER_COOKIE)
|
|
53
|
+
return (cookieConsent && cookieConsent[cookieCategory])
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Checks if the cookie banner is visible
|
|
58
|
+
*
|
|
59
|
+
* @returns Boolean - Cookie banner visible
|
|
60
|
+
*/
|
|
61
|
+
isCookieBannerVisible () {
|
|
62
|
+
/** @type {HTMLDivElement | null} */
|
|
63
|
+
const cookieBanner = document.querySelector('#global-cookie-message')
|
|
64
|
+
return cookieBanner && !cookieBanner.hidden
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Sets the cookie for the app promo banner, including if the
|
|
69
|
+
* the banner should be in the closed state
|
|
70
|
+
*
|
|
71
|
+
* @param {Boolean} isAppBannerClosed
|
|
72
|
+
*/
|
|
73
|
+
setAppBannerCookie (isAppBannerClosed) {
|
|
74
|
+
// Do not set the cookie if cookies and category are not permitted
|
|
75
|
+
if (!this.isCookiesAndCategoryPermitted) return
|
|
76
|
+
|
|
77
|
+
/** @type {AppBannerCookie} */
|
|
78
|
+
const appBannerCookie = { closed: isAppBannerClosed }
|
|
79
|
+
|
|
80
|
+
// This approach will simply set/overwrite the cookie with new values
|
|
81
|
+
const appBannerCookieValue = JSON.stringify(appBannerCookie)
|
|
82
|
+
window.GOVUK.setCookie(this.APP_PROMO_BANNER_COOKIE, appBannerCookieValue, { days: 84 })
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Return the user's cookie settings for the app promo banner,
|
|
87
|
+
* or null if the cookie is not present
|
|
88
|
+
*
|
|
89
|
+
* @returns {AppBannerCookie | null} App promo banner settings
|
|
90
|
+
*/
|
|
91
|
+
getAppPromoBannerCookieContent () {
|
|
92
|
+
const appBannerCookie = window.GOVUK.getCookie(this.APP_PROMO_BANNER_COOKIE)
|
|
93
|
+
return appBannerCookie ? JSON.parse(appBannerCookie) : null
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Handle the click of the close banner button
|
|
98
|
+
*
|
|
99
|
+
* @param {MouseEvent} event - Click event
|
|
100
|
+
*/
|
|
101
|
+
handleClick (event) {
|
|
102
|
+
event.preventDefault()
|
|
103
|
+
this.hideBanner()
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Shows the app promo banner
|
|
108
|
+
*
|
|
109
|
+
*/
|
|
110
|
+
showBanner () {
|
|
111
|
+
this.$module.hidden = false
|
|
112
|
+
this.$module.classList.add('gem-c-app-promo-banner--visible')
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Hides the app promo banner and sets a cookie to store
|
|
117
|
+
* the closed state as true
|
|
118
|
+
*
|
|
119
|
+
*/
|
|
120
|
+
hideBanner () {
|
|
121
|
+
this.setAppBannerCookie(true)
|
|
122
|
+
this.$module.hidden = true
|
|
123
|
+
this.$module.classList.remove('gem-c-app-promo-banner--visible')
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
Modules.AppPromoBanner = AppPromoBanner
|
|
128
|
+
})(window.GOVUK.Modules)
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* @typedef {object} AppBannerCookie
|
|
132
|
+
* @property {boolean} [closed] - Banner closed state
|
|
133
|
+
* @property {number} [version] - Banner version number
|
|
134
|
+
*/
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
licensing_session: 'essential',
|
|
22
22
|
govuk_contact_referrer: 'essential',
|
|
23
23
|
multivariatetest_cohort_coronavirus_extremely_vulnerable_rate_limit: 'essential',
|
|
24
|
+
app_promo_banner: 'settings',
|
|
24
25
|
dgu_beta_banner_dismissed: 'settings',
|
|
25
26
|
global_banner_seen: 'settings',
|
|
26
27
|
user_nation: 'settings',
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
@import "components/accordion";
|
|
12
12
|
@import "components/action-link";
|
|
13
13
|
@import "components/add-another";
|
|
14
|
+
@import "components/app-promo-banner";
|
|
14
15
|
@import "components/attachment";
|
|
15
16
|
@import "components/attachment-link";
|
|
16
17
|
@import "components/back-link";
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
@import "govuk_publishing_components/individual_component_support";
|
|
2
|
+
|
|
3
|
+
.gem-c-app-promo-banner {
|
|
4
|
+
display: none;
|
|
5
|
+
padding: govuk-spacing(5) 0;
|
|
6
|
+
border-top: 4px solid $govuk-brand-colour;
|
|
7
|
+
background-color: $govuk-rebrand-template-background-colour;
|
|
8
|
+
@include govuk-text-colour;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.gem-c-app-promo-banner--visible {
|
|
12
|
+
display: block;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.gem-c-app-promo-banner__container {
|
|
16
|
+
display: flex;
|
|
17
|
+
gap: govuk-spacing(3);
|
|
18
|
+
align-items: center;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.gem-c-app-promo-banner__icon {
|
|
22
|
+
flex: 0 1 64px;
|
|
23
|
+
min-width: 60px;
|
|
24
|
+
height: auto;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.gem-c-app-promo-banner__content {
|
|
28
|
+
flex: 1 1 auto;
|
|
29
|
+
display: flex;
|
|
30
|
+
align-items: center;
|
|
31
|
+
justify-content: space-between;
|
|
32
|
+
flex-wrap: wrap;
|
|
33
|
+
row-gap: govuk-spacing(1);
|
|
34
|
+
column-gap: govuk-spacing(3);
|
|
35
|
+
|
|
36
|
+
// Ensures the view link appears beneath the text content
|
|
37
|
+
// on larger screen sizes
|
|
38
|
+
@include govuk-media-query($from: tablet) {
|
|
39
|
+
flex-direction: column;
|
|
40
|
+
align-items: start;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.gem-c-app-promo-banner__text {
|
|
45
|
+
text-wrap-style: balance;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.gem-c-app-promo-banner__close-button {
|
|
49
|
+
border: 0;
|
|
50
|
+
padding: 0;
|
|
51
|
+
color: govuk-tint(govuk-colour("black"), 25%);
|
|
52
|
+
background: none;
|
|
53
|
+
flex: 0 0 24px;
|
|
54
|
+
height: 24px;
|
|
55
|
+
|
|
56
|
+
&:hover {
|
|
57
|
+
cursor: pointer;
|
|
58
|
+
box-shadow: 0 4px govuk-colour("black");
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
&:focus {
|
|
62
|
+
@include govuk-focused-text;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -248,16 +248,3 @@ $feedback-prompt-border-top-colour: $govuk-blue-tint-50;
|
|
|
248
248
|
color: $govuk-focus-text-colour;
|
|
249
249
|
}
|
|
250
250
|
}
|
|
251
|
-
|
|
252
|
-
// static.css on GOV.UK overwrites the component styles using input[type="text"]
|
|
253
|
-
// so we need to apply govuk-input styles using a stronger selector
|
|
254
|
-
.gem-c-feedback .gem-c-input[type="text"] {
|
|
255
|
-
margin: 0;
|
|
256
|
-
padding: govuk-spacing(1);
|
|
257
|
-
border: $govuk-border-width-form-element solid $govuk-input-border-colour;
|
|
258
|
-
@include govuk-font($size: 19);
|
|
259
|
-
|
|
260
|
-
&:focus {
|
|
261
|
-
outline: $govuk-focus-width solid $govuk-focus-colour;
|
|
262
|
-
}
|
|
263
|
-
}
|
|
@@ -14,17 +14,3 @@ $search-icon-size: 40px;
|
|
|
14
14
|
height: govuk-px-to-rem($search-icon-size);
|
|
15
15
|
background: url("govuk_publishing_components/icon-search.svg") no-repeat -3px center;
|
|
16
16
|
}
|
|
17
|
-
|
|
18
|
-
// this overrides styles from static that break the look of the component
|
|
19
|
-
// unfortunately we then need to override the override for the search icon variant
|
|
20
|
-
// TODO: remove these styles once static is made less aggressive
|
|
21
|
-
.gem-c-input.govuk-input {
|
|
22
|
-
margin: 0;
|
|
23
|
-
min-width: 0;
|
|
24
|
-
padding: govuk-spacing(1);
|
|
25
|
-
box-sizing: border-box;
|
|
26
|
-
|
|
27
|
-
&.gem-c-input--with-search-icon {
|
|
28
|
-
padding-left: govuk-spacing(6);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
@@ -2,21 +2,11 @@
|
|
|
2
2
|
@import "govuk/components/summary-list/summary-list";
|
|
3
3
|
|
|
4
4
|
.gem-c-summary-list {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
margin-bottom: govuk-spacing(6);
|
|
7
6
|
@include govuk-font(19);
|
|
8
|
-
@include govuk-responsive-margin(6, "top");
|
|
9
|
-
|
|
10
|
-
&:nth-of-type(1) {
|
|
11
|
-
margin-top: govuk-spacing(0);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
&:nth-last-of-type(1) {
|
|
15
|
-
border-bottom: 0;
|
|
16
|
-
}
|
|
17
7
|
|
|
18
8
|
.govuk-summary-list {
|
|
19
|
-
|
|
9
|
+
margin-bottom: 0;
|
|
20
10
|
}
|
|
21
11
|
}
|
|
22
12
|
|
|
@@ -4,7 +4,7 @@ module GovukPublishingComponents
|
|
|
4
4
|
applications = [
|
|
5
5
|
{
|
|
6
6
|
type: "public-facing",
|
|
7
|
-
apps: %w[collections email-alert-frontend feedback finder-frontend frontend government-frontend smart-answers
|
|
7
|
+
apps: %w[collections email-alert-frontend feedback finder-frontend frontend government-frontend smart-answers].sort,
|
|
8
8
|
},
|
|
9
9
|
{
|
|
10
10
|
type: "publishing",
|
|
@@ -39,7 +39,6 @@ module GovukPublishingComponents
|
|
|
39
39
|
source: app.source,
|
|
40
40
|
gem_version: app.gem_version,
|
|
41
41
|
gem_version_status: app.gem_version == GovukPublishingComponents::VERSION ? "green" : "red",
|
|
42
|
-
slimmer_version: app.slimmer_version,
|
|
43
42
|
sass_version: app.sass_version,
|
|
44
43
|
}
|
|
45
44
|
end
|
|
@@ -20,7 +20,6 @@ module GovukPublishingComponents
|
|
|
20
20
|
govuk-developer-docs
|
|
21
21
|
local-links-manager
|
|
22
22
|
manuals-publisher
|
|
23
|
-
maslow
|
|
24
23
|
places-manager
|
|
25
24
|
publisher
|
|
26
25
|
release
|
|
@@ -31,7 +30,6 @@ module GovukPublishingComponents
|
|
|
31
30
|
signon
|
|
32
31
|
smart-answers
|
|
33
32
|
specialist-publisher
|
|
34
|
-
static
|
|
35
33
|
support
|
|
36
34
|
transition
|
|
37
35
|
travel-advice-publisher
|
|
@@ -16,10 +16,6 @@ module GovukPublishingComponents
|
|
|
16
16
|
parse_file(@gemfilelock, /govuk_publishing_components \(([^)>=~ ]+)\)/)
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
-
def slimmer_version
|
|
20
|
-
parse_file(@gemfilelock, /slimmer \(([^)>=~ ]+)\)/)
|
|
21
|
-
end
|
|
22
|
-
|
|
23
19
|
def sass_version
|
|
24
20
|
parse_file(@gemfilelock, /sass-embedded \(([^)>=~ ]+)\)/)
|
|
25
21
|
end
|
|
@@ -4,15 +4,6 @@ module GovukPublishingComponents
|
|
|
4
4
|
|
|
5
5
|
def initialize(gem_data, results)
|
|
6
6
|
if gem_data[:gem_found]
|
|
7
|
-
@applications_using_static = %w[
|
|
8
|
-
collections
|
|
9
|
-
finder-frontend
|
|
10
|
-
government-frontend
|
|
11
|
-
service-manual-frontend
|
|
12
|
-
smart-answers
|
|
13
|
-
]
|
|
14
|
-
|
|
15
|
-
@static_data = find_static(results)
|
|
16
7
|
@gem_data = gem_data
|
|
17
8
|
@applications_data = sort_results(results)
|
|
18
9
|
@gem_data[:components_by_application] = get_components_by_application || []
|
|
@@ -23,23 +14,6 @@ module GovukPublishingComponents
|
|
|
23
14
|
|
|
24
15
|
private
|
|
25
16
|
|
|
26
|
-
# find static to check for global includes, reduce false warnings
|
|
27
|
-
def find_static(results)
|
|
28
|
-
results.each do |result|
|
|
29
|
-
if result[:name] == "static" && result[:application_found] == true
|
|
30
|
-
return clean_static(result)
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
false
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
# turn static data into an object so locations can be easily referenced
|
|
38
|
-
# should give object of form { "template" => [], "stylesheet" => [] }
|
|
39
|
-
def clean_static(data)
|
|
40
|
-
Hash[data[:components_found].map { |d| [d[:location], d[:components]] }]
|
|
41
|
-
end
|
|
42
|
-
|
|
43
17
|
def prettify_key(key)
|
|
44
18
|
key.to_s.gsub("_", " ").capitalize
|
|
45
19
|
end
|
|
@@ -50,20 +24,19 @@ module GovukPublishingComponents
|
|
|
50
24
|
results.each do |result|
|
|
51
25
|
if result[:application_found]
|
|
52
26
|
@current_uses_individual_asset_model = result[:uses_individual_asset_model]
|
|
53
|
-
application_uses_static = @applications_using_static.include?(result[:name])
|
|
54
27
|
templates = result[:components_found].find { |c| c[:location] == "template" }
|
|
55
28
|
stylesheets = result[:components_found].find { |c| c[:location] == "stylesheet" }
|
|
56
29
|
javascripts = result[:components_found].find { |c| c[:location] == "javascript" }
|
|
57
30
|
ruby = result[:components_found].find { |c| c[:location] == "ruby" }
|
|
58
31
|
|
|
59
32
|
templates[:components] = include_any_components_within_components(templates[:components])
|
|
33
|
+
ruby[:components] = include_any_components_within_components(ruby[:components])
|
|
60
34
|
|
|
61
35
|
warnings = []
|
|
62
36
|
warnings << warn_about_missing_components(result[:components_found])
|
|
63
37
|
warnings << warn_about_missing_assets(result[:components_found])
|
|
64
38
|
warnings << warn_about_style_overrides(result[:gem_style_references])
|
|
65
39
|
warnings << warn_about_jquery_references(result[:jquery_references])
|
|
66
|
-
warnings << check_for_assets_already_in_static(result[:components_found]) if @static_data && application_uses_static
|
|
67
40
|
warnings = warnings.flatten
|
|
68
41
|
|
|
69
42
|
summary = [
|
|
@@ -89,7 +62,6 @@ module GovukPublishingComponents
|
|
|
89
62
|
name: result[:name],
|
|
90
63
|
dir: result[:dir],
|
|
91
64
|
application_found: result[:application_found],
|
|
92
|
-
uses_static: application_uses_static,
|
|
93
65
|
summary:,
|
|
94
66
|
warnings:,
|
|
95
67
|
warning_count: warnings.length,
|
|
@@ -155,12 +127,10 @@ module GovukPublishingComponents
|
|
|
155
127
|
asset_in_gem = false
|
|
156
128
|
end
|
|
157
129
|
|
|
158
|
-
check_static = @static_data && second_location != "code"
|
|
159
|
-
asset_in_static = asset_already_in_static(second_location, component) if check_static
|
|
160
130
|
suppress_warning = @current_uses_individual_asset_model && second_location == "stylesheet"
|
|
161
|
-
raise_warning = asset_in_gem && !
|
|
131
|
+
raise_warning = asset_in_gem && !suppress_warning
|
|
162
132
|
|
|
163
|
-
# this raises a warning if the asset exists and isn't included
|
|
133
|
+
# this raises a warning if the asset exists and isn't included in the application
|
|
164
134
|
warnings << create_warning(component, "Included in #{first_location} but not #{second_location}") if raise_warning
|
|
165
135
|
end
|
|
166
136
|
end
|
|
@@ -169,27 +139,6 @@ module GovukPublishingComponents
|
|
|
169
139
|
warnings
|
|
170
140
|
end
|
|
171
141
|
|
|
172
|
-
def asset_already_in_static(location, component)
|
|
173
|
-
return true if @static_data[location].include?(component)
|
|
174
|
-
|
|
175
|
-
false
|
|
176
|
-
end
|
|
177
|
-
|
|
178
|
-
def check_for_assets_already_in_static(locations)
|
|
179
|
-
warnings = []
|
|
180
|
-
|
|
181
|
-
locations.each do |location|
|
|
182
|
-
next if %w[template ruby].include?(location[:location])
|
|
183
|
-
|
|
184
|
-
location[:components].each do |component|
|
|
185
|
-
raise_warning = asset_already_in_static(location[:location], component)
|
|
186
|
-
warnings << create_warning(component, "Included in #{location[:location]} but already included in static") if raise_warning
|
|
187
|
-
end
|
|
188
|
-
end
|
|
189
|
-
|
|
190
|
-
warnings
|
|
191
|
-
end
|
|
192
|
-
|
|
193
142
|
def warn_about_missing_assets(components)
|
|
194
143
|
warnings = []
|
|
195
144
|
|
|
@@ -21,13 +21,6 @@
|
|
|
21
21
|
} %>
|
|
22
22
|
<% end %>
|
|
23
23
|
</td>
|
|
24
|
-
<td class="govuk-table__cell">
|
|
25
|
-
<% if app[:slimmer_version] %>
|
|
26
|
-
<%= render "govuk_publishing_components/components/tag", {
|
|
27
|
-
text: app[:slimmer_version],
|
|
28
|
-
} %>
|
|
29
|
-
<% end %>
|
|
30
|
-
</td>
|
|
31
24
|
<td class="govuk-table__cell">
|
|
32
25
|
<% if app[:sass_version] %>
|
|
33
26
|
<%= render "govuk_publishing_components/components/tag", {
|
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
<th scope="col" class="govuk-table__header sticky-table-header">Type</th>
|
|
25
25
|
<th scope="col" class="govuk-table__header sticky-table-header">Source</th>
|
|
26
26
|
<th scope="col" class="govuk-table__header sticky-table-header">Gem version</th>
|
|
27
|
-
<th scope="col" class="govuk-table__header sticky-table-header">Slimmer version</th>
|
|
28
27
|
<th scope="col" class="govuk-table__header sticky-table-header">Sass version</th>
|
|
29
28
|
</tr>
|
|
30
29
|
</thead>
|
|
@@ -43,12 +43,6 @@
|
|
|
43
43
|
} %>
|
|
44
44
|
<% end %>
|
|
45
45
|
|
|
46
|
-
<% if application[:uses_static] %>
|
|
47
|
-
<%= render "govuk_publishing_components/components/warning_text", {
|
|
48
|
-
text: raw("This application uses <a href=\"https://github.com/alphagov/static\" class=\"govuk-link\">static</a>, which can contain assets for components used in more than one application. Warnings for missing component assets in this application that are already included in static have been suppressed."),
|
|
49
|
-
} %>
|
|
50
|
-
<% end %>
|
|
51
|
-
|
|
52
46
|
<% application[:warnings].each do |warning| %>
|
|
53
47
|
<p class="govuk-body">
|
|
54
48
|
<strong class="govuk-tag">Warn</strong>
|
|
@@ -66,6 +60,8 @@
|
|
|
66
60
|
heading_level: 3,
|
|
67
61
|
} %>
|
|
68
62
|
|
|
63
|
+
<p class="govuk-body">Note that this information includes components within components - the application may not directly reference them.</p>
|
|
64
|
+
|
|
69
65
|
<% items = [] %>
|
|
70
66
|
<% application[:summary].each do |item| %>
|
|
71
67
|
<% content = capture do %>
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
<%
|
|
2
|
+
add_gem_component_stylesheet("app_promo_banner")
|
|
3
|
+
|
|
4
|
+
disable_ga4 ||= false
|
|
5
|
+
|
|
6
|
+
component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
|
|
7
|
+
component_helper.add_class("gem-c-app-promo-banner")
|
|
8
|
+
component_helper.add_role("region")
|
|
9
|
+
component_helper.add_aria_attribute({ label: t("components.app_promo_banner.aria_label")})
|
|
10
|
+
component_helper.set_hidden("hidden")
|
|
11
|
+
component_helper.add_data_attribute({ module: "app-promo-banner", nosnippet: "" })
|
|
12
|
+
component_helper.add_data_attribute({ ga4_app_promo_banner: "" }) unless disable_ga4 # Added to the parent element for the GA4 pageview object to use
|
|
13
|
+
|
|
14
|
+
ga4_event_attributes = {
|
|
15
|
+
event_name: "select_content",
|
|
16
|
+
type: "app promo banner",
|
|
17
|
+
action: "closed",
|
|
18
|
+
section: t("components.app_promo_banner.title_text"),
|
|
19
|
+
text: t("components.app_promo_banner.close"),
|
|
20
|
+
}.to_json unless disable_ga4
|
|
21
|
+
|
|
22
|
+
ga4_link_attributes = {
|
|
23
|
+
event_name: "navigation",
|
|
24
|
+
type: "app promo banner",
|
|
25
|
+
index_link: 1,
|
|
26
|
+
index_total: 1,
|
|
27
|
+
}.to_json unless disable_ga4
|
|
28
|
+
%>
|
|
29
|
+
|
|
30
|
+
<%= tag.div(**component_helper.all_attributes) do %>
|
|
31
|
+
<%= tag.div(class: "govuk-width-container") do %>
|
|
32
|
+
<%= tag.div(class: "gem-c-app-promo-banner__container") do %>
|
|
33
|
+
<%= content_tag(:button, {
|
|
34
|
+
class: "gem-c-app-promo-banner__close-button js-close-app-promo-banner",
|
|
35
|
+
aria: {
|
|
36
|
+
label: t("components.app_promo_banner.close"),
|
|
37
|
+
},
|
|
38
|
+
data: {
|
|
39
|
+
module: disable_ga4 ? nil : "ga4-event-tracker",
|
|
40
|
+
ga4_event: ga4_event_attributes,
|
|
41
|
+
},
|
|
42
|
+
}) do %>
|
|
43
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" focusable="false">
|
|
44
|
+
<circle cx="12" cy="12" r="11.5" stroke="currentColor" />
|
|
45
|
+
<path stroke="currentColor" stroke-linecap="round" stroke-width="1.5" d="m7 7 10 10m0-10L7 17" />
|
|
46
|
+
</svg>
|
|
47
|
+
<% end %>
|
|
48
|
+
<%= image_tag((asset_path "govuk_publishing_components/app-promo-banner/govuk-app-icon.png"),
|
|
49
|
+
alt: "",
|
|
50
|
+
class: "gem-c-app-promo-banner__icon",
|
|
51
|
+
width: "64",
|
|
52
|
+
height: "64",
|
|
53
|
+
) %>
|
|
54
|
+
<%= tag.div(class: "gem-c-app-promo-banner__content") do %>
|
|
55
|
+
<%= tag.div(class: "gem-c-app-promo-banner__text") do %>
|
|
56
|
+
<%= tag.h2 t("components.app_promo_banner.title_text"), class: "govuk-heading-s govuk-!-margin-bottom-0" %>
|
|
57
|
+
<%= tag.p t("components.app_promo_banner.body_text"), class: "govuk-body-s govuk-!-margin-bottom-0" %>
|
|
58
|
+
<% end %>
|
|
59
|
+
<%= link_to("https://play.google.com/store/apps/details?id=uk.gov.govuk&hl=en_GB",
|
|
60
|
+
class: "govuk-link govuk-body govuk-!-margin-bottom-0",
|
|
61
|
+
data: {
|
|
62
|
+
module: disable_ga4 ? nil : "ga4-link-tracker",
|
|
63
|
+
ga4_link: ga4_link_attributes,
|
|
64
|
+
},
|
|
65
|
+
) do %>
|
|
66
|
+
<%= t("components.app_promo_banner.view") %>
|
|
67
|
+
<%= tag.span("on Google Play", class: "govuk-visually-hidden") %>
|
|
68
|
+
<% end %>
|
|
69
|
+
<% end %>
|
|
70
|
+
<% end %>
|
|
71
|
+
<% end %>
|
|
72
|
+
<% end %>
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
<%
|
|
2
2
|
add_gem_component_stylesheet("layout-for-public")
|
|
3
3
|
|
|
4
|
-
for_static ||= false
|
|
5
4
|
emergency_banner ||= nil
|
|
6
|
-
full_width ||= false
|
|
7
5
|
global_banner ||= nil
|
|
8
6
|
html_lang ||= "en"
|
|
9
7
|
homepage ||= false
|
|
@@ -17,6 +15,7 @@
|
|
|
17
15
|
omit_header ||= false
|
|
18
16
|
product_name ||= nil
|
|
19
17
|
service_name ||= nil
|
|
18
|
+
show_app_promo_banner ||= false
|
|
20
19
|
show_cross_service_header ||= false
|
|
21
20
|
draft_watermark ||= false
|
|
22
21
|
title ||= "GOV.UK - The best place to find government services and information"
|
|
@@ -76,6 +75,9 @@
|
|
|
76
75
|
<%= render "govuk_publishing_components/components/skip_link", {
|
|
77
76
|
href: "#content",
|
|
78
77
|
} %>
|
|
78
|
+
<% if show_app_promo_banner %>
|
|
79
|
+
<%= render "govuk_publishing_components/components/app_promo_banner" %>
|
|
80
|
+
<% end %>
|
|
79
81
|
<% end %>
|
|
80
82
|
<% unless omit_header %>
|
|
81
83
|
<% if show_cross_service_header %>
|
|
@@ -105,18 +107,10 @@
|
|
|
105
107
|
omit_account_phase_banner: omit_account_phase_banner,
|
|
106
108
|
omit_account_navigation: omit_account_navigation,
|
|
107
109
|
account_nav_location: account_nav_location,
|
|
108
|
-
for_static: for_static,
|
|
109
110
|
} do %>
|
|
110
111
|
<%= yield :before_content %>
|
|
111
112
|
<%= yield %>
|
|
112
113
|
<% end %>
|
|
113
|
-
<% elsif for_static %>
|
|
114
|
-
<div id="wrapper" class="<%= "govuk-width-container" unless full_width %>">
|
|
115
|
-
<%= yield :before_content %>
|
|
116
|
-
<main class="govuk-main-wrapper" id="content">
|
|
117
|
-
<%= yield %>
|
|
118
|
-
</main>
|
|
119
|
-
</div>
|
|
120
114
|
<% else %>
|
|
121
115
|
<%= yield %>
|
|
122
116
|
<% end %>
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
title ||= nil
|
|
6
6
|
summary_card_actions ||= []
|
|
7
7
|
rows ||=[]
|
|
8
|
+
block ||= yield
|
|
8
9
|
|
|
9
10
|
component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
|
|
10
11
|
component_helper.add_class("gem-c-summary-card")
|
|
@@ -26,8 +27,8 @@
|
|
|
26
27
|
<% end %>
|
|
27
28
|
<% end %>
|
|
28
29
|
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
<%= tag.div class: "govuk-summary-card__content" do %>
|
|
31
|
+
<% if rows.any? %>
|
|
31
32
|
<%= tag.dl class: "govuk-summary-list" do %>
|
|
32
33
|
<% rows.each do |row| %>
|
|
33
34
|
<%
|
|
@@ -62,6 +63,7 @@
|
|
|
62
63
|
<% end %>
|
|
63
64
|
<% end %>
|
|
64
65
|
<% end %>
|
|
66
|
+
<%= tag.div block, class: "gem-c-summary__block" if block.present? %>
|
|
65
67
|
<% end %>
|
|
66
68
|
<% end %>
|
|
67
69
|
<% end %>
|