govuk_publishing_components 48.0.0 → 49.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/govuk_publishing_components/component_wrapper_helper_options.rb +7 -2
- data/app/views/govuk_publishing_components/components/_attachment.html.erb +8 -7
- data/app/views/govuk_publishing_components/components/_attachment_link.html.erb +6 -3
- data/app/views/govuk_publishing_components/components/_big_number.html.erb +7 -8
- data/app/views/govuk_publishing_components/components/_contents_list.html.erb +0 -1
- data/app/views/govuk_publishing_components/components/_cross_service_header.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/_layout_footer.html.erb +0 -1
- data/app/views/govuk_publishing_components/components/_layout_header.html.erb +0 -1
- data/app/views/govuk_publishing_components/components/_layout_super_navigation_header.html.erb +0 -1
- data/app/views/govuk_publishing_components/components/_modal_dialogue.html.erb +7 -3
- data/app/views/govuk_publishing_components/components/_previous_and_next_navigation.html.erb +0 -1
- data/app/views/govuk_publishing_components/components/_secondary_navigation.html.erb +0 -1
- data/app/views/govuk_publishing_components/components/_translation_nav.html.erb +0 -1
- data/app/views/govuk_publishing_components/components/docs/attachment.yml +3 -2
- data/app/views/govuk_publishing_components/components/docs/attachment_link.yml +3 -2
- data/app/views/govuk_publishing_components/components/docs/big_number.yml +9 -5
- data/app/views/govuk_publishing_components/components/docs/document_list.yml +1 -2
- data/app/views/govuk_publishing_components/components/docs/layout_footer.yml +0 -9
- data/app/views/govuk_publishing_components/components/docs/modal_dialogue.yml +1 -17
- data/app/views/govuk_publishing_components/components/layout_for_public/_account-layout.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/related_navigation/_section.html.erb +1 -2
- data/lib/govuk_publishing_components/presenters/component_wrapper_helper.rb +61 -2
- 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: a20a02d184c76606028650720f22cae103d3ccce1f42ca2dbc595915c03b55d8
|
4
|
+
data.tar.gz: d6187aefe322704e5e2e1d1ec58efe5c6b99d933e038085167f84211974b633f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f49a37d3583d584d57c42be30daad593649ce8f7c60a217d7cebbb8f4cbc95ee768bedd93c9ced0b7003d2530675970212da802dabe9ec5bc173657df035d21
|
7
|
+
data.tar.gz: d3ea15671ae94e6f723c89af1cbc9420c501fd890569df435762254decc3ba31b9b725d5532448edc6291e3fcd145fb95e9a5328dc4ec42a1a24800f98faac66
|
@@ -13,8 +13,13 @@ This component uses the component wrapper helper. It accepts the following optio
|
|
13
13
|
- `lang` - accepts a language attribute value
|
14
14
|
- `open` - accepts an open attribute value (true or false)
|
15
15
|
- `hidden` - accepts an empty string, 'hidden', or 'until-found'
|
16
|
-
- `tabindex` - accepts an integer. The integer can also be passed as a string
|
17
|
-
- `dir` - accepts 'rtl', 'ltr', or 'auto'
|
16
|
+
- `tabindex` - accepts an integer. The integer can also be passed as a string
|
17
|
+
- `dir` - accepts 'rtl', 'ltr', or 'auto'
|
18
|
+
- `type` - accepts any valid type attribute e.g. 'button', 'submit', 'text'
|
19
|
+
- `rel` - accepts any valid rel attribute e.g. 'nofollow'
|
20
|
+
- `target` - accepts a valid target attribute e.g. '_blank'
|
21
|
+
- `title` - accepts any string
|
22
|
+
- `draggable` - accepts a draggable attribute value (\"true\" or \"false\")
|
18
23
|
"
|
19
24
|
end
|
20
25
|
end
|
@@ -6,12 +6,13 @@
|
|
6
6
|
hide_opendocument_metadata ||= false
|
7
7
|
hide_order_copy_link ||= false
|
8
8
|
attributes = []
|
9
|
-
|
9
|
+
url_data_attributes ||= {}
|
10
10
|
details_ga4_attributes ||= {}
|
11
11
|
shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
|
12
12
|
|
13
|
-
|
14
|
-
|
13
|
+
component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
|
14
|
+
component_helper.add_class("gem-c-attachment")
|
15
|
+
component_helper.add_data_attribute({ module: "ga4-link-tracker" })
|
15
16
|
ga4_link = { 'event_name': 'navigation', 'type': 'attachment' }
|
16
17
|
|
17
18
|
case attachment.type
|
@@ -55,16 +56,16 @@
|
|
55
56
|
)
|
56
57
|
end
|
57
58
|
|
58
|
-
|
59
|
+
url_data_attributes[:ga4_link] = ga4_link
|
59
60
|
%>
|
60
|
-
<%= tag.section
|
61
|
+
<%= tag.section(**component_helper.all_attributes) do %>
|
61
62
|
<%= tag.div class: "gem-c-attachment__thumbnail govuk-!-display-none-print" do %>
|
62
63
|
<%= link_to attachment.url,
|
63
64
|
class: "govuk-link",
|
64
65
|
target: target,
|
65
66
|
tabindex: "-1",
|
66
67
|
"aria-hidden": true,
|
67
|
-
data:
|
68
|
+
data: url_data_attributes do %>
|
68
69
|
<% if attachment.thumbnail_url.present? %>
|
69
70
|
<% image_tag(attachment.thumbnail_url, alt: "", class: "gem-c-attachment__thumbnail-image gem-c-attachment__thumbnail-image--custom") %>
|
70
71
|
<% elsif attachment.html? %>
|
@@ -88,7 +89,7 @@
|
|
88
89
|
<%= link_to attachment.title, attachment.url,
|
89
90
|
class: "govuk-link gem-c-attachment__link",
|
90
91
|
target: target,
|
91
|
-
data:
|
92
|
+
data: url_data_attributes %>
|
92
93
|
<% end %>
|
93
94
|
|
94
95
|
<% if attachment.reference.present? %>
|
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
attachment = GovukPublishingComponents::Presenters::AttachmentHelper.new(attachment)
|
5
5
|
target ||= nil
|
6
|
-
|
6
|
+
url_data_attributes ||= {}
|
7
7
|
attributes = []
|
8
8
|
if attachment.content_type_name
|
9
9
|
content = if attachment.content_type_abbr
|
@@ -30,11 +30,14 @@
|
|
30
30
|
class: "gem-c-attachment-link__attribute",
|
31
31
|
)
|
32
32
|
end
|
33
|
+
|
34
|
+
component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
|
35
|
+
component_helper.add_class("gem-c-attachment-link")
|
33
36
|
%>
|
34
|
-
<%= tag.span(
|
37
|
+
<%= tag.span(**component_helper.all_attributes) do %>
|
35
38
|
<%= link_to(attachment.title, attachment.url,
|
36
39
|
class: "govuk-link",
|
37
40
|
target: target,
|
38
|
-
data:
|
41
|
+
data: url_data_attributes) -%>
|
39
42
|
<%= raw("(#{attributes.join(', ')})") if attributes.any? -%>
|
40
43
|
<% end %>
|
@@ -1,22 +1,21 @@
|
|
1
1
|
<%
|
2
2
|
add_gem_component_stylesheet("big-number")
|
3
3
|
|
4
|
-
shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
|
5
4
|
big_number_helper = GovukPublishingComponents::Presenters::BigNumberHelper.new(local_assigns)
|
6
5
|
|
7
6
|
number ||= false
|
8
7
|
label ||= nil
|
9
8
|
href ||= nil
|
10
|
-
|
11
|
-
aria ||= nil
|
12
|
-
classes = ["gem-c-big-number"]
|
13
|
-
classes << shared_helper.get_margin_bottom
|
9
|
+
nested_data_attributes ||= nil
|
14
10
|
|
15
11
|
value_classes = big_number_helper.value_classes
|
12
|
+
|
13
|
+
component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
|
14
|
+
component_helper.add_class("gem-c-big-number")
|
16
15
|
%>
|
17
16
|
<% if number %>
|
18
17
|
<% big_number_value = capture do %>
|
19
|
-
<%= tag.span class: value_classes, data: href ? nil :
|
18
|
+
<%= tag.span class: value_classes, data: href ? nil : nested_data_attributes do %>
|
20
19
|
<%
|
21
20
|
# The below check is to account for small symbols awkwardly sitting above the baseline in our typeface and adjust them to sit at the baseline for the purpose of visual harmony
|
22
21
|
# Currently the only small symbol used with big numbers are pluses so they are specifically applied in the below code
|
@@ -37,9 +36,9 @@
|
|
37
36
|
<% end %>
|
38
37
|
<% end %>
|
39
38
|
|
40
|
-
<%= tag.div
|
39
|
+
<%= tag.div(**component_helper.all_attributes) do %>
|
41
40
|
<% unless href.nil? %>
|
42
|
-
<%= link_to big_number_value, href, class: "govuk-link gem-c-big-number__link", data:
|
41
|
+
<%= link_to big_number_value, href, class: "govuk-link gem-c-big-number__link", data: nested_data_attributes %>
|
43
42
|
<% else %>
|
44
43
|
<%= big_number_value %>
|
45
44
|
<% end %>
|
@@ -30,7 +30,6 @@
|
|
30
30
|
component_helper.add_class("gem-c-contents-list--custom-title") if title
|
31
31
|
component_helper.add_data_attribute({ module: "ga4-link-tracker" }) unless disable_ga4
|
32
32
|
component_helper.add_aria_attribute({ label: t("components.contents_list.contents") }) unless local_assigns[:aria][:label]
|
33
|
-
component_helper.add_role("navigation")
|
34
33
|
|
35
34
|
title_fallback = t("components.contents_list.contents", locale: I18n.locale, fallback: false, default: "en")
|
36
35
|
%>
|
@@ -7,7 +7,7 @@
|
|
7
7
|
service_navigation_aria_label ||= "Service menu"
|
8
8
|
%>
|
9
9
|
|
10
|
-
<header class="gem-c-cross-service-header"
|
10
|
+
<header class="gem-c-cross-service-header" data-module="cross-service-header">
|
11
11
|
<%= render "govuk_publishing_components/components/cross_service_header/one_login_header", {
|
12
12
|
one_login_navigation_items: one_login_navigation_items,
|
13
13
|
} %>
|
@@ -11,7 +11,6 @@
|
|
11
11
|
component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
|
12
12
|
component_helper.add_class("gem-c-layout-footer govuk-footer")
|
13
13
|
component_helper.add_class("gem-c-layout-footer--border") if with_border
|
14
|
-
component_helper.add_role("contentinfo")
|
15
14
|
component_helper.add_data_attribute({ module: "ga4-link-tracker" })
|
16
15
|
%>
|
17
16
|
<%= tag.footer(**component_helper.all_attributes) do %>
|
@@ -15,7 +15,6 @@
|
|
15
15
|
component_helper.add_class("gem-c-layout-header govuk-header")
|
16
16
|
component_helper.add_class("gem-c-layout-header--#{environment}") if environment
|
17
17
|
component_helper.add_class("gem-c-layout-header--no-bottom-border") if remove_bottom_border
|
18
|
-
component_helper.add_role("banner")
|
19
18
|
component_helper.add_data_attribute({ module: "govuk-header" })
|
20
19
|
|
21
20
|
%>
|
data/app/views/govuk_publishing_components/components/_layout_super_navigation_header.html.erb
CHANGED
@@ -65,7 +65,6 @@
|
|
65
65
|
component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
|
66
66
|
component_helper.add_class("gem-c-layout-super-navigation-header")
|
67
67
|
component_helper.add_class("gem-c-layout-super-navigation-header--blue-background") if blue_background
|
68
|
-
component_helper.add_role("banner")
|
69
68
|
component_helper.add_data_attribute({ module: "ga4-event-tracker ga4-link-tracker", ga4_expandable: "" })
|
70
69
|
%>
|
71
70
|
<%= tag.header(**component_helper.all_attributes) do %>
|
@@ -3,15 +3,19 @@
|
|
3
3
|
|
4
4
|
id ||= "modal-dialogue-#{SecureRandom.hex(4)}"
|
5
5
|
wide ||= false
|
6
|
-
data_attributes = {}
|
7
6
|
aria_label ||= nil
|
8
7
|
dialog_classes = ["gem-c-modal-dialogue__box"]
|
9
8
|
dialog_classes << "gem-c-modal-dialogue__box--wide" if wide
|
9
|
+
|
10
|
+
component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
|
11
|
+
component_helper.add_class("gem-c-modal-dialogue")
|
12
|
+
component_helper.add_data_attribute({ module: "modal-dialogue" })
|
13
|
+
component_helper.set_id(id)
|
10
14
|
%>
|
11
15
|
|
12
|
-
<%= tag.div
|
16
|
+
<%= tag.div(**component_helper.all_attributes) do %>
|
13
17
|
<%= tag.div class: "gem-c-modal-dialogue__overlay" %>
|
14
|
-
<%= tag.dialog class: dialog_classes,
|
18
|
+
<%= tag.dialog class: dialog_classes, aria: { modal: true, label: aria_label }, role: "dialog", tabindex: 0 do %>
|
15
19
|
<%= tag.div class: "gem-c-modal-dialogue__header" do %>
|
16
20
|
<%= render "govuk_publishing_components/components/govuk_logo/govuk_logo_crown_only", {
|
17
21
|
classes: %w[gem-c-modal-dialogue__logotype-crown],
|
data/app/views/govuk_publishing_components/components/_previous_and_next_navigation.html.erb
CHANGED
@@ -4,7 +4,6 @@
|
|
4
4
|
|
5
5
|
component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
|
6
6
|
component_helper.add_class("govuk-pagination govuk-pagination--block")
|
7
|
-
component_helper.add_role("navigation")
|
8
7
|
component_helper.add_aria_attribute({ label: t("components.previous_and_next_navigation.pagination") })
|
9
8
|
component_helper.add_data_attribute({ module: "ga4-link-tracker" }) unless disable_ga4
|
10
9
|
|
@@ -6,7 +6,6 @@
|
|
6
6
|
translation_helper = GovukPublishingComponents::Presenters::TranslationNavHelper.new(local_assigns)
|
7
7
|
|
8
8
|
component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
|
9
|
-
component_helper.add_role("navigation")
|
10
9
|
component_helper.add_class("gem-c-translation-nav govuk-!-display-none-print #{translation_helper.classes} #{brand_helper.brand_class}")
|
11
10
|
component_helper.add_aria_attribute({ label: t("common.translations") })
|
12
11
|
%>
|
@@ -17,6 +17,7 @@ shared_accessibility_criteria:
|
|
17
17
|
accessibility_criteria: |
|
18
18
|
The thumbnail image, and the link wrapping it, must not focusable or shown to
|
19
19
|
screenreaders.
|
20
|
+
uses_component_wrapper_helper: true
|
20
21
|
examples:
|
21
22
|
default:
|
22
23
|
data:
|
@@ -89,7 +90,7 @@ examples:
|
|
89
90
|
details_ga4_attributes: {
|
90
91
|
index_section_count: 4
|
91
92
|
}
|
92
|
-
|
93
|
+
with_data_attributes_on_url:
|
93
94
|
data:
|
94
95
|
attachment:
|
95
96
|
title: "Department for Transport information asset register"
|
@@ -97,7 +98,7 @@ examples:
|
|
97
98
|
filename: department-for-transport-information-asset-register.csv
|
98
99
|
content_type: application/pdf
|
99
100
|
file_size: 20000
|
100
|
-
|
101
|
+
url_data_attributes:
|
101
102
|
gtm: "attachment-preview"
|
102
103
|
with_margin_bottom:
|
103
104
|
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). It defaults to no margin bottom.
|
@@ -14,6 +14,7 @@ accessibility_criteria: |
|
|
14
14
|
Attachment links within paragraphs of text do not need to meet the 24 by 24 CSS pixels requirements.
|
15
15
|
shared_accessibility_criteria:
|
16
16
|
- link
|
17
|
+
uses_component_wrapper_helper: true
|
17
18
|
examples:
|
18
19
|
default:
|
19
20
|
data:
|
@@ -58,10 +59,10 @@ examples:
|
|
58
59
|
title: "Temporary snow ploughs: guidance note"
|
59
60
|
url: https://assets.publishing.service.gov.uk/government/uploads/system/uploads/attachment_data/file/259634/temporary-snow-ploughs.pdf
|
60
61
|
target: _blank
|
61
|
-
|
62
|
+
with_data_attributes_on_url:
|
62
63
|
data:
|
63
64
|
attachment:
|
64
65
|
title: "Temporary snow ploughs: guidance note"
|
65
66
|
url: https://assets.publishing.service.gov.uk/government/uploads/system/uploads/attachment_data/file/259634/temporary-snow-ploughs.pdf
|
66
|
-
|
67
|
+
url_data_attributes:
|
67
68
|
gtm: "attachment-preview"
|
@@ -48,22 +48,26 @@ examples:
|
|
48
48
|
data:
|
49
49
|
number: 23
|
50
50
|
href: "/government/organisations#ministerial_departments"
|
51
|
-
|
51
|
+
with_nested_data_attributes:
|
52
52
|
description: |
|
53
|
-
If a `href` attribute is present, `
|
53
|
+
If a `href` attribute is present, `nested_data_attributes` will apply to the `a` containing the number value (see below). If a `href` is not present, it will apply to the `span` containing the number value.
|
54
|
+
|
55
|
+
For parent level data attributes, use `data_attributes` which comes from this component having the component wrapper.
|
54
56
|
|
55
57
|
Note that the component does not include built in tracking. If this is required consider using the [GA4 link tracker](https://github.com/alphagov/govuk_publishing_components/blob/main/docs/analytics-ga4/trackers/ga4-link-tracker.md).
|
56
58
|
data:
|
57
59
|
number: 23
|
58
60
|
label: Ministerial departments
|
59
61
|
href: "/government/organisations#ministerial_departments"
|
60
|
-
|
62
|
+
nested_data_attributes:
|
61
63
|
department-count: true
|
62
|
-
|
64
|
+
with_nested_data_attributes_but_no_link:
|
65
|
+
description: |
|
66
|
+
If a `href` is not present, the data attributes will be applied to the `span` containing the big number. For parent level data attributes, use `data_attributes` which comes from this component having the component wrapper.
|
63
67
|
data:
|
64
68
|
number: 23
|
65
69
|
label: Ministerial departments
|
66
|
-
|
70
|
+
nested_data_attributes:
|
67
71
|
department-count: true
|
68
72
|
with_aria_attributes:
|
69
73
|
description: Aria attributes are applied to the whole component instance
|
@@ -246,8 +246,7 @@ examples:
|
|
246
246
|
document_type: 'Statistical data set'
|
247
247
|
with_equal_item_spacing:
|
248
248
|
description: |
|
249
|
-
|
250
|
-
of the original larger bottom padding.
|
249
|
+
Use this option to add equal spacing between items in the document list.
|
251
250
|
data:
|
252
251
|
equal_item_spacing: true
|
253
252
|
items:
|
@@ -20,17 +20,8 @@ accessibility_criteria: |
|
|
20
20
|
|
21
21
|
Note: This decision has been made based on prior experience seeing removal of overuse of `<nav>` elements from www.GOV.UK, which made it confusing for users of assistive technologies to know what were the most important navigation aspects of GOV.UK.
|
22
22
|
Should be challenged if user research indicates this is an issue.
|
23
|
-
|
24
|
-
- have a role of [`contentinfo`](https://www.w3.org/TR/wai-aria-1.1/#contentinfo) at the root of the component (`<footer>`)
|
25
|
-
|
26
|
-
Note: This decision has been made given that most uses of this role tend to be used directly on a `<footer>` element.
|
27
|
-
Assumption made is that is most predictable for users of assistive technologies.
|
28
|
-
The spec indicates that `contentinfo` is useful for "Examples of information included in this region of the page are copyrights and links to privacy statements.", which may indicate that it might be better placed around the 'meta' section of this component.
|
29
|
-
Should be challenged if user research indicates this is an issue.
|
30
23
|
shared_accessibility_criteria:
|
31
24
|
- link
|
32
|
-
accessibility_excluded_rules:
|
33
|
-
- landmark-contentinfo-is-top-level # The footer element can not be top level in the examples
|
34
25
|
examples:
|
35
26
|
default:
|
36
27
|
data: {}
|
@@ -24,6 +24,7 @@ accessibility_criteria: |
|
|
24
24
|
- return focus to last focused element on close
|
25
25
|
|
26
26
|
display_preview: false
|
27
|
+
uses_component_wrapper_helper: true
|
27
28
|
examples:
|
28
29
|
default:
|
29
30
|
embed: |
|
@@ -100,20 +101,3 @@ examples:
|
|
100
101
|
<p class="govuk-body">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed imperdiet fringilla dictum. Morbi at vehicula augue. Pellentesque varius orci et augue pellentesque, sed elementum massa posuere. Curabitur egestas consectetur arcu, in porta lorem sagittis eu. Nulla facilisi. Sed scelerisque ligula lectus. Nulla et ligula a eros laoreet lacinia nec et ipsum. Ut sagittis sapien est, ut blandit risus laoreet at. Vestibulum vitae erat sed dolor ultricies efficitur.</p>
|
101
102
|
<p class="govuk-body">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed imperdiet fringilla dictum. Morbi at vehicula augue. Pellentesque varius orci et augue pellentesque, sed elementum massa posuere. Curabitur egestas consectetur arcu, in porta lorem sagittis eu. Nulla facilisi. Sed scelerisque ligula lectus. Nulla et ligula a eros laoreet lacinia nec et ipsum. Ut sagittis sapien est, ut blandit risus laoreet at. Vestibulum vitae erat sed dolor ultricies efficitur.</p>
|
102
103
|
<p class="govuk-body">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed imperdiet fringilla dictum. Morbi at vehicula augue. Pellentesque varius orci et augue pellentesque, sed elementum massa posuere. Curabitur egestas consectetur arcu, in porta lorem sagittis eu. Nulla facilisi. Sed scelerisque ligula lectus. Nulla et ligula a eros laoreet lacinia nec et ipsum. Ut sagittis sapien est, ut blandit risus laoreet at. Vestibulum vitae erat sed dolor ultricies efficitur.</p>
|
103
|
-
with_data_attributes:
|
104
|
-
embed: |
|
105
|
-
<%= render "govuk_publishing_components/components/button", {
|
106
|
-
text: "Open modal with data attributes",
|
107
|
-
data_attributes: {
|
108
|
-
toggle: "modal",
|
109
|
-
target: "modal-with-data-attributes"
|
110
|
-
}
|
111
|
-
} %>
|
112
|
-
<%= component %>
|
113
|
-
data:
|
114
|
-
id: modal-with-data-attributes
|
115
|
-
data_attributes:
|
116
|
-
gtm: modal
|
117
|
-
block: |
|
118
|
-
<h1 class="govuk-heading-l">Modal title</h1>
|
119
|
-
<p class="govuk-body">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed imperdiet fringilla dictum. Morbi at vehicula augue. Pellentesque varius orci et augue pellentesque, sed elementum massa posuere. Curabitur egestas consectetur arcu, in porta lorem sagittis eu. Nulla facilisi. Sed scelerisque ligula lectus. Nulla et ligula a eros laoreet lacinia nec et ipsum. Ut sagittis sapien est, ut blandit risus laoreet at. Vestibulum vitae erat sed dolor ultricies efficitur.</p>
|
@@ -15,6 +15,9 @@ module GovukPublishingComponents
|
|
15
15
|
check_tabindex_is_valid(@options[:tabindex]) if @options.include?(:tabindex)
|
16
16
|
check_dir_is_valid(@options[:dir]) if @options.include?(:dir)
|
17
17
|
check_type_is_valid(@options[:type]) if @options.include?(:type)
|
18
|
+
check_draggable_is_valid(@options[:draggable]) if @options.include?(:draggable)
|
19
|
+
check_rel_is_valid(@options[:rel]) if @options.include?(:rel)
|
20
|
+
check_target_is_valid(@options[:target]) if @options.include?(:target)
|
18
21
|
check_margin_bottom_is_valid(@options[:margin_bottom]) if @options.include?(:margin_bottom)
|
19
22
|
end
|
20
23
|
|
@@ -35,6 +38,10 @@ module GovukPublishingComponents
|
|
35
38
|
attributes[:tabindex] = @options[:tabindex] unless @options[:tabindex].blank?
|
36
39
|
attributes[:dir] = @options[:dir] unless @options[:dir].blank?
|
37
40
|
attributes[:type] = @options[:type] unless @options[:type].blank?
|
41
|
+
attributes[:draggable] = @options[:draggable] unless @options[:draggable].blank?
|
42
|
+
attributes[:rel] = @options[:rel] unless @options[:rel].blank?
|
43
|
+
attributes[:target] = @options[:target] unless @options[:target].blank?
|
44
|
+
attributes[:title] = @options[:title] unless @options[:title].blank?
|
38
45
|
|
39
46
|
attributes
|
40
47
|
end
|
@@ -94,6 +101,30 @@ module GovukPublishingComponents
|
|
94
101
|
@options[:type] = type_attribute
|
95
102
|
end
|
96
103
|
|
104
|
+
def set_draggable(draggable_attribute)
|
105
|
+
check_draggable_is_valid(draggable_attribute)
|
106
|
+
@options[:draggable] = draggable_attribute
|
107
|
+
end
|
108
|
+
|
109
|
+
def add_rel(rel_attribute)
|
110
|
+
check_rel_is_valid(rel_attribute)
|
111
|
+
extend_string(:rel, rel_attribute)
|
112
|
+
end
|
113
|
+
|
114
|
+
def set_rel(rel_attribute)
|
115
|
+
check_rel_is_valid(rel_attribute)
|
116
|
+
@options[:rel] = rel_attribute
|
117
|
+
end
|
118
|
+
|
119
|
+
def set_target(target_attribute)
|
120
|
+
check_target_is_valid(target_attribute)
|
121
|
+
@options[:target] = target_attribute
|
122
|
+
end
|
123
|
+
|
124
|
+
def set_title(title_attribute)
|
125
|
+
@options[:title] = title_attribute
|
126
|
+
end
|
127
|
+
|
97
128
|
def set_margin_bottom(margin_bottom)
|
98
129
|
check_margin_bottom_is_valid(margin_bottom)
|
99
130
|
@options[:margin_bottom] = margin_bottom
|
@@ -191,7 +222,7 @@ module GovukPublishingComponents
|
|
191
222
|
end
|
192
223
|
|
193
224
|
def check_dir_is_valid(dir_attribute)
|
194
|
-
return if dir_attribute.
|
225
|
+
return if dir_attribute.blank?
|
195
226
|
|
196
227
|
options = %w[ltr rtl auto]
|
197
228
|
unless options.include? dir_attribute
|
@@ -200,7 +231,7 @@ module GovukPublishingComponents
|
|
200
231
|
end
|
201
232
|
|
202
233
|
def check_type_is_valid(type_attribute)
|
203
|
-
return if type_attribute.
|
234
|
+
return if type_attribute.blank?
|
204
235
|
|
205
236
|
options = %w[button checkbox color date datetime-local email file hidden image month number password radio range reset search submit tel text time url week]
|
206
237
|
unless options.include? type_attribute
|
@@ -208,6 +239,34 @@ module GovukPublishingComponents
|
|
208
239
|
end
|
209
240
|
end
|
210
241
|
|
242
|
+
def check_draggable_is_valid(draggable_attribute)
|
243
|
+
return if draggable_attribute.blank?
|
244
|
+
|
245
|
+
options = %w[true false]
|
246
|
+
unless options.include? draggable_attribute
|
247
|
+
raise(ArgumentError, "draggable attribute (#{draggable_attribute}) is not recognised")
|
248
|
+
end
|
249
|
+
end
|
250
|
+
|
251
|
+
def check_rel_is_valid(rel_attribute)
|
252
|
+
return if rel_attribute.blank?
|
253
|
+
|
254
|
+
options = %w[alternate author bookmark canonical dns-prefetch external expect help icon license manifest me modulepreload next nofollow noopener noreferrer opener pingback preconnect prefetch preload prerender prev privacy-policy search stylesheet tag terms-of-service]
|
255
|
+
rel_array = rel_attribute.split(" ")
|
256
|
+
unless rel_array.all? { |r| options.include? r }
|
257
|
+
raise(ArgumentError, "rel attribute (#{rel_attribute}) is not recognised")
|
258
|
+
end
|
259
|
+
end
|
260
|
+
|
261
|
+
def check_target_is_valid(target_attribute)
|
262
|
+
return if target_attribute.blank?
|
263
|
+
|
264
|
+
options = %w[_self _blank _parent _top _unfencedTop]
|
265
|
+
unless options.include? target_attribute
|
266
|
+
raise(ArgumentError, "target attribute (#{target_attribute}) is not recognised")
|
267
|
+
end
|
268
|
+
end
|
269
|
+
|
211
270
|
def extend_string(option, string)
|
212
271
|
((@options[option] ||= "") << " #{string}").strip!
|
213
272
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: govuk_publishing_components
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 49.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GOV.UK Dev
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-01-
|
10
|
+
date: 2025-01-16 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: govuk_app_config
|