govuk-components 1.1.0 → 1.1.5
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/README.md +1 -0
- data/app/components/govuk_component/accordion.html.erb +1 -1
- data/app/components/govuk_component/accordion.rb +9 -2
- data/app/components/govuk_component/cookie_banner.html.erb +21 -0
- data/app/components/govuk_component/cookie_banner.rb +18 -0
- data/app/components/govuk_component/notification_banner.html.erb +1 -1
- data/app/components/govuk_component/notification_banner.rb +1 -1
- data/app/helpers/govuk_components_helper.rb +1 -0
- data/lib/govuk/components/version.rb +1 -1
- metadata +22 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7bdf0839ecbe0f5046c63a0cca80caa808aa3b0d4f8d5f5280253523742d28d0
|
4
|
+
data.tar.gz: d4d694316d383bdbfe93f0f1974d0ca14daedbe24e7d48371636b75384ddebaf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3aec4489d49df3becca14855f389a4479f82393a6aa231e220f7553202252a8c51a0dab7fd4dfa514e879db12b9c12beacf0db0be0694f412510a81e5c2d486
|
7
|
+
data.tar.gz: 6429c8416c30dbd25c4afe381f0991f1b505e20faf74e99ad1fe32784345209da388d86ec980dda52c1d1aa3fd3b0f9a2e09d965cadf929e9fb2d6a65ec3c140
|
data/README.md
CHANGED
@@ -16,6 +16,7 @@ This gem provides a suite of reusable components for the [GOV.UK Design System](
|
|
16
16
|
| [Accordion](app/components/govuk_component/accordion.rb) | `govuk_accordion` |
|
17
17
|
| [Back link](app/components/govuk_component/back_link.rb) | `govuk_back_link` |
|
18
18
|
| [Breadcrumbs](app/components/govuk_component/breadcrumbs.rb) | `govuk_breadcrumbs` |
|
19
|
+
| [Cookie banner](app/components/govuk_component/cookie_banner.rb) | `govuk_cookie_banner` |
|
19
20
|
| [Details](app/components/govuk_component/details.rb) | `govuk_details` |
|
20
21
|
| [Footer](app/components/govuk_component/footer.rb) | `govuk_footer` |
|
21
22
|
| [Header](app/components/govuk_component/header.rb) | `govuk_header` |
|
@@ -3,7 +3,7 @@
|
|
3
3
|
<%= tag.div(id: section.id(suffix: 'section'), class: section.classes, **section.html_attributes) do %>
|
4
4
|
<div class="govuk-accordion__section-header">
|
5
5
|
<h2 class="govuk-accordion__section-heading">
|
6
|
-
<%= tag.span(section.title, id: section.id, class: "govuk-accordion__section-button") %>
|
6
|
+
<%= tag.span(section.title, id: section.id, class: "govuk-accordion__section-button", aria: { expanded: section.expanded? }) %>
|
7
7
|
</h2>
|
8
8
|
<% if section.summary.present? %>
|
9
9
|
<%= tag.div(section.summary, id: section.id(suffix: 'summary'), class: %w(govuk-accordion__section-summary govuk-body)) %>
|
@@ -19,19 +19,26 @@ private
|
|
19
19
|
end
|
20
20
|
|
21
21
|
class Section < GovukComponent::Slot
|
22
|
-
attr_accessor :title, :summary
|
22
|
+
attr_accessor :title, :summary, :expanded
|
23
23
|
|
24
|
-
|
24
|
+
alias_method :expanded?, :expanded
|
25
|
+
|
26
|
+
def initialize(title:, summary: nil, expanded: false, classes: [], html_attributes: {})
|
25
27
|
super(classes: classes, html_attributes: html_attributes)
|
26
28
|
|
27
29
|
self.title = title
|
28
30
|
self.summary = summary
|
31
|
+
self.expanded = expanded
|
29
32
|
end
|
30
33
|
|
31
34
|
def id(suffix: nil)
|
32
35
|
[title.parameterize, suffix].compact.join('-')
|
33
36
|
end
|
34
37
|
|
38
|
+
def classes
|
39
|
+
super + (expanded? ? %w(govuk-accordion__section--expanded) : [])
|
40
|
+
end
|
41
|
+
|
35
42
|
private
|
36
43
|
|
37
44
|
def default_classes
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<%= tag.div(class: classes, role: "region", aria: { label: aria_label }, **html_attributes) do %>
|
2
|
+
<div class="govuk-cookie-banner__message govuk-width-container">
|
3
|
+
<div class="govuk-grid-row">
|
4
|
+
<div class="govuk-grid-column-two-thirds">
|
5
|
+
<% if title.present? %>
|
6
|
+
<h2 class="govuk-cookie-banner__heading govuk-heading-m">
|
7
|
+
<%= title %>
|
8
|
+
</h2>
|
9
|
+
<% end %>
|
10
|
+
|
11
|
+
<div class="govuk-cookie-banner__content">
|
12
|
+
<%= body %>
|
13
|
+
</div>
|
14
|
+
</div>
|
15
|
+
</div>
|
16
|
+
|
17
|
+
<div class="govuk-button-group">
|
18
|
+
<%= actions %>
|
19
|
+
</div>
|
20
|
+
</div>
|
21
|
+
<% end %>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class GovukComponent::CookieBanner < GovukComponent::Base
|
2
|
+
with_content_areas :body, :actions
|
3
|
+
|
4
|
+
attr_accessor :title, :aria_label
|
5
|
+
|
6
|
+
def initialize(title: nil, aria_label: "Cookie banner", classes: [], html_attributes: {})
|
7
|
+
super(classes: classes, html_attributes: html_attributes)
|
8
|
+
|
9
|
+
@title = title
|
10
|
+
@aria_label = aria_label
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def default_classes
|
16
|
+
%w(govuk-cookie-banner)
|
17
|
+
end
|
18
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<%= tag.div(class: classes.append(success_class).compact,
|
1
|
+
<%= tag.div(class: classes.append(success_class).compact, role: "region", aria: { labelledby: title_id }, data: data_params, **html_attributes) do %>
|
2
2
|
<div class="govuk-notification-banner__header">
|
3
3
|
<%= content_tag(title_tag, class: "govuk-notification-banner__title", id: title_id) do %>
|
4
4
|
<%= title %>
|
@@ -3,6 +3,7 @@ module GovukComponentsHelper
|
|
3
3
|
govuk_accordion: 'GovukComponent::Accordion',
|
4
4
|
govuk_back_link: 'GovukComponent::BackLink',
|
5
5
|
govuk_breadcrumbs: 'GovukComponent::Breadcrumbs',
|
6
|
+
govuk_cookie_banner: 'GovukComponent::CookieBanner',
|
6
7
|
govuk_details: 'GovukComponent::Details',
|
7
8
|
govuk_footer: 'GovukComponent::Footer',
|
8
9
|
govuk_header: 'GovukComponent::Header',
|
metadata
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: govuk-components
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- DfE developers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-03-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: railties
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
@@ -25,25 +25,33 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '6.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: activemodel
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
34
|
-
- - "<"
|
35
|
-
- !ruby/object:Gem::Version
|
36
|
-
version: 2.25.0
|
33
|
+
version: '6.0'
|
37
34
|
type: :runtime
|
38
35
|
prerelease: false
|
39
36
|
version_requirements: !ruby/object:Gem::Requirement
|
40
37
|
requirements:
|
41
38
|
- - ">="
|
42
39
|
- !ruby/object:Gem::Version
|
43
|
-
version:
|
44
|
-
|
40
|
+
version: '6.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: view_component
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '2.20'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
45
53
|
- !ruby/object:Gem::Version
|
46
|
-
version: 2.
|
54
|
+
version: '2.20'
|
47
55
|
- !ruby/object:Gem::Dependency
|
48
56
|
name: capybara
|
49
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -160,6 +168,8 @@ files:
|
|
160
168
|
- app/components/govuk_component/base.rb
|
161
169
|
- app/components/govuk_component/breadcrumbs.html.erb
|
162
170
|
- app/components/govuk_component/breadcrumbs.rb
|
171
|
+
- app/components/govuk_component/cookie_banner.html.erb
|
172
|
+
- app/components/govuk_component/cookie_banner.rb
|
163
173
|
- app/components/govuk_component/details.html.erb
|
164
174
|
- app/components/govuk_component/details.rb
|
165
175
|
- app/components/govuk_component/footer.html.erb
|
@@ -213,7 +223,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
213
223
|
- !ruby/object:Gem::Version
|
214
224
|
version: '0'
|
215
225
|
requirements: []
|
216
|
-
rubygems_version: 3.1.
|
226
|
+
rubygems_version: 3.1.4
|
217
227
|
signing_key:
|
218
228
|
specification_version: 4
|
219
229
|
summary: Lightweight set of reusable GOV.UK Design System components
|