govuk_publishing_components 70.1.0 → 70.2.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/images/govuk_publishing_components/icon-notification.svg +1 -0
- data/app/assets/images/govuk_publishing_components/icon-print.svg +1 -0
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/pii-remover.js +3 -3
- data/app/assets/javascripts/govuk_publishing_components/components/single-page-notification-button.js +2 -2
- data/app/assets/stylesheets/govuk_publishing_components/components/_button.scss +36 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_intervention.scss +12 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_print-link.scss +0 -39
- data/app/assets/stylesheets/govuk_publishing_components/components/_single-page-notification-button.scss +0 -31
- data/app/assets/stylesheets/govuk_publishing_components/components/_subscription-links.scss +0 -65
- data/app/controllers/govuk_publishing_components/component_guide_controller.rb +11 -39
- data/app/models/govuk_publishing_components/component_doc.rb +2 -6
- data/app/models/govuk_publishing_components/component_docs.rb +2 -8
- data/app/views/govuk_publishing_components/component_guide/_component_list.html.erb +1 -5
- data/app/views/govuk_publishing_components/component_guide/component_doc/_component_output.html.erb +2 -10
- data/app/views/govuk_publishing_components/component_guide/example.html.erb +1 -1
- data/app/views/govuk_publishing_components/component_guide/index.html.erb +0 -7
- data/app/views/govuk_publishing_components/component_guide/preview.html.erb +1 -9
- data/app/views/govuk_publishing_components/component_guide/show.html.erb +10 -28
- data/app/views/govuk_publishing_components/components/_intervention.html.erb +2 -2
- data/app/views/govuk_publishing_components/components/_metadata.html.erb +3 -0
- data/app/views/govuk_publishing_components/components/_print_link.html.erb +10 -16
- data/app/views/govuk_publishing_components/components/_single_page_notification_button.html.erb +5 -8
- data/app/views/govuk_publishing_components/components/_subscription_links.html.erb +5 -30
- data/app/views/govuk_publishing_components/components/docs/button.yml +8 -0
- data/app/views/govuk_publishing_components/components/docs/metadata.yml +4 -0
- data/app/views/govuk_publishing_components/components/docs/service_navigation.yml +1 -2
- data/app/views/govuk_publishing_components/components/docs/subscription_links.yml +2 -16
- data/config/routes.rb +0 -7
- data/lib/govuk_publishing_components/config.rb +0 -4
- data/lib/govuk_publishing_components/presenters/button_helper.rb +8 -0
- data/lib/govuk_publishing_components/presenters/subscription_links_helper.rb +3 -10
- data/lib/govuk_publishing_components/version.rb +1 -1
- metadata +4 -4
- data/app/assets/images/govuk_publishing_components/icon-print-2x.png +0 -0
- data/app/assets/images/govuk_publishing_components/icon-print.png +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c7b177c9da6fb435cb1e67132c22ed5d934c3c4d1195ebbbad43f4bdf840db6b
|
|
4
|
+
data.tar.gz: b1e988e6f1af0ea310b5aee90fa639e7eab8f1081369224569185649d0564948
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6d64abc0c3978040d42a6050dd242715afc67d72c1f23029a40a872c66949ece8dfcca0c5326f842ae9768121cc9c4203bd2694b5a0d667a866b4a16f730c9a6
|
|
7
|
+
data.tar.gz: 6e8a95eb759c7fad99b61bca15d2f889a181f0152dbb7e1c0911e4a720eaac5f38655105645f91574e856f8bb735701f98cfa4bd251bbb29a72d605f7fd82782
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" height="18" width="18" viewBox="0 0 459.334 459.334"><path fill="currentColor" d="M177.216 404.514c-.001.12-.009.239-.009.359 0 30.078 24.383 54.461 54.461 54.461s54.461-24.383 54.461-54.461c0-.12-.008-.239-.009-.359H175.216zM403.549 336.438l-49.015-72.002v-89.83c0-60.581-43.144-111.079-100.381-122.459V24.485C254.152 10.963 243.19 0 229.667 0s-24.485 10.963-24.485 24.485v27.663c-57.237 11.381-100.381 61.879-100.381 122.459v89.83l-49.015 72.002a24.76 24.76 0 0 0 20.468 38.693H383.08a24.761 24.761 0 0 0 20.469-38.694z" /></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#clip0_30_240)"><path d="M7.86133 1H13.4766V7H4.49219V4.02H7.86133V1ZM4.49219 10H13.4766V17H4.49219V10ZM5.61523 12H12.3535V11H5.61523V12ZM5.61523 14H12.3535V13H5.61523V14ZM5.61523 16H12.3535V15H5.61523V16Z" fill="white"/><path d="M12.3535 16H5.61523V15H12.3535V16ZM14.5996 7H17.9688V14H14.5996V18H3.36914V14H0V7H3.36914V3H4.49219V2H5.61523V1H6.73828V0H14.5996V7ZM13.4766 10H4.49219V17H13.4766V10ZM13.4766 1H7.86133V4.02H4.49219V7H13.4766V1ZM12.3535 13H5.61523V14H12.3535V13ZM12.3535 11H5.61523V12H12.3535V11Z" fill="#0B0C0C"/></g><defs><clipPath id="clip0_30_240"><rect width="17.9688" height="18" fill="white"/></clipPath></defs></svg>
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
// e.g. 1990/01/01 or 1990-01-01 or 1990-1-1 or 1990/1/1 or 1990\1\1 or 1990\01\01
|
|
11
11
|
var DATE_PATTERN_NUMERIC_2 = /\d{4}([-\/\\])\d{1,2}([-\/\\])\d{1,2}/g // eslint-disable-line no-useless-escape
|
|
12
12
|
|
|
13
|
-
// e.g.
|
|
14
|
-
|
|
13
|
+
// e.g. Matches 8 digit date strings in either DDMMYYYY or YYYYMMDD format, constrained to years between 1900 and 2099.
|
|
14
|
+
const DATE_PATTERN_NUMERIC_3 = /\b(?:(?:0[1-9]|[12]\d|3[01])(?:0[1-9]|1[0-2])(?:19|20)\d{2}|(?:19|20)\d{2}(?:0[1-9]|1[0-2])(?:0[1-9]|[12]\d|3[01]))\b/g
|
|
15
15
|
|
|
16
16
|
// e.g. 1(st) (of) Jan(uary) 1990 (or 90 or '90) - where the bracketed characters are optional parts that can be matched
|
|
17
17
|
var DATE_PATTERN_STRING_1 = /\d{1,2}(?:st|nd|rd|th)?\s(?:of\s)?(Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|Jun(?:e)?|Jul(?:y)?|Aug(?:ust)?|Sep(?:t)?(?:ember)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)\s(?:')?(\d{4}|\d{2})/gi
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
|
|
34
34
|
// 2 valid letters - optional +/space - 6 digits with optional +/spaces every 2 digits (to account for '12 34 56') - optional +/space - 1 valid letter. Case insensitive.
|
|
35
35
|
// e.g. 'AB123456A', 'AB 12 34 56 A', 'ab 123456 a', 'ab 12 34 56 a', 'AB+12+34+56+A'
|
|
36
|
-
var NATIONAL_INSURANCE_NUMBER =
|
|
36
|
+
var NATIONAL_INSURANCE_NUMBER = /\b[A-CEGHJ-OPR-TW-Z]{2}(\s+|\++)?(\d{2}(\s+|\++)?){3}[A-D]\b/gi
|
|
37
37
|
|
|
38
38
|
function shouldStripDates () {
|
|
39
39
|
var metas = document.querySelectorAll('meta[name="govuk:ga4-strip-dates"]')
|
|
@@ -37,11 +37,11 @@
|
|
|
37
37
|
// If response returns active, user has subscribed to notifications
|
|
38
38
|
if (active === true) {
|
|
39
39
|
if (customText) {
|
|
40
|
-
this.$module.querySelector('.gem-c-
|
|
40
|
+
this.$module.querySelector('.gem-c-button__outline--notification').textContent = customUnsubscribeText
|
|
41
41
|
}
|
|
42
42
|
} else {
|
|
43
43
|
if (customText) {
|
|
44
|
-
this.$module.querySelector('.gem-c-
|
|
44
|
+
this.$module.querySelector('.gem-c-button__outline--notification').textContent = customSubscribeText
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
}
|
|
@@ -101,6 +101,42 @@
|
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
+
.gem-c-button__outline {
|
|
105
|
+
$gem-c-button-icon-background-width: 18px;
|
|
106
|
+
$gem-c-button-icon-background-height: 18px;
|
|
107
|
+
|
|
108
|
+
border: 1px solid govuk-colour("black", $variant: "tint-25");
|
|
109
|
+
color: govuk-functional-colour(link);
|
|
110
|
+
cursor: pointer;
|
|
111
|
+
background: no-repeat govuk-spacing(2) 50%;
|
|
112
|
+
background-size: $gem-c-button-icon-background-width $gem-c-button-icon-background-height;
|
|
113
|
+
margin: govuk-spacing(0);
|
|
114
|
+
padding: govuk-spacing(2) govuk-spacing(2) govuk-spacing(2) (govuk-spacing(4) + $gem-c-button-icon-background-width);
|
|
115
|
+
text-decoration: none;
|
|
116
|
+
box-shadow: none;
|
|
117
|
+
@include govuk-font(16);
|
|
118
|
+
|
|
119
|
+
&:hover {
|
|
120
|
+
color: govuk-colour("black");
|
|
121
|
+
background-color: govuk-colour("black", $variant: "tint-95");
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
&:focus,
|
|
125
|
+
&:active {
|
|
126
|
+
background-color: govuk-functional-colour(focus);
|
|
127
|
+
border-color: transparent;
|
|
128
|
+
@include govuk-focused-text;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.gem-c-button__outline--print {
|
|
133
|
+
background-image: url("govuk_publishing_components/icon-print.svg");
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.gem-c-button__outline--notification {
|
|
137
|
+
background-image: url("govuk_publishing_components/icon-notification.svg");
|
|
138
|
+
}
|
|
139
|
+
|
|
104
140
|
@include govuk-media-query($media-type: print) {
|
|
105
141
|
.gem-c-button {
|
|
106
142
|
@include govuk-font(16);
|
|
@@ -10,6 +10,18 @@
|
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
+
.gem-c-intervention__dismiss-link-text {
|
|
14
|
+
text-decoration: underline;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.gem-c-intervention__dismiss-link-text:hover {
|
|
18
|
+
text-decoration-thickness: max(3px, .1875rem, .12em); // Same as .govuk-link
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.gem-c-intervention__dismiss-link:focus .gem-c-intervention__dismiss-link-text, .gem-c-intervention__dismiss-link:hover {
|
|
22
|
+
text-decoration: none;
|
|
23
|
+
}
|
|
24
|
+
|
|
13
25
|
.gem-c-intervention--image {
|
|
14
26
|
border-left: 0;
|
|
15
27
|
display: flex;
|
|
@@ -14,42 +14,3 @@ $gem-c-print-link-background-height: 18px;
|
|
|
14
14
|
display: block;
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
-
|
|
18
|
-
.gem-c-print-link__link,
|
|
19
|
-
.gem-c-print-link__button {
|
|
20
|
-
background: url("govuk_publishing_components/icon-print.png") no-repeat govuk-spacing(2) 50%;
|
|
21
|
-
background-size: $gem-c-print-link-background-width $gem-c-print-link-background-height;
|
|
22
|
-
padding: govuk-spacing(2) govuk-spacing(2) govuk-spacing(2) (govuk-spacing(4) + $gem-c-print-link-background-width);
|
|
23
|
-
text-decoration: none;
|
|
24
|
-
|
|
25
|
-
@include govuk-device-pixel-ratio($ratio: 2) {
|
|
26
|
-
background-image: url("govuk_publishing_components/icon-print-2x.png");
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
&:hover {
|
|
30
|
-
background-color: govuk-colour("black", $variant: "tint-95");
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.gem-c-print-link__link {
|
|
35
|
-
box-shadow: inset 0 0 0 1px govuk-colour("black", $variant: "tint-25");
|
|
36
|
-
|
|
37
|
-
&:focus {
|
|
38
|
-
border: 0;
|
|
39
|
-
box-shadow: 0 $govuk-focus-width govuk-functional-colour(text);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.gem-c-print-link__button {
|
|
44
|
-
border: 1px solid govuk-colour("black", $variant: "tint-25");
|
|
45
|
-
color: govuk-functional-colour(link);
|
|
46
|
-
cursor: pointer;
|
|
47
|
-
margin: govuk-spacing(0);
|
|
48
|
-
@include govuk-font(16);
|
|
49
|
-
|
|
50
|
-
&:focus {
|
|
51
|
-
background-color: govuk-functional-colour(focus);
|
|
52
|
-
border-color: transparent;
|
|
53
|
-
@include govuk-focused-text;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
@@ -1,34 +1,3 @@
|
|
|
1
|
-
.gem-c-single-page-notification-button__submit {
|
|
2
|
-
padding: govuk-spacing(2);
|
|
3
|
-
margin: govuk-spacing(0);
|
|
4
|
-
border: 1px solid govuk-colour("black", $variant: "tint-25");
|
|
5
|
-
color: govuk-functional-colour(link);
|
|
6
|
-
cursor: pointer;
|
|
7
|
-
background: none;
|
|
8
|
-
@include govuk-font(16);
|
|
9
|
-
|
|
10
|
-
&:focus {
|
|
11
|
-
border-color: transparent;
|
|
12
|
-
@include govuk-focused-text;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
&:hover {
|
|
16
|
-
background-color: govuk-colour("black", $variant: "tint-95");
|
|
17
|
-
color: govuk-functional-colour(link-hover);
|
|
18
|
-
|
|
19
|
-
&:focus {
|
|
20
|
-
color: govuk-functional-colour(text);
|
|
21
|
-
box-shadow: 0 $govuk-focus-width govuk-functional-colour(text);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.gem-c-single-page-notification-button__icon {
|
|
27
|
-
color: govuk-colour("black");
|
|
28
|
-
vertical-align: top;
|
|
29
|
-
margin-right: govuk-spacing(1);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
1
|
.govuk-frontend-supported .gem-c-single-page-notification-button.js-personalisation-enhancement {
|
|
33
2
|
opacity: 0;
|
|
34
3
|
|
|
@@ -53,60 +53,6 @@
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
.gem-c-subscription-links__item--button {
|
|
57
|
-
cursor: pointer;
|
|
58
|
-
display: none;
|
|
59
|
-
padding: govuk-spacing(2);
|
|
60
|
-
border: 1px solid $gem-quiet-button-colour;
|
|
61
|
-
background-color: $gem-secondary-button-background-colour;
|
|
62
|
-
@include govuk-font(19, $weight: bold);
|
|
63
|
-
|
|
64
|
-
.govuk-frontend-supported & {
|
|
65
|
-
display: inline-block;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
&:not(.brand__color) {
|
|
69
|
-
color: govuk-functional-colour(link);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
&:hover {
|
|
73
|
-
color: govuk-functional-colour(link-hover);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
&:visited,
|
|
77
|
-
&:active,
|
|
78
|
-
&:focus {
|
|
79
|
-
text-decoration: none;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
&:focus {
|
|
83
|
-
color: govuk-functional-colour(focus-text);
|
|
84
|
-
border: 1px solid govuk-functional-colour(focus);
|
|
85
|
-
outline: 3px solid transparent;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
&:hover:not(:focus) {
|
|
89
|
-
background-color: $gem-secondary-button-hover-background-colour;
|
|
90
|
-
text-decoration: none;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
.gem-c-subscription-links__feed-box {
|
|
95
|
-
padding: govuk-spacing(3);
|
|
96
|
-
margin-bottom: govuk-spacing(3);
|
|
97
|
-
background: govuk-colour("black", $variant: "tint-95");
|
|
98
|
-
|
|
99
|
-
.govuk-frontend-supported &.js-hidden {
|
|
100
|
-
display: none;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
.gem-c-subscription-links__feed-hidden-description {
|
|
105
|
-
.govuk-frontend-supported & {
|
|
106
|
-
@include govuk-visually-hidden;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
56
|
.gem-c-subscription-links__icon {
|
|
111
57
|
margin-right: govuk-spacing(1);
|
|
112
58
|
color: govuk-colour("black");
|
|
@@ -116,14 +62,3 @@
|
|
|
116
62
|
transform: scale(.9);
|
|
117
63
|
transform-origin: bottom left;
|
|
118
64
|
}
|
|
119
|
-
|
|
120
|
-
.gem-c-subscription-links--with-feed-box {
|
|
121
|
-
.gem-c-subscription-links__item--link {
|
|
122
|
-
padding: govuk-spacing(2) govuk-spacing(2) govuk-spacing(2) 0;
|
|
123
|
-
border: 1px solid transparent;
|
|
124
|
-
|
|
125
|
-
&:focus {
|
|
126
|
-
border-bottom-color: transparent;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
module GovukPublishingComponents
|
|
2
2
|
class ComponentGuideController < GovukPublishingComponents::ApplicationController
|
|
3
3
|
append_view_path Rails.root.join("app", "views", GovukPublishingComponents::Config.component_directory_name).to_s
|
|
4
|
-
append_view_path Rails.root.join("app", "views", GovukPublishingComponents::Config.flexible_sections_directory_name).to_s
|
|
5
4
|
|
|
6
5
|
MATCH_COMPONENTS = /(?<=govuk_publishing_components\/components\/)[\/a-zA-Z_-]+(?=['"])/
|
|
7
6
|
|
|
@@ -14,45 +13,29 @@ module GovukPublishingComponents
|
|
|
14
13
|
@unused_components = unused_components_names.get_component_docs
|
|
15
14
|
@components_in_use_sass = components_in_use_sass
|
|
16
15
|
@components_in_use_js = components_in_use_js
|
|
17
|
-
@flexible_section_docs = flexible_section_docs.all
|
|
18
16
|
end
|
|
19
17
|
|
|
20
18
|
def show
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
@example_path = flexible_section_example_path(@component_doc.id, "default")
|
|
24
|
-
@preview_path = flexible_section_preview_path(@component_doc.id, "default")
|
|
25
|
-
@preview_all_path = flexible_section_preview_all_path(@component_doc.id)
|
|
26
|
-
|
|
27
|
-
@guide_breadcrumbs = [index_breadcrumb, flexible_section_breadcrumb(@component_doc)]
|
|
28
|
-
else
|
|
29
|
-
@component_doc = component_docs.get(params[:component])
|
|
30
|
-
@example_path = component_example_path(@component_doc.id, "default")
|
|
31
|
-
@preview_path = component_preview_path(@component_doc.id, "default")
|
|
32
|
-
@preview_all_path = component_preview_all_path(@component_doc.id)
|
|
33
|
-
|
|
34
|
-
@guide_breadcrumbs = [index_breadcrumb, component_breadcrumb(@component_doc)]
|
|
35
|
-
end
|
|
19
|
+
@component_doc = component_docs.get(params[:component])
|
|
20
|
+
@guide_breadcrumbs = [index_breadcrumb, component_breadcrumb(@component_doc)]
|
|
36
21
|
end
|
|
37
22
|
|
|
38
23
|
def example
|
|
39
|
-
@component_doc =
|
|
24
|
+
@component_doc = component_docs.get(params[:component])
|
|
40
25
|
@component_example = @component_doc.examples.find { |f| f.id == params[:example] }
|
|
41
26
|
|
|
42
|
-
@guide_breadcrumbs = [
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
end
|
|
50
|
-
@guide_breadcrumbs << { title: @component_example.name }
|
|
27
|
+
@guide_breadcrumbs = [
|
|
28
|
+
index_breadcrumb,
|
|
29
|
+
component_breadcrumb(@component_doc, @component_example),
|
|
30
|
+
{
|
|
31
|
+
title: @component_example.name,
|
|
32
|
+
},
|
|
33
|
+
]
|
|
51
34
|
end
|
|
52
35
|
|
|
53
36
|
def preview
|
|
54
37
|
@component_examples = []
|
|
55
|
-
@component_doc =
|
|
38
|
+
@component_doc = component_docs.get(params[:component])
|
|
56
39
|
@preview = true
|
|
57
40
|
|
|
58
41
|
if params[:example].present?
|
|
@@ -91,10 +74,6 @@ module GovukPublishingComponents
|
|
|
91
74
|
@gem_component_docs ||= ComponentDocs.new(gem_components: true)
|
|
92
75
|
end
|
|
93
76
|
|
|
94
|
-
def flexible_section_docs
|
|
95
|
-
@flexible_section_docs ||= ComponentDocs.new(flexible_sections: true)
|
|
96
|
-
end
|
|
97
|
-
|
|
98
77
|
def used_components_names
|
|
99
78
|
@used_components_names ||= ComponentDocs.new(gem_components: true, limit_to: get_used_component_names)
|
|
100
79
|
end
|
|
@@ -188,12 +167,5 @@ module GovukPublishingComponents
|
|
|
188
167
|
h[:url] = component_doc_path(component_doc.id) if component_example
|
|
189
168
|
end
|
|
190
169
|
end
|
|
191
|
-
|
|
192
|
-
def flexible_section_breadcrumb(component_doc, component_example = nil)
|
|
193
|
-
{}.tap do |h|
|
|
194
|
-
h[:title] = "#{component_doc.name} (flexible section)"
|
|
195
|
-
h[:url] = flexible_section_doc_path(component_doc.id) if component_example
|
|
196
|
-
end
|
|
197
|
-
end
|
|
198
170
|
end
|
|
199
171
|
end
|
|
@@ -7,10 +7,9 @@ module GovukPublishingComponents
|
|
|
7
7
|
:component,
|
|
8
8
|
:accessibility_excluded_rules,
|
|
9
9
|
:source,
|
|
10
|
-
:embed
|
|
11
|
-
:type
|
|
10
|
+
:embed
|
|
12
11
|
|
|
13
|
-
def initialize(component
|
|
12
|
+
def initialize(component)
|
|
14
13
|
@component = component
|
|
15
14
|
@id = component[:id]
|
|
16
15
|
@name = component[:name]
|
|
@@ -19,7 +18,6 @@ module GovukPublishingComponents
|
|
|
19
18
|
@accessibility_excluded_rules = component[:accessibility_excluded_rules]
|
|
20
19
|
@source = component[:source]
|
|
21
20
|
@embed = component[:embed]
|
|
22
|
-
@type = type
|
|
23
21
|
end
|
|
24
22
|
|
|
25
23
|
def accessibility_criteria
|
|
@@ -90,8 +88,6 @@ module GovukPublishingComponents
|
|
|
90
88
|
def partial_path
|
|
91
89
|
if source == "gem"
|
|
92
90
|
"govuk_publishing_components/components/#{id}"
|
|
93
|
-
elsif type == "flexible section"
|
|
94
|
-
"#{GovukPublishingComponents::Config.flexible_sections_directory_name}/#{id}"
|
|
95
91
|
else
|
|
96
92
|
"#{GovukPublishingComponents::Config.component_directory_name}/#{id}"
|
|
97
93
|
end
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
module GovukPublishingComponents
|
|
2
2
|
# @private
|
|
3
3
|
class ComponentDocs
|
|
4
|
-
def initialize(gem_components: false, limit_to: false
|
|
4
|
+
def initialize(gem_components: false, limit_to: false)
|
|
5
5
|
@limit_to = limit_to
|
|
6
6
|
@documentation_directory = gem_components ? gem_documentation_directory : app_documentation_directory
|
|
7
|
-
@documentation_directory = flexible_sections_documentation_directory if flexible_sections
|
|
8
|
-
@type = flexible_sections ? "flexible section" : "component"
|
|
9
7
|
end
|
|
10
8
|
|
|
11
9
|
def get(id)
|
|
@@ -24,7 +22,7 @@ module GovukPublishingComponents
|
|
|
24
22
|
private
|
|
25
23
|
|
|
26
24
|
def build(component)
|
|
27
|
-
ComponentDoc.new(component
|
|
25
|
+
ComponentDoc.new(component)
|
|
28
26
|
end
|
|
29
27
|
|
|
30
28
|
def fetch_component_doc_files
|
|
@@ -58,9 +56,5 @@ module GovukPublishingComponents
|
|
|
58
56
|
def gem_documentation_directory
|
|
59
57
|
Pathname.new(GovukPublishingComponents::Config.gem_directory).join("app", "views", "govuk_publishing_components", "components", "docs")
|
|
60
58
|
end
|
|
61
|
-
|
|
62
|
-
def flexible_sections_documentation_directory
|
|
63
|
-
Rails.root.join("app", "views", GovukPublishingComponents::Config.flexible_sections_directory_name, "docs")
|
|
64
|
-
end
|
|
65
59
|
end
|
|
66
60
|
end
|
|
@@ -5,11 +5,7 @@
|
|
|
5
5
|
<ul class="govuk-list govuk-list--bullet govuk-list--spaced">
|
|
6
6
|
<% local_assigns[:components].each do |component_doc| %>
|
|
7
7
|
<li data-filter-item data-filter-item-search-terms="<%= component_doc.id %>">
|
|
8
|
-
|
|
9
|
-
<%= link_to component_doc.name, flexible_section_doc_path(component_doc.id), class: "govuk-link" %>
|
|
10
|
-
<% else %>
|
|
11
|
-
<%= link_to component_doc.name, component_doc_path(component_doc.id), class: "govuk-link" %>
|
|
12
|
-
<% end %>
|
|
8
|
+
<%= link_to component_doc.name, component_doc_path(component_doc.id), class: "govuk-link" %>
|
|
13
9
|
<p class="govuk-body">
|
|
14
10
|
<%= component_doc.description %>
|
|
15
11
|
</p>
|
data/app/views/govuk_publishing_components/component_guide/component_doc/_component_output.html.erb
CHANGED
|
@@ -1,19 +1,11 @@
|
|
|
1
1
|
<% content_for :body_classes, "gem-full-width__container", flush: true %>
|
|
2
|
-
<%
|
|
3
|
-
if @component_doc.type == "component"
|
|
4
|
-
data = example.html_safe_data
|
|
5
|
-
else
|
|
6
|
-
flexible_section_class = "FlexiblePage::FlexibleSection::#{@component_doc.id.titleize.gsub(" ", "")}".constantize
|
|
7
|
-
data = { flexible_section: flexible_section_class.new(**example.html_safe_data.deep_symbolize_keys)}
|
|
8
|
-
end
|
|
9
|
-
%>
|
|
10
2
|
<% component = capture do %>
|
|
11
3
|
<% if example.has_block? %>
|
|
12
|
-
<%= render component_doc.partial_path,
|
|
4
|
+
<%= render component_doc.partial_path, example.html_safe_data do %>
|
|
13
5
|
<%= render inline: example.block %>
|
|
14
6
|
<% end %>
|
|
15
7
|
<% else %>
|
|
16
|
-
<%= render component_doc.partial_path,
|
|
8
|
+
<%= render component_doc.partial_path, example.html_safe_data %>
|
|
17
9
|
<% end %>
|
|
18
10
|
<% end %>
|
|
19
11
|
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
</div>
|
|
25
25
|
<h2 class="govuk-heading-m">
|
|
26
26
|
How it looks
|
|
27
|
-
<small class="govuk-!-font-size-16">(<a href="<%= @
|
|
27
|
+
<small class="govuk-!-font-size-16">(<a href="<%= component_preview_path(@component_doc.id, @component_example.id) %>" class="govuk-link">preview</a>)</small>
|
|
28
28
|
</h2>
|
|
29
29
|
<%= render partial: "govuk_publishing_components/component_guide/component_doc/preview", locals: { component_doc: @component_doc, example: @component_example } %>
|
|
30
30
|
|
|
@@ -18,13 +18,6 @@
|
|
|
18
18
|
|
|
19
19
|
<div data-module="filter-list" data-filter-label="Search components">
|
|
20
20
|
<% if !ENV["MAIN_COMPONENT_GUIDE"] %>
|
|
21
|
-
<%= render partial: "component_list", locals: {
|
|
22
|
-
heading: "Flexible sections in this application",
|
|
23
|
-
size: @flexible_section_docs.length,
|
|
24
|
-
components: @flexible_section_docs,
|
|
25
|
-
type: "flexible_section",
|
|
26
|
-
} %>
|
|
27
|
-
|
|
28
21
|
<%= render partial: "component_list", locals: {
|
|
29
22
|
heading: "Components in this application",
|
|
30
23
|
size: @component_docs.length,
|
|
@@ -5,17 +5,9 @@
|
|
|
5
5
|
<% end %>
|
|
6
6
|
|
|
7
7
|
<% @component_examples.each do |example| %>
|
|
8
|
-
<%
|
|
9
|
-
if @component_doc.type == "component"
|
|
10
|
-
example_path = component_example_path(@component_doc.id, example.id)
|
|
11
|
-
else
|
|
12
|
-
example_path = flexible_section_example_path(@component_doc.id, example.id)
|
|
13
|
-
end
|
|
14
|
-
%>
|
|
15
|
-
|
|
16
8
|
<div class="component-guide-preview-page">
|
|
17
9
|
<% if @component_examples.length > 1 %>
|
|
18
|
-
<h2 class="preview-title"><a href="<%=
|
|
10
|
+
<h2 class="preview-title"><a href="<%= component_example_path(@component_doc.id, example.id) %>"><%= example.name %></a></h2>
|
|
19
11
|
<% end %>
|
|
20
12
|
<div data-module="test-a11y" data-excluded-rules="<%= @component_doc.accessibility_excluded_rules %>">
|
|
21
13
|
<%= render "govuk_publishing_components/component_guide/component_doc/component", component_doc: @component_doc, example: example, preview_page: true %>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<% content_for :title, "#{@component_doc.name}
|
|
1
|
+
<% content_for :title, "#{@component_doc.name} component" %>
|
|
2
2
|
|
|
3
3
|
<% content_for :application_stylesheet do %>
|
|
4
4
|
<% if @component_doc.source == "application" %>
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
<%= render "govuk_publishing_components/components/heading", {
|
|
10
10
|
text: @component_doc.name,
|
|
11
|
-
context:
|
|
11
|
+
context: "Component",
|
|
12
12
|
heading_level: 1,
|
|
13
13
|
font_size: "xl",
|
|
14
14
|
margin_bottom: 8,
|
|
@@ -31,9 +31,7 @@
|
|
|
31
31
|
</div>
|
|
32
32
|
</div>
|
|
33
33
|
<% end %>
|
|
34
|
-
|
|
35
|
-
<p class="govuk-body"><%= link_to "Search for usage of this component on GitHub", @component_doc.github_search_url, class: "govuk-link" %>.</p>
|
|
36
|
-
<% end %>
|
|
34
|
+
<p class="govuk-body"><%= link_to "Search for usage of this component on GitHub", @component_doc.github_search_url, class: "govuk-link" %>.</p>
|
|
37
35
|
</div>
|
|
38
36
|
</div>
|
|
39
37
|
|
|
@@ -56,7 +54,7 @@
|
|
|
56
54
|
text: "Overview",
|
|
57
55
|
items: [
|
|
58
56
|
({ href: "#how-it-looks", text: "How it looks" } if @component_doc.display_preview? || @component_doc.display_html?),
|
|
59
|
-
{ href: "#how-to-call-this-component", text:
|
|
57
|
+
{ href: "#how-to-call-this-component", text: "How to call this component" },
|
|
60
58
|
({ href: "#govuk-design-system", text: "GOV.UK Design System" } if @component_doc.govuk_frontend_components.any?),
|
|
61
59
|
({ href: "#accessibility-acceptance-criteria", text: "Accessibility acceptance criteria" } if @component_doc.accessibility_criteria.present?),
|
|
62
60
|
].compact,
|
|
@@ -77,21 +75,14 @@
|
|
|
77
75
|
<h2 class="govuk-heading-l" id="overview">Overview</h2>
|
|
78
76
|
<% if @component_doc.display_preview? || @component_doc.display_html? %>
|
|
79
77
|
<h3 class="govuk-heading-m" id="how-it-looks">
|
|
80
|
-
<a href="<%= @
|
|
81
|
-
<small class="govuk-!-font-size-16">(<a href="<%= @
|
|
82
|
-
<small class="govuk-!-font-size-16">(<a href="<%= @
|
|
78
|
+
<a href="<%= component_example_path(@component_doc.id, "default") %>" class="govuk-link">How it looks</a>
|
|
79
|
+
<small class="govuk-!-font-size-16">(<a href="<%= component_preview_path(@component_doc.id, "default") %>" class="govuk-link">preview</a>)</small>
|
|
80
|
+
<small class="govuk-!-font-size-16">(<a href="<%= component_preview_all_path(@component_doc.id) %>" class="govuk-link">preview all</a>)</small>
|
|
83
81
|
</h3>
|
|
84
82
|
<%= render "govuk_publishing_components/component_guide/component_doc/preview", component_doc: @component_doc, example: @component_doc.example %>
|
|
85
83
|
<% end %>
|
|
86
84
|
|
|
87
|
-
|
|
88
|
-
<h3 class="govuk-heading-m govuk-!-margin-top-4" id="how-to-call-this-component">How to call this component</h3>
|
|
89
|
-
<% else %>
|
|
90
|
-
<h3 class="govuk-heading-m govuk-!-margin-top-4" id="how-to-call-this-component">Passing data to this flexible section</h3>
|
|
91
|
-
<div class="component-markdown component-markdown--no-margin">
|
|
92
|
-
<p>Flexible sections are not called in the way shown below, however this information serves as a reference for the data required by this flexible section.</p>
|
|
93
|
-
</div>
|
|
94
|
-
<% end %>
|
|
85
|
+
<h3 class="govuk-heading-m govuk-!-margin-top-4" id="how-to-call-this-component">How to call this component</h3>
|
|
95
86
|
<%= render "govuk_publishing_components/component_guide/component_doc/call", component_doc: @component_doc, example: @component_doc.example %>
|
|
96
87
|
|
|
97
88
|
<% if @component_doc.govuk_frontend_components.any? %>
|
|
@@ -139,17 +130,8 @@
|
|
|
139
130
|
<% @component_doc.other_examples.each do |example| %>
|
|
140
131
|
<div class="component-example" id="<%= example.id %>">
|
|
141
132
|
<h3 class="govuk-heading-m">
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
example_path = component_example_path(@component_doc.id, example.id)
|
|
145
|
-
preview_path = component_preview_path(@component_doc.id, example.id)
|
|
146
|
-
else
|
|
147
|
-
example_path = flexible_section_example_path(@component_doc.id, example.id)
|
|
148
|
-
preview_path = flexible_section_preview_path(@component_doc.id, example.id)
|
|
149
|
-
end
|
|
150
|
-
%>
|
|
151
|
-
<a href="<%= example_path %>" class="govuk-link"><%= example.name %></a>
|
|
152
|
-
<small>(<a href="<%= preview_path %>" class="govuk-link">preview</a>)</small>
|
|
133
|
+
<a href="<%= component_example_path(@component_doc.id, example.id) %>" class="govuk-link"><%= example.name %></a>
|
|
134
|
+
<small>(<a href="<%= component_preview_path(@component_doc.id, example.id) %>" class="govuk-link">preview</a>)</small>
|
|
153
135
|
</h3>
|
|
154
136
|
<% if example.html_description %>
|
|
155
137
|
<div class="component-markdown component-markdown--no-margin">
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
|
|
71
71
|
<% if dismiss_text %>
|
|
72
72
|
<%= tag.p class: "govuk-body govuk-!-display-none-print", data: dismiss_data_attributes do %>
|
|
73
|
-
<%= tag.a class: "govuk-link js-dismiss-link", href: dismiss_href, data: dismiss_link_data_attributes do %>
|
|
73
|
+
<%= tag.a class: "govuk-link govuk-link--no-underline gem-c-intervention__dismiss-link js-dismiss-link", href: dismiss_href, data: dismiss_link_data_attributes do %>
|
|
74
74
|
<svg class="gem-c-intervention__dismiss-icon"
|
|
75
75
|
width="19" height="19" viewBox="0 0 19 19"
|
|
76
76
|
aria-hidden="true"
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
<path d="M13.3477 5.4209L9.67383 9.09473L6 5.4209" />
|
|
80
80
|
<path d="M6 13.4209L9.67383 9.74707L13.3477 13.4209" />
|
|
81
81
|
</svg>
|
|
82
|
-
|
|
82
|
+
<span class="gem-c-intervention__dismiss-link-text"><%= dismiss_text %></span>
|
|
83
83
|
<% end %>
|
|
84
84
|
<% end %>
|
|
85
85
|
<% end %>
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
page_history ||= []
|
|
11
11
|
page_history = Array(page_history)
|
|
12
|
+
page_history_details_ga4 ||= {}
|
|
12
13
|
|
|
13
14
|
history ||= nil
|
|
14
15
|
first_published ||= nil
|
|
@@ -89,6 +90,8 @@
|
|
|
89
90
|
title: t("components.metadata.show_all_updates", locale: :en),
|
|
90
91
|
small: true,
|
|
91
92
|
inverse: inverse,
|
|
93
|
+
ga4_attributes: page_history_details_ga4,
|
|
94
|
+
disable_ga4: disable_ga4,
|
|
92
95
|
} do %>
|
|
93
96
|
<ol class="gem-c-metadata__change-history">
|
|
94
97
|
<% page_history.each do |change| %>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
text ||= t("components.print_link.text")
|
|
3
3
|
href ||= nil
|
|
4
4
|
child_data_attributes ||= {}
|
|
5
|
-
require_js
|
|
5
|
+
require_js = href.nil?
|
|
6
6
|
local_assigns[:margin_bottom] ||= 3
|
|
7
7
|
|
|
8
8
|
((child_data_attributes[:module] ||= "") << " " << (require_js ? "print-link" : "button")).strip!
|
|
@@ -16,19 +16,13 @@
|
|
|
16
16
|
component_helper.add_class("gem-c-print-link--show-without-js") unless require_js
|
|
17
17
|
%>
|
|
18
18
|
<%= tag.div(**component_helper.all_attributes) do %>
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
class: child_classes,
|
|
29
|
-
rel: "alternate",
|
|
30
|
-
data: child_data_attributes,
|
|
31
|
-
role: "button",
|
|
32
|
-
) %>
|
|
33
|
-
<% end %>
|
|
19
|
+
<%= render "govuk_publishing_components/components/button", {
|
|
20
|
+
text: text,
|
|
21
|
+
href: href,
|
|
22
|
+
type: "button",
|
|
23
|
+
print_button: true,
|
|
24
|
+
data_attributes: child_data_attributes,
|
|
25
|
+
rel: "alternate",
|
|
26
|
+
margin_bottom: 0,
|
|
27
|
+
} %>
|
|
34
28
|
<% end %>
|
data/app/views/govuk_publishing_components/components/_single_page_notification_button.html.erb
CHANGED
|
@@ -18,9 +18,6 @@
|
|
|
18
18
|
component_helper.add_class("govuk-!-display-none-print")
|
|
19
19
|
component_helper.add_data_attribute({ module: ga4_data_attributes[:module] }) if ga4_data_attributes
|
|
20
20
|
%>
|
|
21
|
-
<% button_text = capture do %>
|
|
22
|
-
<svg class="gem-c-single-page-notification-button__icon" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" height="18" width="18" viewBox="0 0 459.334 459.334"><path fill="currentColor" d="M177.216 404.514c-.001.12-.009.239-.009.359 0 30.078 24.383 54.461 54.461 54.461s54.461-24.383 54.461-54.461c0-.12-.008-.239-.009-.359H175.216zM403.549 336.438l-49.015-72.002v-89.83c0-60.581-43.144-111.079-100.381-122.459V24.485C254.152 10.963 243.19 0 229.667 0s-24.485 10.963-24.485 24.485v27.663c-57.237 11.381-100.381 61.879-100.381 122.459v89.83l-49.015 72.002a24.76 24.76 0 0 0 20.468 38.693H383.08a24.761 24.761 0 0 0 20.469-38.694z" /></svg><span class="gem-c-single-page-notication-button__text"><%= spnb_helper.button_text %></span>
|
|
23
|
-
<% end %>
|
|
24
21
|
<%= tag.div(**component_helper.all_attributes) do %>
|
|
25
22
|
<%= tag.form action: spnb_helper.form_action, method: "POST" do %>
|
|
26
23
|
<input type="hidden" name="base_path" value="<%= spnb_helper.base_path %>">
|
|
@@ -28,12 +25,12 @@
|
|
|
28
25
|
<input type="hidden" name="<%= spnb_helper.skip_account_param %>" value="true">
|
|
29
26
|
<input type="hidden" name="link" value="<%= spnb_helper.base_path %>">
|
|
30
27
|
<% end %>
|
|
31
|
-
<%=
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
<%= render "govuk_publishing_components/components/button", {
|
|
29
|
+
text: spnb_helper.button_text,
|
|
30
|
+
notification_button: true,
|
|
31
|
+
data_attributes: {
|
|
35
32
|
ga4_link: ga4_link_data_attributes,
|
|
36
33
|
},
|
|
37
|
-
}
|
|
34
|
+
} %>
|
|
38
35
|
<% end %>
|
|
39
36
|
<% end if spnb_helper.base_path %>
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
<%
|
|
2
|
-
brand ||= false
|
|
3
|
-
brand_helper = GovukPublishingComponents::AppHelpers::BrandHelper.new(brand)
|
|
4
|
-
|
|
5
2
|
sl_helper = GovukPublishingComponents::Presenters::SubscriptionLinksHelper.new(local_assigns)
|
|
6
3
|
|
|
7
4
|
component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
|
|
8
|
-
component_helper.add_class("gem-c-subscription-links govuk-!-display-none-print
|
|
9
|
-
component_helper.add_class("gem-c-subscription-links--with-feed-box") if sl_helper.feed_link_box_value
|
|
10
|
-
component_helper.add_data_attribute({ module: "gem-toggle" }) if sl_helper.feed_link_box_value
|
|
5
|
+
component_helper.add_class("gem-c-subscription-links govuk-!-display-none-print")
|
|
11
6
|
|
|
12
7
|
hide_heading ||= false
|
|
13
8
|
|
|
@@ -27,46 +22,26 @@
|
|
|
27
22
|
</svg><%= sl_helper.email_signup_link_text %>
|
|
28
23
|
<% end %>
|
|
29
24
|
<%= link_to email_link_text, sl_helper.email_signup_link, {
|
|
30
|
-
class: "govuk-link gem-c-subscription-links__item
|
|
25
|
+
class: "govuk-link gem-c-subscription-links__item gem-c-subscription-links__item--link",
|
|
31
26
|
data: sl_helper.email_signup_link_data_attributes,
|
|
32
27
|
lang: email_signup_link_text_locale,
|
|
33
28
|
} %>
|
|
34
29
|
</li>
|
|
35
30
|
<% end %>
|
|
36
31
|
|
|
37
|
-
<% if sl_helper.
|
|
32
|
+
<% if sl_helper.feed_link %>
|
|
38
33
|
<li class="gem-c-subscription-links__list-item<%= " gem-c-subscription-links__list-item--small" if local_assigns[:small_form] == true %>">
|
|
39
34
|
<% feed_link_text = capture do %>
|
|
40
35
|
<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" class="gem-c-subscription-links__icon" focusable="false" fill="currentColor" aria-hidden="true"><path d="M1.996 11A2 2 0 0 0 0 12.993c0 1.101.895 1.99 1.996 1.99 1.106 0 2-.889 2-1.99a2 2 0 0 0-2-1.993zM.002 5.097V7.97c1.872 0 3.632.733 4.958 2.059A6.984 6.984 0 0 1 7.015 15h2.888c0-5.461-4.443-9.903-9.9-9.903zM.006 0v2.876c6.676 0 12.11 5.44 12.11 12.124H15C15 6.731 8.273 0 .006 0z" />
|
|
41
36
|
</svg><%= sl_helper.feed_link_text %>
|
|
42
37
|
<% end %>
|
|
43
|
-
<%= tag.button(feed_link_text,
|
|
44
|
-
class: "govuk-link govuk-link--no-underline gem-c-subscription-links__item #{brand_helper.color_class} gem-c-subscription-links__item--button",
|
|
45
|
-
data: sl_helper.feed_link_data_attributes,
|
|
46
|
-
lang: feed_link_text_locale,
|
|
47
|
-
) if sl_helper.feed_link_box_value %>
|
|
48
38
|
<%= link_to(feed_link_text, sl_helper.feed_link,
|
|
49
|
-
class: "govuk-link gem-c-subscription-links__item
|
|
39
|
+
class: "govuk-link gem-c-subscription-links__item gem-c-subscription-links__item--link",
|
|
50
40
|
data: sl_helper.feed_link_data_attributes,
|
|
51
41
|
lang: feed_link_text_locale
|
|
52
|
-
)
|
|
42
|
+
) %>
|
|
53
43
|
</li>
|
|
54
44
|
<% end %>
|
|
55
45
|
</ul>
|
|
56
|
-
|
|
57
|
-
<% if sl_helper.feed_link_box_value %>
|
|
58
|
-
<div class="gem-c-subscription-links__feed-box js-hidden" id="<%= sl_helper.feed_box_id %>">
|
|
59
|
-
<h3 class="gem-c-subscription-links__feed-hidden-description visuallyhidden govuk-!-margin-top-0"><%= sl_helper.feed_link_text %></h3>
|
|
60
|
-
<div lang="en">
|
|
61
|
-
<%= render "govuk_publishing_components/components/input", {
|
|
62
|
-
label: {
|
|
63
|
-
text: t("components.subscription_links.feed_link_label"),
|
|
64
|
-
},
|
|
65
|
-
name: "feed-reader-box",
|
|
66
|
-
value: feed_link_box_value,
|
|
67
|
-
} %>
|
|
68
|
-
</div>
|
|
69
|
-
</div>
|
|
70
|
-
<% end %>
|
|
71
46
|
<% end %>
|
|
72
47
|
<% end %>
|
|
@@ -64,6 +64,14 @@ examples:
|
|
|
64
64
|
data:
|
|
65
65
|
text: Secondary solid button
|
|
66
66
|
secondary_solid: true
|
|
67
|
+
print_button:
|
|
68
|
+
data:
|
|
69
|
+
text: Print this page
|
|
70
|
+
print_button: true
|
|
71
|
+
notification_button:
|
|
72
|
+
data:
|
|
73
|
+
text: Get emails about this page
|
|
74
|
+
notification_button: true
|
|
67
75
|
destructive_button:
|
|
68
76
|
data:
|
|
69
77
|
text: Destructive button
|
|
@@ -42,6 +42,8 @@ examples:
|
|
|
42
42
|
This will set up an expandable section on the page, with a top border, to let users toggle the display of the page history. It also includes a hidden H2 heading of 'Updates to this page'. This heading will not be included if one is passed to the component using the `title` option.
|
|
43
43
|
|
|
44
44
|
This example includes an expandable 'part of' section to show both toggling elements working together in one component instance.
|
|
45
|
+
|
|
46
|
+
GA4 attributes can also be passed to the 'Show all updates' details component to override the default tracking attributes on that component using `page_history_details_ga4`.
|
|
45
47
|
data:
|
|
46
48
|
border_top: true
|
|
47
49
|
part_of:
|
|
@@ -68,6 +70,8 @@ examples:
|
|
|
68
70
|
- display_time: 14th October 2000
|
|
69
71
|
note: Updated information on pupil premium reviews and what information schools need to publish on their websites.
|
|
70
72
|
timestamp: 2000-10-14T15:42:37.000+00:00
|
|
73
|
+
page_history_details_ga4:
|
|
74
|
+
section: Footer
|
|
71
75
|
extensive:
|
|
72
76
|
data:
|
|
73
77
|
from:
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
name: Service Navigation
|
|
2
|
-
description:
|
|
2
|
+
description: Helps users understand that they're using your service and lets them navigate around your service.
|
|
3
3
|
accessibility_criteria: |
|
|
4
4
|
- the component must use the correct heading level for the page
|
|
5
5
|
- text should have a text contrast ratio higher than 4.5:1 against the background colour to meet WCAG AA
|
|
6
|
-
- the icon must not be focusable or shown to screenreaders
|
|
7
6
|
accessibility_excluded_rules:
|
|
8
7
|
- landmark-unique
|
|
9
8
|
uses_component_wrapper_helper: true
|
|
@@ -32,20 +32,6 @@ examples:
|
|
|
32
32
|
email_signup_link_text: 'Get notifications'
|
|
33
33
|
feed_link: '/foreign-travel-advice/singapore.atom'
|
|
34
34
|
feed_link_text: 'View feed'
|
|
35
|
-
with_copyable_feed_link:
|
|
36
|
-
description: |
|
|
37
|
-
This option changes the feed link to a toggle control, which opens a hidden element containing an input prepopulated with the value passed to the component, usually a URL to an atom feed. This uses the [form input](/component-guide/input) component.
|
|
38
|
-
|
|
39
|
-
Note that this option overrides the feed_link option, so if both are passed feed_link is ignored. Note that a value for email_signup_link can also be passed as normal.
|
|
40
|
-
data:
|
|
41
|
-
email_signup_link: '/foreign-travel-advice/singapore/email-signup'
|
|
42
|
-
feed_link_box_value: 'https://www.gov.uk/government/organisations/attorney-generals-office.atom'
|
|
43
|
-
with_number_10_branding:
|
|
44
|
-
description: Organisation [colour branding](https://github.com/alphagov/govuk_publishing_components/blob/main/docs/component_branding.md) can be added to the component as shown.
|
|
45
|
-
data:
|
|
46
|
-
brand: 'prime-ministers-office-10-downing-street'
|
|
47
|
-
email_signup_link: '/foreign-travel-advice/singapore/email-signup'
|
|
48
|
-
feed_link: '/foreign-travel-advice/singapore.atom'
|
|
49
35
|
with_data_attributes_on_links:
|
|
50
36
|
description: Data attributes can be passed for each link as shown.
|
|
51
37
|
data:
|
|
@@ -53,9 +39,9 @@ examples:
|
|
|
53
39
|
email_signup_link_data_attributes: {
|
|
54
40
|
an_attribute: some_value
|
|
55
41
|
}
|
|
56
|
-
|
|
42
|
+
feed_link: '/foreign-travel-advice/singapore.atom'
|
|
57
43
|
feed_link_data_attributes: {
|
|
58
|
-
an_attribute:
|
|
44
|
+
an_attribute: some_other_value
|
|
59
45
|
}
|
|
60
46
|
as_small_form:
|
|
61
47
|
data:
|
data/config/routes.rb
CHANGED
|
@@ -2,13 +2,6 @@ GovukPublishingComponents::Engine.routes.draw do
|
|
|
2
2
|
get "/audit" => "audit#show", as: :audit
|
|
3
3
|
get "/applications" => "applications_page#show", as: :apps
|
|
4
4
|
|
|
5
|
-
scope "/flexible-sections/" do
|
|
6
|
-
get ":flexible_section" => "component_guide#show", as: :flexible_section_doc
|
|
7
|
-
get ":flexible_section/preview" => "component_guide#preview", as: :flexible_section_preview_all
|
|
8
|
-
get ":flexible_section/:example" => "component_guide#example", as: :flexible_section_example
|
|
9
|
-
get ":flexible_section/:example/preview" => "component_guide#preview", as: :flexible_section_preview
|
|
10
|
-
end
|
|
11
|
-
|
|
12
5
|
root to: "component_guide#index", as: :component_guide
|
|
13
6
|
get ":component" => "component_guide#show", as: :component_doc
|
|
14
7
|
get ":component/preview" => "component_guide#preview", as: :component_preview_all
|
|
@@ -25,10 +25,6 @@ module GovukPublishingComponents
|
|
|
25
25
|
APP_COMPONENT_DIRECTORY
|
|
26
26
|
end
|
|
27
27
|
|
|
28
|
-
def self.flexible_sections_directory_name
|
|
29
|
-
"flexible_page/flexible_sections"
|
|
30
|
-
end
|
|
31
|
-
|
|
32
28
|
def self.gem_directory
|
|
33
29
|
Gem::Specification.find_by_name("govuk_publishing_components").gem_dir
|
|
34
30
|
end
|
|
@@ -19,6 +19,8 @@ module GovukPublishingComponents
|
|
|
19
19
|
:secondary,
|
|
20
20
|
:secondary_quiet,
|
|
21
21
|
:secondary_solid,
|
|
22
|
+
:print_button,
|
|
23
|
+
:notification_button,
|
|
22
24
|
:destructive,
|
|
23
25
|
:name,
|
|
24
26
|
:value,
|
|
@@ -51,6 +53,8 @@ module GovukPublishingComponents
|
|
|
51
53
|
@secondary = local_assigns[:secondary]
|
|
52
54
|
@secondary_quiet = local_assigns[:secondary_quiet]
|
|
53
55
|
@secondary_solid = local_assigns[:secondary_solid]
|
|
56
|
+
@print_button = local_assigns[:print_button]
|
|
57
|
+
@notification_button = local_assigns[:notification_button]
|
|
54
58
|
@destructive = local_assigns[:destructive]
|
|
55
59
|
@name = local_assigns[:name]
|
|
56
60
|
@value = local_assigns[:value]
|
|
@@ -125,6 +129,10 @@ module GovukPublishingComponents
|
|
|
125
129
|
css_classes << "gem-c-button--secondary-quiet" if secondary_quiet
|
|
126
130
|
css_classes << "govuk-button--secondary" if secondary_solid
|
|
127
131
|
css_classes << "govuk-button--warning" if destructive
|
|
132
|
+
|
|
133
|
+
css_classes = %w[gem-c-button__outline gem-c-button__outline--print] if print_button
|
|
134
|
+
css_classes = %w[gem-c-button__outline gem-c-button__outline--notification] if notification_button
|
|
135
|
+
|
|
128
136
|
if margin_bottom && !info_text
|
|
129
137
|
margin_class = get_margin_bottom(margin_bottom, false)
|
|
130
138
|
css_classes << margin_class
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
module GovukPublishingComponents
|
|
2
2
|
module Presenters
|
|
3
3
|
class SubscriptionLinksHelper
|
|
4
|
-
attr_reader :
|
|
4
|
+
attr_reader :email_signup_link, :email_signup_link_data_attributes
|
|
5
5
|
|
|
6
6
|
def initialize(local_assigns)
|
|
7
7
|
@local_assigns = local_assigns
|
|
8
|
-
@feed_box_id = "feed-reader-#{SecureRandom.hex(2)}"
|
|
9
8
|
@email_signup_link = @local_assigns[:email_signup_link]
|
|
10
9
|
@email_signup_link_data_attributes = @local_assigns[:email_signup_link_data_attributes]
|
|
11
|
-
@feed_link_box_value = @local_assigns[:feed_link_box_value]
|
|
12
10
|
end
|
|
13
11
|
|
|
14
12
|
def email_signup_link_text
|
|
@@ -24,7 +22,7 @@ module GovukPublishingComponents
|
|
|
24
22
|
end
|
|
25
23
|
|
|
26
24
|
def component_data_is_valid?
|
|
27
|
-
email_signup_link.present? || feed_link.present?
|
|
25
|
+
email_signup_link.present? || feed_link.present?
|
|
28
26
|
end
|
|
29
27
|
|
|
30
28
|
def tracking_is_present?
|
|
@@ -32,16 +30,11 @@ module GovukPublishingComponents
|
|
|
32
30
|
end
|
|
33
31
|
|
|
34
32
|
def feed_link
|
|
35
|
-
return "#" if feed_link_box_value
|
|
36
|
-
|
|
37
33
|
@local_assigns[:feed_link]
|
|
38
34
|
end
|
|
39
35
|
|
|
40
36
|
def feed_link_data_attributes
|
|
41
|
-
|
|
42
|
-
data[:controls] = feed_box_id if feed_link_box_value
|
|
43
|
-
data[:expanded] = "false" if feed_link_box_value
|
|
44
|
-
data
|
|
37
|
+
@local_assigns[:feed_link_data_attributes] || {}
|
|
45
38
|
end
|
|
46
39
|
end
|
|
47
40
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: govuk_publishing_components
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 70.1
|
|
4
|
+
version: 70.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- GOV.UK Dev
|
|
@@ -456,8 +456,8 @@ files:
|
|
|
456
456
|
- app/assets/images/govuk_publishing_components/icon-close.svg
|
|
457
457
|
- app/assets/images/govuk_publishing_components/icon-file-download.svg
|
|
458
458
|
- app/assets/images/govuk_publishing_components/icon-important.svg
|
|
459
|
-
- app/assets/images/govuk_publishing_components/icon-
|
|
460
|
-
- app/assets/images/govuk_publishing_components/icon-print.
|
|
459
|
+
- app/assets/images/govuk_publishing_components/icon-notification.svg
|
|
460
|
+
- app/assets/images/govuk_publishing_components/icon-print.svg
|
|
461
461
|
- app/assets/images/govuk_publishing_components/icon-search.svg
|
|
462
462
|
- app/assets/images/govuk_publishing_components/image-card-srcset/cop26-170.jpg
|
|
463
463
|
- app/assets/images/govuk_publishing_components/image-card-srcset/cop26-240.jpg
|
|
@@ -2117,7 +2117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
2117
2117
|
- !ruby/object:Gem::Version
|
|
2118
2118
|
version: '0'
|
|
2119
2119
|
requirements: []
|
|
2120
|
-
rubygems_version: 4.0.
|
|
2120
|
+
rubygems_version: 4.0.22
|
|
2121
2121
|
specification_version: 4
|
|
2122
2122
|
summary: A gem to document components in GOV.UK frontend applications
|
|
2123
2123
|
test_files: []
|
|
Binary file
|
|
Binary file
|