govuk_publishing_components 24.6.0 → 24.6.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/components/accordion.js +7 -5
- data/app/views/govuk_publishing_components/components/_summary_list.html.erb +2 -2
- data/app/views/govuk_publishing_components/components/docs/summary_list.yml +18 -1
- data/lib/govuk_publishing_components/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8b508d510a7aa8f9311afcb0cbb99c28c02b8128e231fbddea0ceac450bda59
|
4
|
+
data.tar.gz: 2fc60e40d72fdb1fd6dfb635782a982e5105c4df41d8a40e71ff2985b669eaed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a43864b134f08d16145c1f39ade8bb21de88cfbe9e2f9bb92af0780e2cce92da0381495a61a9d95e40f80d66a6a739ba75ad00b18c975df2f2ccd8232749d2c
|
7
|
+
data.tar.gz: a379f9f22980a8dbddd8e0af9752055ad8f93fd45a144a1a339d153c5670d26e6bbbda904acd13b91c56e0e797a8e9ed5b82cd190dd9926810d2c41d12ba4691
|
@@ -293,8 +293,10 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
293
293
|
|
294
294
|
// Navigate to and open accordions with anchored content on page load if a hash is present
|
295
295
|
GemAccordion.prototype.openByAnchorOnLoad = function () {
|
296
|
-
|
297
|
-
|
296
|
+
var splitHash = window.location.hash.split('#')[1]
|
297
|
+
|
298
|
+
if (window.location.hash && document.getElementById(splitHash)) {
|
299
|
+
this.openForAnchor(splitHash)
|
298
300
|
}
|
299
301
|
}
|
300
302
|
|
@@ -305,20 +307,20 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
305
307
|
|
306
308
|
links.forEach(function (link) {
|
307
309
|
if (link.pathname === window.location.pathname) {
|
308
|
-
link.addEventListener('click', this.openForAnchor.bind(this, link.hash))
|
310
|
+
link.addEventListener('click', this.openForAnchor.bind(this, link.hash.split('#')[1]))
|
309
311
|
}
|
310
312
|
}.bind(this))
|
311
313
|
}
|
312
314
|
|
313
315
|
// Find the parent accordion section for the given id and open it
|
314
316
|
GemAccordion.prototype.openForAnchor = function (hash) {
|
315
|
-
var target = document.
|
317
|
+
var target = document.getElementById(hash)
|
316
318
|
var section = this.getContainingSection(target)
|
317
319
|
|
318
320
|
this.setExpanded(true, section)
|
319
321
|
}
|
320
322
|
|
321
|
-
// Loop through the given
|
323
|
+
// Loop through the given id's ancestors until the parent section class is found
|
322
324
|
GemAccordion.prototype.getContainingSection = function (target) {
|
323
325
|
while (!target.classList.contains(this.sectionClass)) {
|
324
326
|
target = target.parentElement
|
@@ -81,7 +81,7 @@
|
|
81
81
|
<%= link_to item[:edit].fetch(:href),
|
82
82
|
class: "govuk-link",
|
83
83
|
data: item[:edit].fetch(:data_attributes, {}) do %>
|
84
|
-
<%= edit_link_text %><%= tag.span " #{item[:field]}", class: "govuk-visually-hidden" unless edit[:link_text_no_enhance] -%>
|
84
|
+
<%= edit_link_text %><%= tag.span " #{item[:field]}", class: "govuk-visually-hidden" unless item[:edit][:link_text_no_enhance] -%>
|
85
85
|
<% end %>
|
86
86
|
<% end %>
|
87
87
|
<% end %>
|
@@ -94,7 +94,7 @@
|
|
94
94
|
<%= link_to item[:delete].fetch(:href),
|
95
95
|
class: "govuk-link gem-link--destructive",
|
96
96
|
data: item[:delete].fetch(:data_attributes, {}) do %>
|
97
|
-
<%= delete_link_text %><%= tag.span " #{item[:field]}", class: "govuk-visually-hidden" unless delete[:link_text_no_enhance] -%>
|
97
|
+
<%= delete_link_text %><%= tag.span " #{item[:field]}", class: "govuk-visually-hidden" unless item[:delete][:link_text_no_enhance] -%>
|
98
98
|
<% end %>
|
99
99
|
<% end %>
|
100
100
|
<% end %>
|
@@ -73,7 +73,24 @@ examples:
|
|
73
73
|
|
74
74
|
To override this behaviour, use `link_text_no_enhance` on the link in question, as shown. This will remove the visually hidden text, allowing you to add your own. The component will render a `span` element with a class of `govuk-visually-hidden` included in a passed [capture block](https://apidock.com/rails/ActionView/Helpers/CaptureHelper/capture) as the `link_text` parameter.
|
75
75
|
data:
|
76
|
-
|
76
|
+
title: "Title, summary and body"
|
77
|
+
items:
|
78
|
+
- field: "Title"
|
79
|
+
value: "Rural conservation techniques"
|
80
|
+
edit:
|
81
|
+
href: "edit-title"
|
82
|
+
text: "Edit"
|
83
|
+
data_attributes:
|
84
|
+
gtm: "edit-title"
|
85
|
+
- field: "Body"
|
86
|
+
value: "Following the land use committee change to overreaching rural byelaws in 2009, further policies were adopted."
|
87
|
+
edit:
|
88
|
+
href: "edit-body"
|
89
|
+
link_text: "Edit"
|
90
|
+
delete:
|
91
|
+
href: "delete-body"
|
92
|
+
link_text: "Remove"
|
93
|
+
link_text_no_enhance: true
|
77
94
|
edit:
|
78
95
|
href: "edit-title-summary-body"
|
79
96
|
link_text: Edit this document <span class="govuk-visually-hidden">my hidden text for screenreaders</span>
|