govuk_publishing_components 39.0.0 → 39.2.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/components/accordion.js +5 -0
- data/app/assets/javascripts/govuk_publishing_components/components/cookie-banner.js +0 -3
- data/app/assets/javascripts/govuk_publishing_components/components/option-select.js +1 -1
- data/app/assets/javascripts/govuk_publishing_components/load-analytics.js +0 -4
- data/app/assets/stylesheets/govuk_publishing_components/components/_checkboxes.scss +0 -30
- data/app/assets/stylesheets/govuk_publishing_components/components/_document-list.scss +4 -1
- data/app/models/govuk_publishing_components/audit_components.rb +20 -0
- data/app/models/govuk_publishing_components/component_wrapper_helper_options.rb +1 -0
- data/app/views/govuk_publishing_components/audit/_component_contents.html.erb +59 -28
- data/app/views/govuk_publishing_components/components/_checkboxes.html.erb +10 -9
- data/app/views/govuk_publishing_components/components/docs/document_list.yml +1 -0
- data/lib/govuk_publishing_components/presenters/checkboxes_helper.rb +1 -4
- data/lib/govuk_publishing_components/presenters/component_wrapper_helper.rb +16 -0
- data/lib/govuk_publishing_components/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 895fb77bee020611a867bfa196666dd75c23450c1a6a56b38e46512e8a2d135b
|
4
|
+
data.tar.gz: 8bfd4714cce990a40d4f486471ffcb52ff62ad2ed76f91c7ffcf4c640098c83e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90f85a5fee2cc7c16a97772ad5d5b0f89800170a0d9c87084cb04d2e1ddc51919eda015b66d5437f564bb478d2efba9fc95e627b99aa7e7e8f871d52e5dd5f03
|
7
|
+
data.tar.gz: ab3c4e2d0ebfc6a9a1fc771644683bbda76dc90ecdd54da166dc062de264bd9ab419c50c6123fe3fa9250312a182f7d2275a728f465c65ea3e55e5adfc12e4be
|
@@ -24,6 +24,11 @@ window.GOVUK.Modules.GovukAccordion = window.GOVUKFrontend.Accordion;
|
|
24
24
|
}
|
25
25
|
|
26
26
|
GemAccordion.prototype.init = function () {
|
27
|
+
// Do not initialise if the accordion component from govuk-frontend has not initialised
|
28
|
+
if (this.$module.querySelector(this.showAllControls) === null) {
|
29
|
+
return
|
30
|
+
}
|
31
|
+
|
27
32
|
// Indicate that JavaScript has worked
|
28
33
|
this.$module.querySelector(this.showAllControls).classList.add('gem-c-accordion__show-all')
|
29
34
|
|
@@ -95,9 +95,6 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
95
95
|
this.$module.showConfirmationMessage()
|
96
96
|
this.$module.cookieBannerConfirmationMessage.focus()
|
97
97
|
|
98
|
-
if (window.GOVUK.analyticsInit) {
|
99
|
-
window.GOVUK.analyticsInit()
|
100
|
-
}
|
101
98
|
if (window.GOVUK.globalBarInit) {
|
102
99
|
window.GOVUK.globalBarInit.init()
|
103
100
|
}
|
@@ -49,7 +49,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
49
49
|
}
|
50
50
|
|
51
51
|
// Attach listener to update checked count
|
52
|
-
this.$optionsContainer.querySelector('.
|
52
|
+
this.$optionsContainer.querySelector('.govuk-checkboxes').addEventListener('change', this.updateCheckedCount.bind(this))
|
53
53
|
|
54
54
|
// Replace div.container-head with a button
|
55
55
|
this.replaceHeadingSpanWithButton()
|
@@ -10,39 +10,9 @@
|
|
10
10
|
margin-top: govuk-spacing(2);
|
11
11
|
margin-bottom: govuk-spacing(2);
|
12
12
|
padding: govuk-spacing(2) govuk-spacing(4);
|
13
|
-
|
14
|
-
&.gem-c-checkboxes__list {
|
15
|
-
padding-left: govuk-spacing(4);
|
16
|
-
}
|
17
|
-
}
|
18
|
-
|
19
|
-
.govuk-checkboxes__conditional {
|
20
|
-
margin-top: govuk-spacing(2);
|
21
|
-
margin-left: -(govuk-spacing(4) + 2px); // 22px
|
22
|
-
}
|
23
|
-
|
24
|
-
.gem-c-checkboxes__list {
|
25
|
-
padding-left: govuk-spacing(0);
|
26
|
-
margin: 0;
|
27
|
-
}
|
28
|
-
|
29
|
-
.gem-c-checkboxes__divider {
|
30
|
-
@include govuk-font($size: 19);
|
31
|
-
@include govuk-text-colour;
|
32
|
-
list-style-type: none;
|
33
|
-
margin-bottom: govuk-spacing(2);
|
34
|
-
text-align: center;
|
35
|
-
width: 40px;
|
36
13
|
}
|
37
14
|
|
38
15
|
.gem-c-checkboxes {
|
39
|
-
// this is complex but needed to override the govuk-frontend styles in
|
40
|
-
// https://github.com/alphagov/govuk-frontend/blob/b8058640b9602ecb6e1f66f887553190cbae7b46/src/components/hint/_hint.scss#L16
|
41
|
-
// our elements are wrapped in list items that already provide a margin-bottom
|
42
|
-
.govuk-label:not(.govuk-label--m):not(.govuk-label--l):not(.govuk-label--xl) + .govuk-hint {
|
43
|
-
margin-bottom: 0;
|
44
|
-
}
|
45
|
-
|
46
16
|
.gem-c-checkboxes__legend--hidden {
|
47
17
|
@include govuk-visually-hidden;
|
48
18
|
}
|
@@ -131,10 +131,13 @@
|
|
131
131
|
padding-top: govuk-spacing(2);
|
132
132
|
|
133
133
|
&::before {
|
134
|
-
content: "
|
134
|
+
content: "";
|
135
135
|
position: absolute;
|
136
136
|
left: 0;
|
137
|
+
width: govuk-spacing(3);
|
137
138
|
overflow: hidden;
|
139
|
+
border-top: solid 1px $govuk-text-colour;
|
140
|
+
transform: translate(0, 0.5em);
|
138
141
|
}
|
139
142
|
|
140
143
|
@include govuk-media-query($from: desktop) {
|
@@ -22,6 +22,8 @@ module GovukPublishingComponents
|
|
22
22
|
stylesheet: 0,
|
23
23
|
print_stylesheet: 0,
|
24
24
|
javascript: 0,
|
25
|
+
uses_govuk_frontend_js: 0,
|
26
|
+
uses_govuk_frontend_css: 0,
|
25
27
|
test: 0,
|
26
28
|
javascript_test: 0,
|
27
29
|
helper: 0,
|
@@ -120,6 +122,16 @@ module GovukPublishingComponents
|
|
120
122
|
details["#{type}_exists".to_sym] = true
|
121
123
|
details["#{type}_lines".to_sym] = count_lines_in(file)
|
122
124
|
details["#{type}_link".to_sym] = get_asset_link(type, component)
|
125
|
+
|
126
|
+
if type == "javascript" && uses_govuk_frontend_js?(file)
|
127
|
+
details[:uses_govuk_frontend_js] = true
|
128
|
+
@component_numbers[:uses_govuk_frontend_js] += 1
|
129
|
+
end
|
130
|
+
|
131
|
+
if type == "stylesheet" && uses_govuk_frontend_css?(file)
|
132
|
+
details[:uses_govuk_frontend_css] = true
|
133
|
+
@component_numbers[:uses_govuk_frontend_css] += 1
|
134
|
+
end
|
123
135
|
end
|
124
136
|
end
|
125
137
|
|
@@ -130,6 +142,14 @@ module GovukPublishingComponents
|
|
130
142
|
File.read(file).each_line.count
|
131
143
|
end
|
132
144
|
|
145
|
+
def uses_govuk_frontend_js?(file)
|
146
|
+
File.read(file).match(/require govuk\/components/)
|
147
|
+
end
|
148
|
+
|
149
|
+
def uses_govuk_frontend_css?(file)
|
150
|
+
File.read(file).match(/@import "govuk\/components/)
|
151
|
+
end
|
152
|
+
|
133
153
|
def clean_files(files, replace)
|
134
154
|
files.map { |file| clean_file_name(file.gsub(replace, "")) }.sort
|
135
155
|
end
|
@@ -10,6 +10,7 @@ This component uses the component wrapper helper. It accepts the following optio
|
|
10
10
|
- `classes` - accepts a space separated string of classes, these should not be used for styling and must be prefixed with `js-`
|
11
11
|
- `role` - accepts a space separated string of roles
|
12
12
|
- `lang` - accepts a language attribute value
|
13
|
+
- `open` - accepts an open attribute value (true or false)
|
13
14
|
"
|
14
15
|
end
|
15
16
|
end
|
@@ -1,44 +1,59 @@
|
|
1
|
+
<p class="govuk-body">
|
2
|
+
Numbers in table headers show column totals. Numbers in table cells show number of lines in files. Note that component test files cannot currently be detected in applications that use minitest instead of Rspec.</p>
|
3
|
+
</p>
|
1
4
|
<table class="govuk-table">
|
2
5
|
<thead class="govuk-table__head">
|
3
6
|
<tr class="govuk-table__row" <% if show_application_name %>data-audit-headings<% end %>>
|
4
7
|
<th scope="col" class="govuk-table__header sticky-table-header" data-component-type="total">Component</th>
|
5
|
-
<th scope="col" class="govuk-table__header sticky-table-header" data-component-type="template">
|
8
|
+
<th scope="col" class="govuk-table__header sticky-table-header" data-component-type="template" title="Component has a template">
|
6
9
|
Template
|
7
10
|
<% unless show_application_name %>
|
8
11
|
<span class="component__count"><%= passed_components[:component_numbers][:template] %></span>
|
9
12
|
<% end %>
|
10
13
|
</th>
|
11
|
-
<th scope="col" class="govuk-table__header sticky-table-header" data-component-type="stylesheet">
|
12
|
-
CSS
|
14
|
+
<th scope="col" class="govuk-table__header sticky-table-header" data-component-type="stylesheet" title="Component has a stylesheet">
|
15
|
+
CSS
|
13
16
|
<% unless show_application_name %>
|
14
17
|
<span class="component__count"><%= passed_components[:component_numbers][:stylesheet] %></span>
|
15
18
|
<% end %>
|
16
19
|
</th>
|
17
|
-
<th scope="col" class="govuk-table__header sticky-table-header" data-component-type="print_stylesheet">
|
18
|
-
Print
|
20
|
+
<th scope="col" class="govuk-table__header sticky-table-header" data-component-type="print_stylesheet" title="Component has print styles">
|
21
|
+
Print CSS
|
19
22
|
<% unless show_application_name %>
|
20
23
|
<span class="component__count"><%= passed_components[:component_numbers][:print_stylesheet] %></span>
|
21
24
|
<% end %>
|
22
25
|
</th>
|
23
|
-
<th scope="col" class="govuk-table__header sticky-table-header" data-component-type="javascript">
|
24
|
-
JS
|
26
|
+
<th scope="col" class="govuk-table__header sticky-table-header" data-component-type="javascript" title="Component has JavaScript">
|
27
|
+
JS
|
25
28
|
<% unless show_application_name %>
|
26
29
|
<span class="component__count"><%= passed_components[:component_numbers][:javascript] %></span>
|
27
30
|
<% end %>
|
28
31
|
</th>
|
29
|
-
<th scope="col" class="govuk-table__header sticky-table-header" data-component-type="test">
|
30
|
-
|
32
|
+
<th scope="col" class="govuk-table__header sticky-table-header" data-component-type="javascript_test" title="Component has a JavaScript test file">
|
33
|
+
JS test
|
31
34
|
<% unless show_application_name %>
|
32
|
-
<span class="component__count"><%= passed_components[:component_numbers][:
|
35
|
+
<span class="component__count"><%= passed_components[:component_numbers][:javascript_test] %></span>
|
33
36
|
<% end %>
|
34
37
|
</th>
|
35
|
-
<th scope="col" class="govuk-table__header sticky-table-header" data-component-type="
|
36
|
-
|
38
|
+
<th scope="col" class="govuk-table__header sticky-table-header" data-component-type="uses-govuk-frontend-css" title="Component includes styles imported from govuk-frontend">
|
39
|
+
GF CSS
|
37
40
|
<% unless show_application_name %>
|
38
|
-
<span class="component__count"><%= passed_components[:component_numbers][:
|
41
|
+
<span class="component__count"><%= passed_components[:component_numbers][:uses_govuk_frontend_css] %></span>
|
39
42
|
<% end %>
|
40
43
|
</th>
|
41
|
-
<th scope="col" class="govuk-table__header sticky-table-header" data-component-type="
|
44
|
+
<th scope="col" class="govuk-table__header sticky-table-header" data-component-type="uses-govuk-frontend-js" title="Component includes JavaScript imported from govuk-frontend">
|
45
|
+
GF JS
|
46
|
+
<% unless show_application_name %>
|
47
|
+
<span class="component__count"><%= passed_components[:component_numbers][:uses_govuk_frontend_js] %></span>
|
48
|
+
<% end %>
|
49
|
+
</th>
|
50
|
+
<th scope="col" class="govuk-table__header sticky-table-header" data-component-type="test" title="Component has a test file">
|
51
|
+
Test
|
52
|
+
<% unless show_application_name %>
|
53
|
+
<span class="component__count"><%= passed_components[:component_numbers][:test] %></span>
|
54
|
+
<% end %>
|
55
|
+
</th>
|
56
|
+
<th scope="col" class="govuk-table__header sticky-table-header" data-component-type="helper" title="Component has a helper file">
|
42
57
|
Helper
|
43
58
|
<% unless show_application_name %>
|
44
59
|
<span class="component__count"><%= passed_components[:component_numbers][:helper] %></span>
|
@@ -65,7 +80,7 @@
|
|
65
80
|
</th>
|
66
81
|
<td class="govuk-table__cell" data-component-type="template">
|
67
82
|
<% if component[:template_exists] %>
|
68
|
-
<a href="<%= component[:template_link] %>" class="govuk-link">
|
83
|
+
<a href="<%= component[:template_link] %>" class="govuk-link" title="This file has <%= component[:template_lines] %> lines">
|
69
84
|
<%= component[:template_lines] %>
|
70
85
|
<span class="govuk-visually-hidden">lines of code in <%= component[:name] %> template</span>
|
71
86
|
</a>
|
@@ -73,7 +88,7 @@
|
|
73
88
|
</td>
|
74
89
|
<td class="govuk-table__cell" data-component-type="stylesheet">
|
75
90
|
<% if component[:stylesheet_exists] %>
|
76
|
-
<a href="<%= component[:stylesheet_link] %>" class="govuk-link">
|
91
|
+
<a href="<%= component[:stylesheet_link] %>" class="govuk-link" title="This file has <%= component[:stylesheet_lines] %> lines">
|
77
92
|
<%= component[:stylesheet_lines] %>
|
78
93
|
<span class="govuk-visually-hidden">lines of code in <%= component[:name] %> stylesheet</span>
|
79
94
|
</a>
|
@@ -81,36 +96,52 @@
|
|
81
96
|
</td>
|
82
97
|
<td class="govuk-table__cell" data-component-type="print_stylesheet">
|
83
98
|
<% if component[:print_stylesheet_exists] %>
|
84
|
-
|
99
|
+
<span title="This component has a print stylesheet">
|
100
|
+
Yes
|
101
|
+
</span>
|
85
102
|
<% end %>
|
86
103
|
</td>
|
87
104
|
<td class="govuk-table__cell" data-component-type="javascript">
|
88
105
|
<% if component[:javascript_exists] %>
|
89
|
-
<a href="<%= component[:javascript_link] %>" class="govuk-link">
|
106
|
+
<a href="<%= component[:javascript_link] %>" class="govuk-link" title="This file has <%= component[:javascript_lines] %> lines">
|
90
107
|
<%= component[:javascript_lines] %>
|
91
108
|
<span class="govuk-visually-hidden">lines of code in <%= component[:name] %> javascript</span>
|
92
109
|
</a>
|
93
110
|
<% end %>
|
94
111
|
</td>
|
95
|
-
<td class="govuk-table__cell" data-component-type="test">
|
96
|
-
<% if component[:test_exists] %>
|
97
|
-
<a href="<%= component[:test_link] %>" class="govuk-link">
|
98
|
-
<%= component[:test_lines] %>
|
99
|
-
<span class="govuk-visually-hidden">lines of code in <%= component[:name] %> test</span>
|
100
|
-
</a>
|
101
|
-
<% end %>
|
102
|
-
</td>
|
103
112
|
<td class="govuk-table__cell" data-component-type="javascript_test">
|
104
113
|
<% if component[:javascript_test_exists] %>
|
105
|
-
<a href="<%= component[:javascript_test_link] %>" class="govuk-link">
|
114
|
+
<a href="<%= component[:javascript_test_link] %>" class="govuk-link" title="This file has <%= component[:javascript_test_lines] %> lines">
|
106
115
|
<%= component[:javascript_test_lines] %>
|
107
116
|
<span class="govuk-visually-hidden">lines of code in <%= component[:name] %> javascript test</span>
|
108
117
|
</a>
|
109
118
|
<% end %>
|
110
119
|
</td>
|
120
|
+
<td class="govuk-table__cell" data-component-type="uses-govuk-frontend-css">
|
121
|
+
<% if component[:uses_govuk_frontend_css] %>
|
122
|
+
<span title="Component includes styles imported from govuk-frontend">
|
123
|
+
Yes
|
124
|
+
</span>
|
125
|
+
<% end %>
|
126
|
+
</td>
|
127
|
+
<td class="govuk-table__cell" data-component-type="uses-govuk-frontend-js">
|
128
|
+
<% if component[:uses_govuk_frontend_js] %>
|
129
|
+
<span title="Component includes JavaScript imported from govuk-frontend">
|
130
|
+
Yes
|
131
|
+
</span>
|
132
|
+
<% end %>
|
133
|
+
</td>
|
134
|
+
<td class="govuk-table__cell" data-component-type="test">
|
135
|
+
<% if component[:test_exists] %>
|
136
|
+
<a href="<%= component[:test_link] %>" class="govuk-link" title="This file has <%= component[:test_lines] %> lines">
|
137
|
+
<%= component[:test_lines] %>
|
138
|
+
<span class="govuk-visually-hidden">lines of code in <%= component[:name] %> test</span>
|
139
|
+
</a>
|
140
|
+
<% end %>
|
141
|
+
</td>
|
111
142
|
<td class="govuk-table__cell" data-component-type="helper">
|
112
143
|
<% if component[:helper_exists] %>
|
113
|
-
<a href="<%= component[:helper_link] %>" class="govuk-link">
|
144
|
+
<a href="<%= component[:helper_link] %>" class="govuk-link" title="This file has <%= component[:helper_lines] %> lines">
|
114
145
|
<%= component[:helper_lines] %>
|
115
146
|
<span class="govuk-visually-hidden">lines of code in <%= component[:name] %> helper</span>
|
116
147
|
</a>
|
@@ -26,31 +26,32 @@
|
|
26
26
|
<%= tag.p error, id: "#{id}-error", class: "govuk-error-message" %>
|
27
27
|
<% end %>
|
28
28
|
|
29
|
-
<%= tag.
|
29
|
+
<%= tag.div class: "govuk-checkboxes", data: {
|
30
30
|
module: ('govuk-checkboxes' if cb_helper.has_conditional),
|
31
31
|
nested: ('true' if cb_helper.has_nested)
|
32
32
|
} do %>
|
33
33
|
<% cb_helper.items.each_with_index do |item, index| %>
|
34
34
|
<% if item === :or %>
|
35
|
-
<%= tag.
|
35
|
+
<%= tag.div t('components.checkboxes.or'), class: "govuk-checkboxes__divider" %>
|
36
36
|
<% else %>
|
37
|
-
<%= tag.
|
37
|
+
<%= tag.div class: "govuk-checkboxes__item" do %>
|
38
38
|
<%= cb_helper.checkbox_markup(item, index) %>
|
39
39
|
|
40
|
-
<% if item[:conditional] %>
|
41
|
-
<%= tag.div item[:conditional], id: "#{id}-#{index}-conditional-#{index}", class: "govuk-checkboxes__conditional govuk-checkboxes__conditional--hidden" %>
|
42
|
-
<% end %>
|
43
|
-
|
44
40
|
<% if item[:items].present? %>
|
45
|
-
<%= tag.
|
41
|
+
<%= tag.div id: "#{id}-nested-#{index}", class: "govuk-checkboxes--nested", data: { parent: "#{id}-#{index}" } do %>
|
46
42
|
<% item[:items].each_with_index do |nested_item, nested_index| %>
|
47
|
-
<%= tag.
|
43
|
+
<%= tag.div class: "govuk-checkboxes__item" do %>
|
48
44
|
<%= cb_helper.checkbox_markup(nested_item, "#{index}-#{nested_index}") %>
|
49
45
|
<% end %>
|
50
46
|
<% end %>
|
51
47
|
<% end %>
|
52
48
|
<% end %>
|
53
49
|
<% end %>
|
50
|
+
|
51
|
+
<% if item[:conditional] %>
|
52
|
+
<%= tag.div item[:conditional], id: "#{id}-#{index}-conditional-#{index}", class: "govuk-checkboxes__conditional govuk-checkboxes__conditional--hidden" %>
|
53
|
+
<% end %>
|
54
|
+
|
54
55
|
<% end %>
|
55
56
|
<% end %>
|
56
57
|
<% end %>
|
@@ -7,7 +7,6 @@ module GovukPublishingComponents
|
|
7
7
|
attr_reader :items,
|
8
8
|
:name,
|
9
9
|
:css_classes,
|
10
|
-
:list_classes,
|
11
10
|
:error,
|
12
11
|
:has_conditional,
|
13
12
|
:has_nested,
|
@@ -24,8 +23,6 @@ module GovukPublishingComponents
|
|
24
23
|
@css_classes << "govuk-checkboxes--small" if options[:small]
|
25
24
|
@error = true if options[:error]
|
26
25
|
|
27
|
-
@list_classes = %w[govuk-checkboxes gem-c-checkboxes__list]
|
28
|
-
|
29
26
|
# check if any item is set as being conditional
|
30
27
|
@has_conditional = options[:items].any? { |item| item.is_a?(Hash) && item[:conditional] }
|
31
28
|
@has_nested = options[:items].any? { |item| item.is_a?(Hash) && item[:items] }
|
@@ -100,7 +97,7 @@ module GovukPublishingComponents
|
|
100
97
|
capture do
|
101
98
|
concat check_box_tag(checkbox_name, checkbox[:value], checked, class: "govuk-checkboxes__input", id: checkbox_id, data:)
|
102
99
|
concat content_tag(:label, checkbox[:label], for: checkbox_id, class: "govuk-label govuk-checkboxes__label")
|
103
|
-
concat content_tag(:
|
100
|
+
concat content_tag(:div, checkbox[:hint], id: "#{checkbox_id}-item-hint", class: "govuk-hint govuk-checkboxes__hint") if checkbox[:hint]
|
104
101
|
end
|
105
102
|
end
|
106
103
|
end
|
@@ -10,6 +10,7 @@ module GovukPublishingComponents
|
|
10
10
|
check_aria_is_valid(@options[:aria]) if @options.include?(:aria)
|
11
11
|
check_role_is_valid(@options[:role]) if @options.include?(:role)
|
12
12
|
check_lang_is_valid(@options[:lang]) if @options.include?(:lang)
|
13
|
+
check_open_is_valid(@options[:open]) if @options.include?(:open)
|
13
14
|
end
|
14
15
|
|
15
16
|
def all_attributes
|
@@ -21,6 +22,7 @@ module GovukPublishingComponents
|
|
21
22
|
attributes[:class] = @options[:classes] unless @options[:classes].blank?
|
22
23
|
attributes[:role] = @options[:role] unless @options[:role].blank?
|
23
24
|
attributes[:lang] = @options[:lang] unless @options[:lang].blank?
|
25
|
+
attributes[:open] = @options[:open] unless @options[:open].blank?
|
24
26
|
|
25
27
|
attributes
|
26
28
|
end
|
@@ -55,6 +57,11 @@ module GovukPublishingComponents
|
|
55
57
|
@options[:lang] = lang
|
56
58
|
end
|
57
59
|
|
60
|
+
def set_open(open_attribute)
|
61
|
+
check_open_is_valid(open_attribute)
|
62
|
+
@options[:open] = open_attribute
|
63
|
+
end
|
64
|
+
|
58
65
|
private
|
59
66
|
|
60
67
|
def check_id_is_valid(id)
|
@@ -114,6 +121,15 @@ module GovukPublishingComponents
|
|
114
121
|
end
|
115
122
|
end
|
116
123
|
|
124
|
+
def check_open_is_valid(open_attribute)
|
125
|
+
return if open_attribute.blank?
|
126
|
+
|
127
|
+
options = [true, false]
|
128
|
+
unless options.include? open_attribute
|
129
|
+
raise(ArgumentError, "open attribute (#{open_attribute}) is not recognised")
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
117
133
|
def extend_string(option, string)
|
118
134
|
((@options[option] ||= "") << " #{string}").strip!
|
119
135
|
end
|
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: 39.
|
4
|
+
version: 39.2.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-
|
11
|
+
date: 2024-07-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: govuk_app_config
|
@@ -1605,7 +1605,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
1605
1605
|
- !ruby/object:Gem::Version
|
1606
1606
|
version: '0'
|
1607
1607
|
requirements: []
|
1608
|
-
rubygems_version: 3.5.
|
1608
|
+
rubygems_version: 3.5.14
|
1609
1609
|
signing_key:
|
1610
1610
|
specification_version: 4
|
1611
1611
|
summary: A gem to document components in GOV.UK frontend applications
|