govuk_publishing_components 24.5.0 → 24.6.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/stylesheets/govuk_publishing_components/components/_summary-list.scss +12 -0
- data/app/views/govuk_publishing_components/components/_summary_list.html.erb +18 -13
- data/app/views/govuk_publishing_components/components/docs/summary_list.yml +33 -19
- data/lib/govuk_publishing_components/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b6831e98d8b1db5f3d0cef2f7a7e7cc5439f4bfed8e1c929aedcf9fc98774a7c
|
|
4
|
+
data.tar.gz: 85579af6ac2c4ab5970ef2c55d64e1ef8bbbd8978635a00186514e86a53340aa
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 92158ef074a519f279584aadd38bab2d44fac46b04ee7fffe62bfb8d1d3a15f41825e12d666a692c200dee5baf827bc82190642b48443918f90cd6a62e57c277
|
|
7
|
+
data.tar.gz: 4937053696a56e4b30b89b9190a3ab99f6c5b080774acc89395eecf6549c233a219ac857fef5d6aa0e8e93671097178f66cec5091660a13e29677ee1d030e13a
|
|
@@ -38,3 +38,15 @@
|
|
|
38
38
|
.gem-c-summary__block {
|
|
39
39
|
@include govuk-responsive-margin(6, "bottom");
|
|
40
40
|
}
|
|
41
|
+
|
|
42
|
+
.gem-c-summary-list--wide-title {
|
|
43
|
+
@include govuk-media-query($from: 'tablet') {
|
|
44
|
+
.govuk-summary-list__key {
|
|
45
|
+
width: 60%;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.govuk-summary-list__value {
|
|
49
|
+
width: 20%;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -10,32 +10,35 @@
|
|
|
10
10
|
delete ||= {}
|
|
11
11
|
items ||= []
|
|
12
12
|
block ||= yield
|
|
13
|
+
wide_title ||= false
|
|
13
14
|
%>
|
|
14
15
|
<% if title || items.any? %>
|
|
15
|
-
<%= tag.div class: "gem-c-summary-list #{"govuk-summary-list--no-border" if borderless}", id: id do %>
|
|
16
|
+
<%= tag.div class: "gem-c-summary-list #{"govuk-summary-list--no-border" if borderless} #{"gem-c-summary-list--wide-title" if wide_title}", id: id do %>
|
|
16
17
|
<% if title %>
|
|
17
18
|
<%= content_tag(shared_helper.get_heading_level, title, class: "govuk-heading-#{heading_size} gem-c-summary-list__group-title") %>
|
|
18
19
|
|
|
19
20
|
<% if edit.any? %>
|
|
20
21
|
<% edit_main_link = capture do %>
|
|
21
|
-
<%
|
|
22
|
+
<%
|
|
23
|
+
edit_section_link_text = edit[:link_text] || t("components.summary_list.edit")
|
|
24
|
+
%>
|
|
22
25
|
<%= link_to edit.fetch(:href),
|
|
23
26
|
class: "govuk-link",
|
|
24
|
-
title: "#{edit_section_link_text} #{title}",
|
|
25
27
|
data: edit.fetch(:data_attributes, {}) do %>
|
|
26
|
-
<%= edit_section_link_text %><%= tag.span " #{title}", class: "govuk-visually-hidden" -%>
|
|
28
|
+
<%= edit_section_link_text %><%= tag.span " #{title}", class: "govuk-visually-hidden" unless edit[:link_text_no_enhance] -%>
|
|
27
29
|
<% end %>
|
|
28
30
|
<% end %>
|
|
29
31
|
<% end %>
|
|
30
32
|
|
|
31
33
|
<% if delete.any? %>
|
|
32
34
|
<% delete_main_link = capture do %>
|
|
33
|
-
<%
|
|
35
|
+
<%
|
|
36
|
+
delete_section_link_text = delete[:link_text] || t("components.summary_list.delete")
|
|
37
|
+
%>
|
|
34
38
|
<%= link_to delete.fetch(:href),
|
|
35
39
|
class: "govuk-link gem-link--destructive",
|
|
36
|
-
title: "#{delete_section_link_text} #{title}",
|
|
37
40
|
data: delete.fetch(:data_attributes, {}) do %>
|
|
38
|
-
<%= delete_section_link_text %><%= tag.span " #{title}", class: "govuk-visually-hidden" -%>
|
|
41
|
+
<%= delete_section_link_text %><%= tag.span " #{title}", class: "govuk-visually-hidden" unless delete[:link_text_no_enhance] -%>
|
|
39
42
|
<% end %>
|
|
40
43
|
<% end %>
|
|
41
44
|
<% end %>
|
|
@@ -72,24 +75,26 @@
|
|
|
72
75
|
|
|
73
76
|
<% if item.fetch(:edit, {}).any? %>
|
|
74
77
|
<% edit_link = capture do %>
|
|
75
|
-
<%
|
|
78
|
+
<%
|
|
79
|
+
edit_link_text = item[:edit][:link_text] || t("components.summary_list.edit")
|
|
80
|
+
%>
|
|
76
81
|
<%= link_to item[:edit].fetch(:href),
|
|
77
82
|
class: "govuk-link",
|
|
78
|
-
title: "#{edit_link_text} #{item[:field]}",
|
|
79
83
|
data: item[:edit].fetch(:data_attributes, {}) do %>
|
|
80
|
-
<%= edit_link_text %><%= tag.span " #{item[:field]}", class: "govuk-visually-hidden" -%>
|
|
84
|
+
<%= edit_link_text %><%= tag.span " #{item[:field]}", class: "govuk-visually-hidden" unless edit[:link_text_no_enhance] -%>
|
|
81
85
|
<% end %>
|
|
82
86
|
<% end %>
|
|
83
87
|
<% end %>
|
|
84
88
|
|
|
85
89
|
<% if item.fetch(:delete, {}).any? %>
|
|
86
90
|
<% delete_link = capture do %>
|
|
87
|
-
<%
|
|
91
|
+
<%
|
|
92
|
+
delete_link_text = item[:delete][:link_text] || t("components.summary_list.delete")
|
|
93
|
+
%>
|
|
88
94
|
<%= link_to item[:delete].fetch(:href),
|
|
89
95
|
class: "govuk-link gem-link--destructive",
|
|
90
|
-
title: "#{delete_link_text} #{item[:field]}",
|
|
91
96
|
data: item[:delete].fetch(:data_attributes, {}) do %>
|
|
92
|
-
<%= delete_link_text %><%= tag.span " #{item[:field]}", class: "govuk-visually-hidden" -%>
|
|
97
|
+
<%= delete_link_text %><%= tag.span " #{item[:field]}", class: "govuk-visually-hidden" unless delete[:link_text_no_enhance] -%>
|
|
93
98
|
<% end %>
|
|
94
99
|
<% end %>
|
|
95
100
|
<% end %>
|
|
@@ -35,6 +35,7 @@ examples:
|
|
|
35
35
|
borderless: true
|
|
36
36
|
|
|
37
37
|
with_edit_on_section:
|
|
38
|
+
description: For all links shown in the component, see the <a href="/component-guide/summary_list/with_customised_links">with customised links example</a> for guidance.
|
|
38
39
|
data:
|
|
39
40
|
<<: *default-example-data
|
|
40
41
|
edit:
|
|
@@ -43,6 +44,7 @@ examples:
|
|
|
43
44
|
gtm: "edit-title-summary-body"
|
|
44
45
|
|
|
45
46
|
with_delete_on_section:
|
|
47
|
+
description: For all links shown in the component, see the <a href="/component-guide/summary_list/with_customised_links">with customised links example</a> for guidance.
|
|
46
48
|
data:
|
|
47
49
|
<<: *default-example-data
|
|
48
50
|
delete:
|
|
@@ -51,6 +53,7 @@ examples:
|
|
|
51
53
|
gtm: "delete-title-summary-body"
|
|
52
54
|
|
|
53
55
|
with_edit_and_delete_on_section:
|
|
56
|
+
description: For all links shown in the component, see the <a href="/component-guide/summary_list/with_customised_links">with customised links example</a> for guidance.
|
|
54
57
|
data:
|
|
55
58
|
<<: *default-example-data
|
|
56
59
|
edit:
|
|
@@ -62,32 +65,28 @@ examples:
|
|
|
62
65
|
data_attributes:
|
|
63
66
|
gtm: "delete-title-summary-body"
|
|
64
67
|
|
|
68
|
+
with_customised_links:
|
|
69
|
+
description: |
|
|
70
|
+
For all links shown in the component, visually hidden text containing the name of the thing it refers to is automatically appended. This offers a better experience for screen reader users by making the link text unique and more explicit. In the example below, the link text would be `Change Title, summary and body`.
|
|
71
|
+
|
|
72
|
+
The text of the link can be customised using the `link_text` option. Take care that the provided `link_text` still makes sense to screen readers when combined with the title. For instance, `Reorder` link text and `Items` title becomes `Reorder Items`, which reads fine, but link text of `Summary` would read as `Summary Items`, which does not make sense.
|
|
73
|
+
|
|
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
|
+
data:
|
|
76
|
+
<<: *default-example-data
|
|
77
|
+
edit:
|
|
78
|
+
href: "edit-title-summary-body"
|
|
79
|
+
link_text: Edit this document <span class="govuk-visually-hidden">my hidden text for screenreaders</span>
|
|
80
|
+
link_text_no_enhance: true
|
|
81
|
+
|
|
65
82
|
with_custom_section_heading:
|
|
66
83
|
data:
|
|
67
84
|
<<: *default-example-data
|
|
68
85
|
heading_level: 2
|
|
69
86
|
heading_size: l
|
|
70
87
|
|
|
71
|
-
with_custom_link_on_section:
|
|
72
|
-
description: |
|
|
73
|
-
Take care that the provided `link_text` still makes sense to screen readers when combined with the title.
|
|
74
|
-
For instance, `Reorder` link text and `Items` title becomes `Reorder Items`, which reads fine, but link text
|
|
75
|
-
of `Summary` would read as `Summary Items`, which does not make sense.
|
|
76
|
-
data:
|
|
77
|
-
edit:
|
|
78
|
-
href: "custom-link"
|
|
79
|
-
link_text: "Reorder"
|
|
80
|
-
title: "Items"
|
|
81
|
-
items:
|
|
82
|
-
- field: "Item 1"
|
|
83
|
-
value: "Value 2"
|
|
84
|
-
- field: "Item 2"
|
|
85
|
-
value: "Value 2"
|
|
86
|
-
- field: "Item 3"
|
|
87
|
-
value: "Value 3"
|
|
88
|
-
|
|
89
88
|
with_edit_on_individual_items:
|
|
90
|
-
description:
|
|
89
|
+
description: For all links shown in the component, see the <a href="/component-guide/summary_list/with_customised_links">with customised links example</a> for guidance.
|
|
91
90
|
data:
|
|
92
91
|
title: "Title, summary and body"
|
|
93
92
|
items:
|
|
@@ -113,6 +112,21 @@ examples:
|
|
|
113
112
|
href: "delete-body"
|
|
114
113
|
link_text: "Remove"
|
|
115
114
|
|
|
115
|
+
wide_title_layout:
|
|
116
|
+
description: Allows a slightly adjusted layout for longer text in the field name.
|
|
117
|
+
data:
|
|
118
|
+
title: Privacy settings
|
|
119
|
+
wide_title: true
|
|
120
|
+
items:
|
|
121
|
+
- field: "GOV.UK can use cookies while you’re signed in"
|
|
122
|
+
value: "No"
|
|
123
|
+
edit:
|
|
124
|
+
href: "edit-cookies"
|
|
125
|
+
- field: "GOV.UK can send you feedback emails"
|
|
126
|
+
value: "Yes"
|
|
127
|
+
edit:
|
|
128
|
+
href: "edit-feedback"
|
|
129
|
+
|
|
116
130
|
with_block:
|
|
117
131
|
description: Use the summary list with a block when you need to show an empty state message or load another component.
|
|
118
132
|
data:
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: govuk_publishing_components
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 24.
|
|
4
|
+
version: 24.6.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- GOV.UK Dev
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2021-03-
|
|
11
|
+
date: 2021-03-16 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: govuk_app_config
|