govuk_publishing_components 44.6.0 → 44.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/govuk_publishing_components/components/_contents-list.scss +0 -1
- data/app/views/govuk_publishing_components/components/_contents_list.html.erb +12 -6
- data/app/views/govuk_publishing_components/components/docs/contents_list.yml +13 -3
- 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: e5ba6725a25a3a6f4deab7d12f966fd45deffec95db3338046356ac8839c9786
|
4
|
+
data.tar.gz: 3a5eca27892ddcc8625dd2a0873a16105568c171f22a5528be8dd264387fccf1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c0beb2ff0859c3c88636426aa3d29fedc2523f84db0c571eae2d1d839876dcaa1e914da7772281aa3d9e282f8b7163da22d09dba2a326509c142af928932ee3
|
7
|
+
data.tar.gz: 9b39a514c5b1083adf3009e8d551d574733a74a9845a63d384966334abbc2007589c9a8b29d8ba1aa0df6600acc5b8a54e2b1dfe9295dd09c23d726670495fd5
|
@@ -1,15 +1,18 @@
|
|
1
|
-
|
1
|
+
<%
|
2
2
|
add_gem_component_stylesheet("contents-list")
|
3
3
|
|
4
|
-
cl_helper = GovukPublishingComponents::Presenters::ContentsListHelper.new(local_assigns)
|
5
4
|
underline_links ||= false
|
6
5
|
format_numbers ||= false
|
7
6
|
alternative_line_style ||= false
|
8
7
|
title ||= nil
|
9
8
|
brand ||= false
|
9
|
+
local_assigns[:aria] ||= {}
|
10
|
+
local_assigns[:margin_bottom] ||= 4
|
11
|
+
|
12
|
+
shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
|
13
|
+
cl_helper = GovukPublishingComponents::Presenters::ContentsListHelper.new(local_assigns)
|
10
14
|
brand_helper = GovukPublishingComponents::AppHelpers::BrandHelper.new(brand)
|
11
|
-
|
12
|
-
classes = %w[gem-c-contents-list]
|
15
|
+
|
13
16
|
link_classes = %w[gem-c-contents-list__link govuk-link gem-print-link]
|
14
17
|
link_classes << brand_helper.color_class
|
15
18
|
link_classes << "govuk-link--no-underline" unless underline_links
|
@@ -21,15 +24,18 @@
|
|
21
24
|
type: "contents list",
|
22
25
|
index_total: cl_helper.get_index_total,
|
23
26
|
} unless disable_ga4
|
24
|
-
|
27
|
+
|
25
28
|
component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
|
26
29
|
component_helper.add_class("gem-c-contents-list #{brand_helper.brand_class}")
|
27
30
|
component_helper.add_class("gem-c-contents-list--alternative-line-style") if alternative_line_style
|
28
31
|
component_helper.add_class("gem-c-contents-list--custom-title") if title
|
32
|
+
component_helper.add_class(shared_helper.get_margin_bottom)
|
29
33
|
component_helper.add_data_attribute({ module: "ga4-link-tracker" }) unless disable_ga4
|
30
34
|
component_helper.add_aria_attribute({ label: t("components.contents_list.contents") }) unless local_assigns[:aria][:label]
|
31
35
|
component_helper.add_role("navigation")
|
32
|
-
|
36
|
+
|
37
|
+
title_fallback = t("components.contents_list.contents", locale: I18n.locale, fallback: false, default: "en")
|
38
|
+
%>
|
33
39
|
<% if cl_helper.contents.any? %>
|
34
40
|
<%= tag.nav(**component_helper.all_attributes) do %>
|
35
41
|
<%= content_tag(
|
@@ -1,12 +1,11 @@
|
|
1
1
|
name: Contents list
|
2
2
|
description: Provides a list of links with options for dashes or numbering.
|
3
3
|
body: |
|
4
|
-
Commonly used to
|
4
|
+
Commonly used to list the contents of a page with links pointing to headings within the document, but can also be used for a list of links to other pages.
|
5
5
|
|
6
6
|
Pass a list of contents each with an `href` and `text`. The `href` can point at the ID of a heading within the page.
|
7
7
|
|
8
|
-
Supports nesting contents one level deep, currently only used by specialist documents. When nesting the top level list items
|
9
|
-
display in bold.
|
8
|
+
Supports nesting contents one level deep, currently only used by specialist documents. When nesting the top level list items display in bold.
|
10
9
|
|
11
10
|
`format_numbers` option will pull out numbers in the link text to render them as though they were the list style type. Applies to numbers at the start of text, with or without a decimal. See the [format complex numbers fixture](/component-guide/contents-list/formats_complex_numbers) for details.
|
12
11
|
accessibility_criteria: |
|
@@ -36,6 +35,17 @@ examples:
|
|
36
35
|
text: Second thing
|
37
36
|
- href: "#third-thing"
|
38
37
|
text: Third thing
|
38
|
+
with_bottom_margin:
|
39
|
+
description: The component accepts a number for margin bottom from `0` to `9` (`0px` to `60px`) using the [GOV.UK Frontend spacing scale](https://design-system.service.gov.uk/styles/spacing/#the-responsive-spacing-scale). The default margin bottom is `20px` (`govuk-spacing(4)`).
|
40
|
+
data:
|
41
|
+
margin_bottom: 9
|
42
|
+
contents:
|
43
|
+
- href: "#first-thing"
|
44
|
+
text: First thing
|
45
|
+
- href: "#second-thing"
|
46
|
+
text: Second thing
|
47
|
+
- href: "#third-thing"
|
48
|
+
text: Third thing
|
39
49
|
underline_links:
|
40
50
|
description: By default we do not underline links in this component even though this is the general approach on GOV.UK. This is because some of the examples below (particularly those with numbers) do not work well with underlined links. Instead, this option allows the links to be underlined where appropriate.
|
41
51
|
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: 44.
|
4
|
+
version: 44.7.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: 2024-10-
|
11
|
+
date: 2024-10-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chartkick
|