govuk_publishing_components 30.2.1 → 30.4.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/page-content.js +8 -0
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-link-tracker.js +23 -5
- data/app/assets/javascripts/govuk_publishing_components/components/checkboxes.js +0 -22
- data/app/assets/stylesheets/component_guide/application.scss +4 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_layout-footer.scss +7 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_layout-super-navigation-header.scss +60 -11
- data/app/views/govuk_publishing_components/component_guide/show.html.erb +26 -2
- data/app/views/govuk_publishing_components/components/_checkboxes.html.erb +2 -3
- data/app/views/govuk_publishing_components/components/_layout_super_navigation_header.html.erb +6 -2
- data/app/views/govuk_publishing_components/components/docs/textarea.yml +7 -0
- data/config/locales/en.yml +4 -0
- data/lib/govuk_publishing_components/presenters/checkboxes_helper.rb +2 -4
- data/lib/govuk_publishing_components/version.rb +1 -1
- data/node_modules/sortablejs/README.md +828 -815
- data/node_modules/sortablejs/Sortable.js +186 -113
- data/node_modules/sortablejs/Sortable.min.js +2 -2
- data/node_modules/sortablejs/modular/sortable.complete.esm.js +184 -111
- data/node_modules/sortablejs/modular/sortable.core.esm.js +184 -111
- data/node_modules/sortablejs/modular/sortable.esm.js +184 -111
- data/node_modules/sortablejs/package.json +3 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 50a87147aabeeeb4c5d2fc38027b8c6e161becb7ac1aff2fe66ea8b6e7c1c9e1
|
4
|
+
data.tar.gz: 8d2bf92bd32628dc06f865ca12f6235b811dbf13f604c31cb0284f20efa34752
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b54767f3c3e9d4c1d4796045d508ca619eabca6e576da063f54534a0917211341f771e23710060374432d1783322efd4301b2d296df9c31e9ca7bedc14f87e69
|
7
|
+
data.tar.gz: 6a298a85b7bc0aa909e393759324220a3ba41b4fc45325e2cf59848b82d0a247e8be3129397e5bf23ee7e54f8312c3247c1374314a69802bf88d38a7120fe7c5
|
@@ -17,6 +17,8 @@
|
|
17
17
|
// if there are no accordion sections on the browse level 2 page
|
18
18
|
// then it is a default page with one or two lists
|
19
19
|
return document.querySelectorAll('[data-track-count="accordionSection"]').length || document.querySelectorAll('main .govuk-list').length
|
20
|
+
case isCostOfLivingHub():
|
21
|
+
return document.querySelectorAll('[data-track-count="accordionSection"]').length
|
20
22
|
case isNewBrowsePage():
|
21
23
|
return document.querySelectorAll('[data-track-count="cardList"]').length
|
22
24
|
case isMainstreamBrowsePage():
|
@@ -51,6 +53,7 @@
|
|
51
53
|
case isDocumentCollectionPage():
|
52
54
|
return document.querySelectorAll('.document-collection .group-document-list li a').length
|
53
55
|
case isNewBrowsePageLevelTwo():
|
56
|
+
case isCostOfLivingHub():
|
54
57
|
return document.querySelectorAll('[data-track-count="contentLink"]').length
|
55
58
|
case isNewBrowsePage():
|
56
59
|
return document.querySelectorAll('[data-track-count="cardLink"]').length
|
@@ -108,6 +111,11 @@
|
|
108
111
|
getMetaAttribute(metaNavigationTypeSelector) === 'browse level 2'
|
109
112
|
}
|
110
113
|
|
114
|
+
function isCostOfLivingHub () {
|
115
|
+
return getMetaAttribute(metaApplicationSelector) === 'collections' &&
|
116
|
+
getMetaAttribute(metaNavigationTypeSelector) === 'cost of living hub'
|
117
|
+
}
|
118
|
+
|
111
119
|
function isNewBrowsePage () {
|
112
120
|
return getMetaAttribute(metaApplicationSelector) === 'collections' &&
|
113
121
|
(getMetaAttribute(metaNavigationTypeSelector) === 'browse level 0' ||
|
@@ -44,24 +44,26 @@
|
|
44
44
|
}
|
45
45
|
|
46
46
|
if (this.isMailToLink(href)) {
|
47
|
+
clickData.event_name = 'navigation'
|
47
48
|
clickData.type = 'email'
|
48
49
|
clickData.external = 'true'
|
49
50
|
} else if (this.isDownloadLink(href)) {
|
50
|
-
clickData.
|
51
|
-
clickData.
|
51
|
+
clickData.event_name = 'file_download'
|
52
|
+
clickData.type = this.isPreviewLink(href) ? 'preview' : 'generic download'
|
53
|
+
clickData.external = 'true'
|
52
54
|
} else if (this.isExternalLink(href)) {
|
55
|
+
clickData.event_name = 'navigation'
|
53
56
|
clickData.type = 'generic link'
|
54
57
|
clickData.external = 'true'
|
55
58
|
}
|
56
59
|
|
57
60
|
if (Object.keys(clickData).length > 0) {
|
58
|
-
clickData.event_name = 'navigation'
|
59
61
|
clickData.text = element.textContent.trim()
|
60
62
|
clickData.url = href
|
61
63
|
clickData.link_method = this.getClickType(event)
|
62
64
|
|
63
65
|
var schema = new window.GOVUK.analyticsGA4.Schemas().eventSchema()
|
64
|
-
schema.event = '
|
66
|
+
schema.event = 'event_data'
|
65
67
|
|
66
68
|
// get attributes from the clickData object to send to GA
|
67
69
|
// only allow it if it already exists in the schema
|
@@ -124,11 +126,23 @@
|
|
124
126
|
|
125
127
|
isExternalLink: function (href) {
|
126
128
|
var isInternalLink = this.hrefPointsToDomain(href, this.internalLinksDomain) || this.hrefPointsToDomain(href, this.internalLinksDomainWithoutWww)
|
127
|
-
if (!isInternalLink && !this.hrefIsRelative(href)) {
|
129
|
+
if (!isInternalLink && !this.hrefIsRelative(href) && !this.hrefIsAnchor(href)) {
|
128
130
|
return true
|
129
131
|
}
|
130
132
|
},
|
131
133
|
|
134
|
+
isPreviewLink: function (href) {
|
135
|
+
/* Regex looks for:
|
136
|
+
1. The file extension period (the character '.')
|
137
|
+
2. any alphanumeric characters (so we can match any file type such as jpg, pdf, mp4.)
|
138
|
+
3. the presence of '/preview'.
|
139
|
+
For example, .csv/preview or .mp4/preview will be matched.
|
140
|
+
Regex is used over JS string methods as this should work with anchor links, query string parameters and files that may have 'preview' in their name.
|
141
|
+
*/
|
142
|
+
var previewRegex = /\.\w+\/preview/i
|
143
|
+
return previewRegex.test(href)
|
144
|
+
},
|
145
|
+
|
132
146
|
hrefPointsToDomain: function (href, domain) {
|
133
147
|
var httpDomain = 'http://' + domain
|
134
148
|
var httpsDomain = 'https://' + domain
|
@@ -146,6 +160,10 @@
|
|
146
160
|
hrefIsRelative: function (href) {
|
147
161
|
// Checks that a link is relative, but is not a protocol relative url
|
148
162
|
return href[0] === '/' && href[1] !== '/'
|
163
|
+
},
|
164
|
+
|
165
|
+
hrefIsAnchor: function (href) {
|
166
|
+
return href[0] === '#'
|
149
167
|
}
|
150
168
|
}
|
151
169
|
|
@@ -9,7 +9,6 @@ window.GOVUK.Modules.GovukCheckboxes = window.GOVUKFrontend.Checkboxes;
|
|
9
9
|
this.$module = $module
|
10
10
|
this.$checkboxes = this.$module.querySelectorAll('input[type=checkbox]')
|
11
11
|
this.$nestedCheckboxes = this.$module.querySelectorAll('[data-nested=true] input[type=checkbox]')
|
12
|
-
this.$exclusiveCheckboxes = this.$module.querySelectorAll('[data-exclusive=true] input[type=checkbox]')
|
13
12
|
}
|
14
13
|
|
15
14
|
GemCheckboxes.prototype.init = function () {
|
@@ -22,10 +21,6 @@ window.GOVUK.Modules.GovukCheckboxes = window.GOVUKFrontend.Checkboxes;
|
|
22
21
|
for (i = 0; i < this.$nestedCheckboxes.length; i++) {
|
23
22
|
this.$nestedCheckboxes[i].addEventListener('change', this.handleNestedCheckboxChange.bind(this))
|
24
23
|
}
|
25
|
-
|
26
|
-
for (i = 0; i < this.$exclusiveCheckboxes.length; i++) {
|
27
|
-
this.$exclusiveCheckboxes[i].addEventListener('change', this.handleExclusiveCheckboxChange)
|
28
|
-
}
|
29
24
|
}
|
30
25
|
|
31
26
|
GemCheckboxes.prototype.handleCheckboxChange = function (event) {
|
@@ -95,23 +90,6 @@ window.GOVUK.Modules.GovukCheckboxes = window.GOVUKFrontend.Checkboxes;
|
|
95
90
|
}
|
96
91
|
}
|
97
92
|
|
98
|
-
GemCheckboxes.prototype.handleExclusiveCheckboxChange = function (event) {
|
99
|
-
var $currentCheckbox = event.target
|
100
|
-
var $checkboxes = $currentCheckbox.closest('.govuk-checkboxes')
|
101
|
-
var $exclusiveOption = $checkboxes.querySelector('input[type=checkbox][data-exclusive]')
|
102
|
-
var $nonExclusiveOptions = $checkboxes.querySelectorAll('input[type=checkbox]:not([data-exclusive])')
|
103
|
-
|
104
|
-
if ($currentCheckbox.getAttribute('data-exclusive') === 'true' && $currentCheckbox.checked === true) {
|
105
|
-
for (var i = 0; i < $nonExclusiveOptions.length; i++) {
|
106
|
-
$nonExclusiveOptions[i].checked = false
|
107
|
-
}
|
108
|
-
} else if ($currentCheckbox.getAttribute('data-exclusive') !== 'true' && $currentCheckbox.checked === true) {
|
109
|
-
if ($exclusiveOption) {
|
110
|
-
$exclusiveOption.checked = false
|
111
|
-
}
|
112
|
-
}
|
113
|
-
}
|
114
|
-
|
115
93
|
GemCheckboxes.prototype.applyAriaControlsAttributes = function ($scope) {
|
116
94
|
var $inputs = $scope.querySelectorAll('[data-controls]')
|
117
95
|
|
@@ -12,3 +12,10 @@
|
|
12
12
|
.gem-c-layout-footer .govuk-footer__list {
|
13
13
|
padding-bottom: govuk-spacing(7);
|
14
14
|
}
|
15
|
+
|
16
|
+
.gem-c-layout-footer .govuk-footer__list-item:nth-child(odd):last-child {
|
17
|
+
// If there are an uneven number of links in the
|
18
|
+
// footer this ensures the left column has more links than the
|
19
|
+
// the right column.
|
20
|
+
margin-bottom: 20px;
|
21
|
+
}
|
@@ -8,6 +8,10 @@ $search-width-or-height: $black-bar-height;
|
|
8
8
|
$pseudo-underline-height: 3px;
|
9
9
|
$button-pipe-colour: darken(govuk-colour("mid-grey"), 20%);
|
10
10
|
|
11
|
+
$after-link-padding: govuk-spacing(6);
|
12
|
+
$after-button-padding-right: govuk-spacing(6);
|
13
|
+
$after-button-padding-left: govuk-spacing(5);
|
14
|
+
|
11
15
|
@mixin chevron($colour, $update: false) {
|
12
16
|
@if $update == true {
|
13
17
|
border-bottom-color: $colour;
|
@@ -35,15 +39,17 @@ $button-pipe-colour: darken(govuk-colour("mid-grey"), 20%);
|
|
35
39
|
top: 0;
|
36
40
|
}
|
37
41
|
|
38
|
-
@mixin pseudo-underline($left: govuk-spacing(4), $right: govuk-spacing(4)) {
|
42
|
+
@mixin pseudo-underline($left: govuk-spacing(4), $right: govuk-spacing(4), $width: false) {
|
39
43
|
background: none;
|
40
|
-
bottom: 0;
|
41
44
|
content: "";
|
42
45
|
height: $pseudo-underline-height;
|
43
46
|
left: $left;
|
44
47
|
position: absolute;
|
45
48
|
right: $right;
|
46
49
|
top: auto;
|
50
|
+
@if $width {
|
51
|
+
width: $width;
|
52
|
+
}
|
47
53
|
}
|
48
54
|
|
49
55
|
@mixin focus-and-focus-visible {
|
@@ -177,7 +183,8 @@ $button-pipe-colour: darken(govuk-colour("mid-grey"), 20%);
|
|
177
183
|
&:first-of-type {
|
178
184
|
margin-right: -1px;
|
179
185
|
|
180
|
-
.gem-c-layout-super-navigation-header__navigation-second-toggle-button-inner
|
186
|
+
.gem-c-layout-super-navigation-header__navigation-second-toggle-button-inner,
|
187
|
+
.gem-c-layout-super-navigation-header__navigation-item-link-inner {
|
181
188
|
border-left: 1px solid $button-pipe-colour;
|
182
189
|
border-right: 1px solid $button-pipe-colour;
|
183
190
|
}
|
@@ -242,10 +249,8 @@ $button-pipe-colour: darken(govuk-colour("mid-grey"), 20%);
|
|
242
249
|
@if $govuk-typography-use-rem {
|
243
250
|
font-size: govuk-px-to-rem(16px);
|
244
251
|
}
|
245
|
-
// stylelint-enable max-nesting-depth
|
246
252
|
|
247
253
|
height: govuk-spacing(4);
|
248
|
-
padding: govuk-spacing(3);
|
249
254
|
position: relative;
|
250
255
|
|
251
256
|
&:before {
|
@@ -260,8 +265,17 @@ $button-pipe-colour: darken(govuk-colour("mid-grey"), 20%);
|
|
260
265
|
}
|
261
266
|
}
|
262
267
|
|
263
|
-
|
268
|
+
&:focus:not(:focus-visible) {
|
269
|
+
.gem-c-layout-super-navigation-header__navigation-item-link-inner {
|
270
|
+
border-color: $button-pipe-colour;
|
271
|
+
}
|
272
|
+
}
|
273
|
+
|
264
274
|
@include focus-and-focus-visible {
|
275
|
+
.gem-c-layout-super-navigation-header__navigation-item-link-inner {
|
276
|
+
border-color: $govuk-focus-colour;
|
277
|
+
}
|
278
|
+
|
265
279
|
&,
|
266
280
|
&:hover {
|
267
281
|
box-shadow: none;
|
@@ -295,11 +309,27 @@ $button-pipe-colour: darken(govuk-colour("mid-grey"), 20%);
|
|
295
309
|
background: none;
|
296
310
|
}
|
297
311
|
}
|
298
|
-
// stylelint-enable max-nesting-depth
|
299
312
|
|
300
313
|
&:after {
|
301
|
-
@include pseudo-underline($left:
|
314
|
+
@include pseudo-underline($left: $after-link-padding, $right: $after-link-padding, $width: calc(100% - $after-link-padding));
|
302
315
|
}
|
316
|
+
|
317
|
+
.js-module-initialised & {
|
318
|
+
// If js is initialised, we are hiding the links and
|
319
|
+
// making the buttons visible instead. This means we have
|
320
|
+
// to remove the padding added to make the links vertically
|
321
|
+
// aligned, as the buttons are styled vertically aligned by
|
322
|
+
// default.
|
323
|
+
|
324
|
+
padding: 0;
|
325
|
+
margin: 0;
|
326
|
+
|
327
|
+
&:after {
|
328
|
+
@include pseudo-underline($left: $after-button-padding-left, $right: $after-button-padding-right, $width: calc(100% - $after-button-padding-left));
|
329
|
+
}
|
330
|
+
}
|
331
|
+
|
332
|
+
// stylelint-enable max-nesting-depth
|
303
333
|
}
|
304
334
|
}
|
305
335
|
|
@@ -308,6 +338,13 @@ $button-pipe-colour: darken(govuk-colour("mid-grey"), 20%);
|
|
308
338
|
}
|
309
339
|
}
|
310
340
|
|
341
|
+
.gem-c-layout-super-navigation-header__navigation-item-link,
|
342
|
+
.gem-c-layout-super-navigation-header__navigation-second-toggle-button {
|
343
|
+
@include govuk-media-query($from: "desktop") {
|
344
|
+
padding: govuk-spacing(3) 0;
|
345
|
+
}
|
346
|
+
}
|
347
|
+
|
311
348
|
.gem-c-layout-super-navigation-header__navigation-item-link {
|
312
349
|
.js-module-initialised & {
|
313
350
|
margin-left: govuk-spacing(4);
|
@@ -459,20 +496,31 @@ $button-pipe-colour: darken(govuk-colour("mid-grey"), 20%);
|
|
459
496
|
}
|
460
497
|
}
|
461
498
|
|
499
|
+
.gem-c-layout-super-navigation-header__navigation-item-link-inner {
|
500
|
+
@include govuk-media-query($from: "desktop") {
|
501
|
+
// links have different left padding to the button as
|
502
|
+
// they do not have the 5px wide caret pseudo element
|
503
|
+
padding: govuk-spacing(1) $after-link-padding;
|
504
|
+
}
|
505
|
+
}
|
506
|
+
|
462
507
|
.gem-c-layout-super-navigation-header__navigation-second-toggle-button-inner {
|
463
508
|
@include govuk-media-query($from: "desktop") {
|
464
509
|
display: inline-block;
|
465
|
-
padding: govuk-spacing(1)
|
510
|
+
padding: govuk-spacing(1) $after-button-padding-right govuk-spacing(1) $after-button-padding-left;
|
466
511
|
}
|
467
512
|
}
|
468
513
|
|
469
514
|
// Search link and dropdown.
|
470
515
|
.gem-c-layout-super-navigation-header__search-item-link {
|
516
|
+
@include govuk-media-query($from: "desktop") {
|
517
|
+
padding: govuk-spacing(3);
|
518
|
+
}
|
519
|
+
|
471
520
|
&:link,
|
472
521
|
&:visited {
|
473
522
|
@include govuk-media-query($from: "desktop") {
|
474
523
|
background: $govuk-brand-colour;
|
475
|
-
border-bottom: 1px solid govuk-colour("dark-blue");
|
476
524
|
|
477
525
|
&:hover {
|
478
526
|
background: govuk-colour("black");
|
@@ -494,6 +542,7 @@ $button-pipe-colour: darken(govuk-colour("mid-grey"), 20%);
|
|
494
542
|
&:after {
|
495
543
|
left: 0;
|
496
544
|
right: 0;
|
545
|
+
width: 100%;
|
497
546
|
}
|
498
547
|
|
499
548
|
@include focus-not-focus-visible {
|
@@ -811,7 +860,7 @@ $button-pipe-colour: darken(govuk-colour("mid-grey"), 20%);
|
|
811
860
|
|
812
861
|
.gem-c-layout-super-navigation-header__navigation-second-items--topics {
|
813
862
|
@include govuk-media-query($from: "desktop") {
|
814
|
-
@include columns($items:
|
863
|
+
@include columns($items: 17, $columns: 2, $selector: "li", $flow: column);
|
815
864
|
}
|
816
865
|
}
|
817
866
|
|
@@ -28,7 +28,30 @@
|
|
28
28
|
</div>
|
29
29
|
</div>
|
30
30
|
|
31
|
-
|
31
|
+
<% if @component_doc.other_examples.any? %>
|
32
|
+
<div class="component-doc__content-list">
|
33
|
+
<%
|
34
|
+
content_items = [
|
35
|
+
{
|
36
|
+
href: "#default",
|
37
|
+
text: "How it looks",
|
38
|
+
}
|
39
|
+
]
|
40
|
+
|
41
|
+
@component_doc.other_examples.each do | example |
|
42
|
+
content_items << {
|
43
|
+
href: "##{example.id}",
|
44
|
+
text: example.name
|
45
|
+
}
|
46
|
+
end
|
47
|
+
%>
|
48
|
+
<%= render "govuk_publishing_components/components/contents_list", {
|
49
|
+
contents: content_items
|
50
|
+
} %>
|
51
|
+
</div>
|
52
|
+
<% end %>
|
53
|
+
|
54
|
+
<h2 class="component-doc-h2" id="default">
|
32
55
|
<a href="<%= component_example_path(@component_doc.id, "default") %>" class="govuk-link">How it looks</a>
|
33
56
|
<small>(<a href="<%= component_preview_path(@component_doc.id, "default") %>" class="govuk-link">preview</a>)</small>
|
34
57
|
<small>(<a href="<%= component_preview_all_path(@component_doc.id) %>" class="govuk-link">preview all</a>)</small>
|
@@ -65,8 +88,9 @@
|
|
65
88
|
<% if @component_doc.other_examples.any? %>
|
66
89
|
<div class="examples">
|
67
90
|
<h2 class="component-doc-h2">Other examples</h2>
|
91
|
+
|
68
92
|
<% @component_doc.other_examples.each do |example| %>
|
69
|
-
<div class="component-example">
|
93
|
+
<div class="component-example" id="<%= example.id %>">
|
70
94
|
<h3 class="example-title">
|
71
95
|
<a href="<%= component_example_path(@component_doc.id, example.id) %>" class="govuk-link"><%= example.name %></a>
|
72
96
|
<small>(<a href="<%= component_preview_path(@component_doc.id, example.id) %>" class="govuk-link">preview</a>)</small>
|
@@ -4,7 +4,7 @@
|
|
4
4
|
id = cb_helper.id
|
5
5
|
%>
|
6
6
|
|
7
|
-
<%= tag.div id: id, class: cb_helper.css_classes, data: { module: "gem-checkboxes" } do %>
|
7
|
+
<%= tag.div id: id, class: cb_helper.css_classes, data: { module: "gem-checkboxes govuk-checkboxes" } do %>
|
8
8
|
<% if cb_helper.should_have_fieldset %>
|
9
9
|
<% if cb_helper.heading_markup %>
|
10
10
|
<%= tag.fieldset class: "govuk-fieldset", "aria-describedby": cb_helper.fieldset_describedby do %>
|
@@ -24,8 +24,7 @@
|
|
24
24
|
|
25
25
|
<%= tag.ul class: cb_helper.list_classes, data: {
|
26
26
|
module: ('govuk-checkboxes' if cb_helper.has_conditional),
|
27
|
-
nested: ('true' if cb_helper.has_nested)
|
28
|
-
exclusive: ('true' if cb_helper.has_exclusive)
|
27
|
+
nested: ('true' if cb_helper.has_nested)
|
29
28
|
} do %>
|
30
29
|
<% cb_helper.items.each_with_index do |item, index| %>
|
31
30
|
<% if item === :or %>
|
data/app/views/govuk_publishing_components/components/_layout_super_navigation_header.html.erb
CHANGED
@@ -96,7 +96,7 @@
|
|
96
96
|
%>
|
97
97
|
<%= tag.li class: li_classes do %>
|
98
98
|
<div class="gem-c-layout-super-navigation-header__navigation-toggle-wrapper govuk-clearfix">
|
99
|
-
<%= link_to link[:
|
99
|
+
<%= link_to link[:href], {
|
100
100
|
class: "gem-c-layout-super-navigation-header__navigation-item-link",
|
101
101
|
data: {
|
102
102
|
track_action: "#{tracking_label}Link",
|
@@ -105,7 +105,11 @@
|
|
105
105
|
track_dimension: link[:label],
|
106
106
|
track_dimension_index: "29",
|
107
107
|
}
|
108
|
-
} %>
|
108
|
+
} do %>
|
109
|
+
<span class="gem-c-layout-super-navigation-header__navigation-item-link-inner">
|
110
|
+
<%= link[:label] %>
|
111
|
+
</span>
|
112
|
+
<% end %>
|
109
113
|
<% if has_children %>
|
110
114
|
<%= content_tag(:button, {
|
111
115
|
aria: {
|
@@ -103,3 +103,10 @@ examples:
|
|
103
103
|
name: "described"
|
104
104
|
rows: 2
|
105
105
|
describedby: "contextual-guidance"
|
106
|
+
with_data_attributes:
|
107
|
+
data:
|
108
|
+
label:
|
109
|
+
text: "This textarea has a data attribute"
|
110
|
+
name: "with_data_attrbutes"
|
111
|
+
data:
|
112
|
+
module: "some-awesome-module-here"
|
data/config/locales/en.yml
CHANGED
@@ -96,6 +96,8 @@ en:
|
|
96
96
|
href: "/browse/childcare-parenting"
|
97
97
|
- text: Citizenship and living in the UK
|
98
98
|
href: "/browse/citizenship"
|
99
|
+
- text: Cost of living support
|
100
|
+
href: "/cost-of-living"
|
99
101
|
- text: Crime, justice and the law
|
100
102
|
href: "/browse/justice"
|
101
103
|
- text: Disabled people
|
@@ -175,6 +177,8 @@ en:
|
|
175
177
|
href: "/browse/childcare-parenting"
|
176
178
|
- label: Citizenship and living in the UK
|
177
179
|
href: "/browse/citizenship"
|
180
|
+
- label: Cost of living support
|
181
|
+
href: "/cost-of-living"
|
178
182
|
- label: Crime, justice and the law
|
179
183
|
href: "/browse/justice"
|
180
184
|
- label: Disabled people
|
@@ -14,8 +14,7 @@ module GovukPublishingComponents
|
|
14
14
|
:id,
|
15
15
|
:hint_text,
|
16
16
|
:description,
|
17
|
-
:heading_caption
|
18
|
-
:has_exclusive
|
17
|
+
:heading_caption
|
19
18
|
|
20
19
|
def initialize(options)
|
21
20
|
@items = options[:items] || []
|
@@ -29,7 +28,6 @@ module GovukPublishingComponents
|
|
29
28
|
|
30
29
|
# check if any item is set as being conditional
|
31
30
|
@has_conditional = options[:items].any? { |item| item.is_a?(Hash) && item[:conditional] }
|
32
|
-
@has_exclusive = options[:items].any? { |item| item.is_a?(Hash) && item[:exclusive] }
|
33
31
|
@has_nested = options[:items].any? { |item| item.is_a?(Hash) && item[:items] }
|
34
32
|
|
35
33
|
@id = options[:id] || "checkboxes-#{SecureRandom.hex(4)}"
|
@@ -97,7 +95,7 @@ module GovukPublishingComponents
|
|
97
95
|
data = checkbox[:data_attributes] || {}
|
98
96
|
data[:controls] = controls
|
99
97
|
data["aria-controls"] = aria_controls
|
100
|
-
data[:
|
98
|
+
data[:behaviour] = "exclusive" if checkbox[:exclusive]
|
101
99
|
|
102
100
|
capture do
|
103
101
|
concat check_box_tag checkbox_name, checkbox[:value], checked, class: "govuk-checkboxes__input", id: checkbox_id, data: data
|