govuk_publishing_components 47.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/assets/javascripts/govuk_publishing_components/rum-custom-data.js +18 -0
- data/app/assets/javascripts/govuk_publishing_components/vendor/lux/lux-measurer.js +0 -37
- data/app/assets/stylesheets/govuk_publishing_components/components/_govspeak.scss +0 -1
- 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/_intervention.html.erb +10 -14
- data/app/views/govuk_publishing_components/components/_layout_footer.html.erb +0 -1
- data/app/views/govuk_publishing_components/components/_layout_for_public.html.erb +1 -0
- 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 +9 -21
- data/app/views/govuk_publishing_components/components/_list.html.erb +6 -12
- 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/_search.html.erb +17 -21
- data/app/views/govuk_publishing_components/components/_secondary_navigation.html.erb +0 -1
- data/app/views/govuk_publishing_components/components/_subscription_links.html.erb +5 -11
- data/app/views/govuk_publishing_components/components/_success_alert.html.erb +8 -12
- data/app/views/govuk_publishing_components/components/_summary_card.html.erb +4 -2
- data/app/views/govuk_publishing_components/components/_summary_list.html.erb +6 -2
- data/app/views/govuk_publishing_components/components/_translation_nav.html.erb +6 -5
- data/app/views/govuk_publishing_components/components/_warning_text.html.erb +5 -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/devolved_nations.yml +3 -3
- data/app/views/govuk_publishing_components/components/docs/document_list.yml +1 -2
- data/app/views/govuk_publishing_components/components/docs/govspeak.yml +0 -6
- data/app/views/govuk_publishing_components/components/docs/intervention.yml +1 -0
- data/app/views/govuk_publishing_components/components/docs/layout_footer.yml +0 -9
- data/app/views/govuk_publishing_components/components/docs/layout_super_navigation_header.yml +1 -0
- data/app/views/govuk_publishing_components/components/docs/list.yml +3 -1
- data/app/views/govuk_publishing_components/components/docs/modal_dialogue.yml +1 -17
- data/app/views/govuk_publishing_components/components/docs/search.yml +2 -2
- data/app/views/govuk_publishing_components/components/docs/subscription_links.yml +1 -0
- data/app/views/govuk_publishing_components/components/docs/success_alert.yml +1 -0
- data/app/views/govuk_publishing_components/components/docs/summary_card.yml +1 -0
- data/app/views/govuk_publishing_components/components/docs/summary_list.yml +1 -0
- data/app/views/govuk_publishing_components/components/docs/translation_nav.yml +1 -0
- data/app/views/govuk_publishing_components/components/docs/warning_text.yml +1 -0
- data/app/views/govuk_publishing_components/components/layout_for_public/_account-layout.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/layout_header/_search.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 +76 -1
- data/lib/govuk_publishing_components/presenters/devolved_nations_helper.rb +4 -4
- data/lib/govuk_publishing_components/version.rb +1 -1
- metadata +3 -3
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_advisory.scss +0 -36
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
|
@@ -0,0 +1,18 @@
|
|
1
|
+
(function () {
|
2
|
+
/* global LUX, performance */
|
3
|
+
if (typeof LUX === 'undefined') { return }
|
4
|
+
|
5
|
+
const navigationPerformance = performance.getEntriesByType('navigation')[0]
|
6
|
+
if (!navigationPerformance) { return }
|
7
|
+
|
8
|
+
// As per RFC 147[1], this adds in monitoring of the type of HTTP protocol that
|
9
|
+
// is used when a browser loads a page.
|
10
|
+
// [1]: https://github.com/alphagov/govuk-rfcs/pull/148
|
11
|
+
LUX.addData('http-protocol', navigationPerformance.nextHopProtocol)
|
12
|
+
|
13
|
+
const serverTiming = navigationPerformance.serverTiming
|
14
|
+
if (serverTiming) {
|
15
|
+
const cacheState = serverTiming.find(entry => ['cacheHit', 'cacheMiss'].includes(entry.name))
|
16
|
+
if (cacheState) { LUX.addData('cache', cacheState.name) }
|
17
|
+
}
|
18
|
+
}())
|
@@ -157,40 +157,3 @@ if (
|
|
157
157
|
LongTaskObserver.observe({ type: ["longtask"] });
|
158
158
|
} catch (e) {}
|
159
159
|
}
|
160
|
-
|
161
|
-
// As per RFC 147[1], this adds in monitoring of the type of HTTP protocol that
|
162
|
-
// is used when a browser loads a page.
|
163
|
-
//
|
164
|
-
// The User Timing API (aka window.performance) is used to record the data - to
|
165
|
-
// avoid the use of this from breaking the JavaScript for the small number of
|
166
|
-
// browsers that don't support it, it's been wrapped in a try/catch block plus a
|
167
|
-
// couple of checks to prevent "is not defined" errors.
|
168
|
-
//
|
169
|
-
// Because the `nextHopProtocol` isn't immediately available - it seems to need
|
170
|
-
// a request to be made before it's populated - we need to wait for the
|
171
|
-
// `DOMContentReady` event before we can see what the HTTP version is.
|
172
|
-
//
|
173
|
-
// [1]: https://github.com/alphagov/govuk-rfcs/pull/148
|
174
|
-
|
175
|
-
var measureHTTPProtocol = function () {
|
176
|
-
var getEntriesByType = performance.getEntriesByType('navigation')
|
177
|
-
|
178
|
-
if (typeof getEntriesByType !== 'undefined' && getEntriesByType.length > 0) {
|
179
|
-
var httpProtocol = getEntriesByType[0].nextHopProtocol
|
180
|
-
LUX.addData("http-protocol", httpProtocol)
|
181
|
-
}
|
182
|
-
}
|
183
|
-
|
184
|
-
try {
|
185
|
-
if (typeof performance !== 'undefined' && typeof performance.getEntriesByType !== 'undefined') {
|
186
|
-
if (document.readyState === 'complete') {
|
187
|
-
measureHTTPProtocol()
|
188
|
-
} else {
|
189
|
-
window.addEventListener('load', function() {
|
190
|
-
measureHTTPProtocol()
|
191
|
-
})
|
192
|
-
}
|
193
|
-
}
|
194
|
-
} catch (e) {
|
195
|
-
console.error('Error in LUX reporting the HTTP protocol (%s):', window.location, e)
|
196
|
-
}
|
@@ -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
|
} %>
|
@@ -9,15 +9,10 @@
|
|
9
9
|
hide ||= false
|
10
10
|
new_tab ||= false
|
11
11
|
|
12
|
-
data_attributes = {}
|
13
12
|
suggestion_data_attributes = {}
|
14
13
|
dismiss_data_attributes = {}
|
15
14
|
dismiss_link_data_attributes = {}
|
16
|
-
data_attributes[:module] = "intervention"
|
17
|
-
data_attributes["intervention-name"] = name
|
18
15
|
|
19
|
-
aria_attributes ||= {}
|
20
|
-
aria_attributes[:label] = 'Intervention'
|
21
16
|
|
22
17
|
options = {
|
23
18
|
name: name,
|
@@ -35,7 +30,6 @@
|
|
35
30
|
disable_ga4 ||= false
|
36
31
|
suggestion_data_attributes[:module] = "#{suggestion_data_attributes[:module]} ga4-link-tracker".strip unless disable_ga4
|
37
32
|
suggestion_data_attributes[:ga4_link] = { event_name: "navigation", type: "intervention", section: suggestion_text, index_link: 1, index_total: 1 }.to_json unless disable_ga4
|
38
|
-
data_attributes[:ga4_intervention_banner] = "" unless disable_ga4 # Added to the parent element for the GA4 pageview object to use
|
39
33
|
|
40
34
|
suggestion_tag_options = {
|
41
35
|
class: "govuk-link gem-c-force-print-link-styles",
|
@@ -52,18 +46,20 @@
|
|
52
46
|
suggestion_link_text = intervention_helper.accessible_text
|
53
47
|
end
|
54
48
|
|
55
|
-
section_options = {
|
56
|
-
class: "gem-c-intervention",
|
57
|
-
role: "region", aria: aria_attributes,
|
58
|
-
data: data_attributes,
|
59
|
-
}
|
60
|
-
section_options.merge!({ hidden: true }) if hide
|
61
|
-
|
62
49
|
dismiss_link_data_attributes[:module] = "#{dismiss_link_data_attributes[:module]} ga4-event-tracker".strip unless disable_ga4
|
63
50
|
dismiss_link_data_attributes[:ga4_event] = { event_name: "select_content", type: "intervention", section: suggestion_text, action: 'closed' }.to_json unless disable_ga4
|
51
|
+
|
52
|
+
component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
|
53
|
+
component_helper.add_class("gem-c-intervention")
|
54
|
+
component_helper.add_role("region")
|
55
|
+
component_helper.add_aria_attribute({ label: "Intervention"})
|
56
|
+
component_helper.add_data_attribute({ module: "intervention", intervention_name: name })
|
57
|
+
component_helper.add_data_attribute({ ga4_intervention_banner: "" }) unless disable_ga4 # Added to the parent element for the GA4 pageview object to use
|
58
|
+
component_helper.set_hidden("hidden") if hide
|
59
|
+
|
64
60
|
%>
|
65
61
|
<% if intervention_helper.show? %>
|
66
|
-
<%= tag.section
|
62
|
+
<%= tag.section(**component_helper.all_attributes) do %>
|
67
63
|
<p class="govuk-body">
|
68
64
|
<%= tag.span suggestion_text, class: "gem-c-intervention__textwrapper" if suggestion_text %>
|
69
65
|
<% if suggestion_link_text && suggestion_link_url %>
|
@@ -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 %>
|
@@ -65,6 +65,7 @@
|
|
65
65
|
<title><%= title %></title>
|
66
66
|
|
67
67
|
<%= javascript_include_tag "govuk_publishing_components/vendor/lux/lux-measurer", { async: true } %>
|
68
|
+
<%= javascript_include_tag "govuk_publishing_components/rum-custom-data", type: "module" %>
|
68
69
|
<%= javascript_include_tag "govuk_publishing_components/rum-loader",
|
69
70
|
{
|
70
71
|
async: true,
|
@@ -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
@@ -35,9 +35,6 @@
|
|
35
35
|
search_toggle_button_classes << "gem-c-layout-super-navigation-header__search-toggle-button--blue-background" if blue_background
|
36
36
|
search_toggle_button_classes << "gem-c-layout-super-navigation-header__search-toggle-button--large-navbar" if large_navbar
|
37
37
|
|
38
|
-
layout_super_navigation_header_classes = %w(gem-c-layout-super-navigation-header)
|
39
|
-
layout_super_navigation_header_classes << "gem-c-layout-super-navigation-header--blue-background" if blue_background
|
40
|
-
|
41
38
|
item_link_classes = %w(gem-c-layout-super-navigation-header__navigation-item-link)
|
42
39
|
item_link_classes << "gem-c-layout-super-navigation-header__navigation-item-link--blue-background" if blue_background
|
43
40
|
item_link_classes << "gem-c-layout-super-navigation-header__navigation-item-link--large-navbar" if large_navbar
|
@@ -64,16 +61,13 @@
|
|
64
61
|
dropdown_menu_classes << "gem-c-layout-super-navigation-header__navigation-dropdown-menu--large-navbar" if large_navbar
|
65
62
|
|
66
63
|
absolute_links_helper = GovukPublishingComponents::Presenters::AbsoluteLinksHelper.new()
|
64
|
+
|
65
|
+
component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
|
66
|
+
component_helper.add_class("gem-c-layout-super-navigation-header")
|
67
|
+
component_helper.add_class("gem-c-layout-super-navigation-header--blue-background") if blue_background
|
68
|
+
component_helper.add_data_attribute({ module: "ga4-event-tracker ga4-link-tracker", ga4_expandable: "" })
|
67
69
|
%>
|
68
|
-
<%=
|
69
|
-
{
|
70
|
-
role: "banner",
|
71
|
-
class: layout_super_navigation_header_classes,
|
72
|
-
data: {
|
73
|
-
module: "ga4-event-tracker ga4-link-tracker",
|
74
|
-
"ga4-expandable": '',
|
75
|
-
}
|
76
|
-
}) do %>
|
70
|
+
<%= tag.header(**component_helper.all_attributes) do %>
|
77
71
|
<div class="gem-c-layout-super-navigation-header__container govuk-clearfix">
|
78
72
|
<div class="govuk-width-container">
|
79
73
|
<%= content_tag(:div, {
|
@@ -317,7 +311,7 @@
|
|
317
311
|
label: "Site-wide",
|
318
312
|
}
|
319
313
|
) do %>
|
320
|
-
|
314
|
+
<%= render "govuk_publishing_components/components/search_with_autocomplete", {
|
321
315
|
name: "keywords",
|
322
316
|
inline_label: false,
|
323
317
|
label_size: "m",
|
@@ -326,15 +320,9 @@
|
|
326
320
|
size: "large",
|
327
321
|
margin_bottom: 0,
|
328
322
|
disable_corrections: true,
|
323
|
+
source_url: [Plek.new.website_root, "/api/search/autocomplete.json"].join,
|
324
|
+
source_key: "suggestions",
|
329
325
|
} %>
|
330
|
-
<% if ENV["GOVUK_DISABLE_SEARCH_AUTOCOMPLETE"] %>
|
331
|
-
<%= render "govuk_publishing_components/components/search", search_options %>
|
332
|
-
<% else %>
|
333
|
-
<%= render "govuk_publishing_components/components/search_with_autocomplete", search_options.merge({
|
334
|
-
source_url: [Plek.new.website_root, "/api/search/autocomplete.json"].join,
|
335
|
-
source_key: "suggestions",
|
336
|
-
}) %>
|
337
|
-
<% end %>
|
338
326
|
<% end %>
|
339
327
|
</div>
|
340
328
|
</div>
|
@@ -1,20 +1,14 @@
|
|
1
1
|
<%
|
2
|
-
aria_label ||= nil
|
3
2
|
extra_spacing ||= nil
|
4
|
-
id ||= nil
|
5
3
|
items ||= []
|
6
4
|
list_type ||= "unordered"
|
7
5
|
visible_counters ||= nil
|
8
6
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
classes << "govuk-list--spaced" if extra_spacing
|
15
|
-
# Setting the `margin_bottom` to 4 is the same as the default margin - so we
|
16
|
-
# can omit the override class. To do this we leave out `4` from the array:
|
17
|
-
classes << shared_helper.get_margin_bottom if [0,1,2,3,5,6,7,8,9].include?(local_assigns[:margin_bottom])
|
7
|
+
component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
|
8
|
+
component_helper.add_class("gem-c-list govuk-list")
|
9
|
+
component_helper.add_class("govuk-list--bullet") if visible_counters and list_type === "unordered"
|
10
|
+
component_helper.add_class("govuk-list--number") if visible_counters and list_type === "number"
|
11
|
+
component_helper.add_class("govuk-list--spaced") if extra_spacing
|
18
12
|
|
19
13
|
# Default list type is unordered list.
|
20
14
|
list_tag = "ul"
|
@@ -23,7 +17,7 @@
|
|
23
17
|
list_tag = "ol" if list_type === "number"
|
24
18
|
%>
|
25
19
|
<% if items.any? %>
|
26
|
-
<%= content_tag list_tag,
|
20
|
+
<%= content_tag list_tag, **component_helper.all_attributes do %>
|
27
21
|
<% items.each do |item| %>
|
28
22
|
<li><%= raw(item) %></li>
|
29
23
|
<% end %>
|
@@ -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
|
|
@@ -7,7 +7,7 @@
|
|
7
7
|
aria_controls ||= nil
|
8
8
|
button_text ||= t("components.search_box.search_button")
|
9
9
|
correction_value = "off" if local_assigns[:disable_corrections]
|
10
|
-
|
10
|
+
label_id ||= "search-main-" + SecureRandom.hex(4)
|
11
11
|
wrap_label_in_a_heading ||= false
|
12
12
|
label_margin_bottom ||= nil
|
13
13
|
label_size ||= nil
|
@@ -19,21 +19,17 @@
|
|
19
19
|
size ||= ""
|
20
20
|
value ||= ""
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
else
|
34
|
-
classes << "gem-c-search--on-white"
|
35
|
-
end
|
36
|
-
classes << "gem-c-search--separate-label" if local_assigns.include?(:inline_label) or local_assigns.include?(:label_size)
|
22
|
+
component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
|
23
|
+
component_helper.add_data_attribute({ module: "gem-toggle-input-class-on-focus" })
|
24
|
+
component_helper.add_class("gem-c-search govuk-!-display-none-print")
|
25
|
+
component_helper.add_class(shared_helper.get_margin_top)
|
26
|
+
component_helper.add_class("gem-c-search--large") if size == "large"
|
27
|
+
component_helper.add_class("gem-c-search--large-on-mobile") if size == "large-mobile"
|
28
|
+
component_helper.add_class("gem-c-search--homepage") if homepage
|
29
|
+
component_helper.add_class("gem-c-search--no-border") if no_border
|
30
|
+
component_helper.add_class("gem-c-search--on-govuk-blue") if local_assigns[:on_govuk_blue].eql?(true)
|
31
|
+
component_helper.add_class("gem-c-search--on-white") unless local_assigns[:on_govuk_blue].eql?(true)
|
32
|
+
component_helper.add_class("gem-c-search--separate-label") if local_assigns.include?(:inline_label) or local_assigns.include?(:label_size)
|
37
33
|
|
38
34
|
label_classes = []
|
39
35
|
if (shared_helper.valid_heading_size?(label_size))
|
@@ -46,12 +42,12 @@
|
|
46
42
|
label_classes << label_custom_class if label_custom_class
|
47
43
|
|
48
44
|
tag_label = capture do
|
49
|
-
tag.label(for:
|
45
|
+
tag.label(for: label_id, class: label_classes) do
|
50
46
|
label_text
|
51
47
|
end
|
52
48
|
end
|
53
49
|
%>
|
54
|
-
|
50
|
+
<%= tag.div(**component_helper.all_attributes) do %>
|
55
51
|
<% if wrap_label_in_a_heading %>
|
56
52
|
<%= content_tag(shared_helper.get_heading_level, class: "govuk-!-margin-0") do %>
|
57
53
|
<%= tag_label %>
|
@@ -67,7 +63,7 @@
|
|
67
63
|
},
|
68
64
|
enterkeyhint: "search",
|
69
65
|
class: "gem-c-search__item gem-c-search__input js-class-toggle",
|
70
|
-
id:
|
66
|
+
id: label_id,
|
71
67
|
name: name,
|
72
68
|
title: t("components.search_box.input_title"),
|
73
69
|
type: "search",
|
@@ -77,10 +73,10 @@
|
|
77
73
|
) %>
|
78
74
|
</div>
|
79
75
|
<div class="gem-c-search__item gem-c-search__submit-wrapper">
|
80
|
-
<%= tag.button class: "gem-c-search__submit", type: "submit",
|
76
|
+
<%= tag.button class: "gem-c-search__submit", type: "submit", enterkeyhint: "search" do %>
|
81
77
|
<%= button_text %>
|
82
78
|
<%= render "govuk_publishing_components/components/search/search_icon" %>
|
83
79
|
<% end %>
|
84
80
|
</div>
|
85
81
|
</div>
|
86
|
-
|
82
|
+
<% end %>
|
@@ -5,17 +5,11 @@
|
|
5
5
|
brand_helper = GovukPublishingComponents::AppHelpers::BrandHelper.new(brand)
|
6
6
|
|
7
7
|
sl_helper = GovukPublishingComponents::Presenters::SubscriptionLinksHelper.new(local_assigns)
|
8
|
-
shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
|
9
8
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
css_classes << shared_helper.get_margin_bottom unless local_assigns[:margin_bottom] == 0
|
15
|
-
css_classes << brand_helper.brand_class
|
16
|
-
css_classes << "gem-c-subscription-links--with-feed-box" if sl_helper.feed_link_box_value
|
17
|
-
|
18
|
-
data = {"module": "gem-toggle"} if sl_helper.feed_link_box_value
|
9
|
+
component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
|
10
|
+
component_helper.add_class("gem-c-subscription-links govuk-!-display-none-print #{brand_helper.brand_class}")
|
11
|
+
component_helper.add_class("gem-c-subscription-links--with-feed-box") if sl_helper.feed_link_box_value
|
12
|
+
component_helper.add_data_attribute({ module: "gem-toggle" }) if sl_helper.feed_link_box_value
|
19
13
|
|
20
14
|
hide_heading ||= false
|
21
15
|
|
@@ -23,7 +17,7 @@
|
|
23
17
|
feed_link_text_locale = local_assigns[:feed_link_text_locale].presence
|
24
18
|
%>
|
25
19
|
<% if sl_helper.component_data_is_valid? %>
|
26
|
-
<%= tag.section
|
20
|
+
<%= tag.section(**component_helper.all_attributes) do %>
|
27
21
|
<% unless hide_heading %>
|
28
22
|
<h2 class="gem-c-subscription-links__hidden-header visuallyhidden"><%= t("components.subscription_links.subscriptions") %></h2>
|
29
23
|
<% end %>
|
@@ -3,20 +3,16 @@
|
|
3
3
|
|
4
4
|
description ||= nil
|
5
5
|
title_id ||= "govuk-notification-banner-title-#{SecureRandom.hex(4)}"
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
|
7
|
+
component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
|
8
|
+
component_helper.add_class("gem-c-success-alert govuk-notification-banner govuk-notification-banner--success")
|
9
|
+
component_helper.add_role("alert")
|
10
|
+
component_helper.set_tabindex(-1)
|
11
|
+
component_helper.add_aria_attribute({ labelledby: title_id })
|
12
|
+
component_helper.add_data_attribute({ module: "initial-focus" })
|
9
13
|
%>
|
10
14
|
|
11
|
-
<%= tag.div
|
12
|
-
role: "alert",
|
13
|
-
tabindex: "-1",
|
14
|
-
aria: {
|
15
|
-
labelledby: title_id,
|
16
|
-
},
|
17
|
-
data: {
|
18
|
-
module: "initial-focus",
|
19
|
-
} do %>
|
15
|
+
<%= tag.div(**component_helper.all_attributes) do %>
|
20
16
|
<div class="govuk-notification-banner__header">
|
21
17
|
<%= tag.h2 t("components.success_alert.success"), class: "govuk-notification-banner__title", id: title_id %>
|
22
18
|
</div>
|
@@ -3,12 +3,14 @@
|
|
3
3
|
|
4
4
|
id ||= nil
|
5
5
|
title ||= nil
|
6
|
-
data_attributes ||= {}
|
7
6
|
summary_card_actions ||= []
|
8
7
|
rows ||=[]
|
8
|
+
|
9
|
+
component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
|
10
|
+
component_helper.add_class("gem-c-summary-card")
|
9
11
|
%>
|
10
12
|
<% if title || rows.any? %>
|
11
|
-
<%= tag.div
|
13
|
+
<%= tag.div(**component_helper.all_attributes) do %>
|
12
14
|
<%= tag.div class: "govuk-summary-card" do %>
|
13
15
|
<%= tag.div class: "govuk-summary-card__title-wrapper" do %>
|
14
16
|
<%= tag.h2 class: "govuk-summary-card__title" do %>
|
@@ -5,7 +5,6 @@
|
|
5
5
|
shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
|
6
6
|
heading_size = "m" unless shared_helper.valid_heading_size?(heading_size)
|
7
7
|
|
8
|
-
id ||= nil
|
9
8
|
title ||= nil
|
10
9
|
borderless ||= false
|
11
10
|
edit ||= {}
|
@@ -13,9 +12,14 @@
|
|
13
12
|
items ||= []
|
14
13
|
block ||= yield
|
15
14
|
wide_title ||= false
|
15
|
+
|
16
|
+
component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
|
17
|
+
component_helper.add_class("gem-c-summary-list")
|
18
|
+
component_helper.add_class("govuk-summary-list--no-border") if borderless
|
19
|
+
component_helper.add_class("gem-c-summary-list--wide-title") if wide_title
|
16
20
|
%>
|
17
21
|
<% if title || items.any? %>
|
18
|
-
<%= tag.div
|
22
|
+
<%= tag.div(**component_helper.all_attributes) do %>
|
19
23
|
<% if title %>
|
20
24
|
<%= content_tag(shared_helper.get_heading_level, title, class: "govuk-heading-#{heading_size} gem-c-summary-list__group-title") %>
|
21
25
|
|