govuk-components 1.1.1 → 1.1.2
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d3430369791dc162f3624dbd60986f511ab6d01134c26458f66c26229da1a104
|
|
4
|
+
data.tar.gz: b10aa6ae0151000e95f205b48125a5def70ff0a44824887503a1719a1f7c101b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cef1afe63eb5b9532db2c29e86d20fbf36373bdba14b8f9833e8fa770b8ca2029736bed2709bc89843fd41dd9e862c038992992a8101ae9562ff06d4f4e79523
|
|
7
|
+
data.tar.gz: 1040a0ad99e2946e32f88d985685abd167aecd0ae325c9fb4fc81ce20ecc6c832f551e4a03e1d22ec32eaafbdb9c741740c0a1e4473eb67dc9a3452ab6fad857
|
|
@@ -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
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
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.2
|
|
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-02
|
|
11
|
+
date: 2021-03-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|
|
@@ -33,7 +33,7 @@ dependencies:
|
|
|
33
33
|
version: 2.22.1
|
|
34
34
|
- - "<"
|
|
35
35
|
- !ruby/object:Gem::Version
|
|
36
|
-
version: 2.
|
|
36
|
+
version: 2.27.0
|
|
37
37
|
type: :runtime
|
|
38
38
|
prerelease: false
|
|
39
39
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -43,7 +43,7 @@ dependencies:
|
|
|
43
43
|
version: 2.22.1
|
|
44
44
|
- - "<"
|
|
45
45
|
- !ruby/object:Gem::Version
|
|
46
|
-
version: 2.
|
|
46
|
+
version: 2.27.0
|
|
47
47
|
- !ruby/object:Gem::Dependency
|
|
48
48
|
name: capybara
|
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|