govuk-components 1.1.1 → 1.1.6
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/app/components/govuk_component/accordion.html.erb +1 -1
- data/app/components/govuk_component/accordion.rb +9 -2
- data/app/components/govuk_component/breadcrumbs.rb +8 -3
- data/app/components/govuk_component/notification_banner.rb +1 -1
- data/lib/govuk/components/version.rb +1 -1
- metadata +20 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc5053813a261dbf7186f651f83acd14de2649b640fd92b6a4c3012caa6a8275
|
4
|
+
data.tar.gz: 43d9197a5f643ddd30e9b4eb65853f3426eb709788a208b5d9d627e394318a9f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c23bc16a3acefaefc365388925f769529593371ec7352be230d255f75288610d8cd2c49ccb31ac5c18515bfbff008b7045fa00359c164b52c0a05133331b1147
|
7
|
+
data.tar.gz: e6dbb5cb608edb3c7f0412fdc7f1e90aa02cc8176ba312660323f2c2c18479c693735b41bc78bb84855aff50c455ac2ff94ff1f1c327716ede2167bae176ad25
|
@@ -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
|
@@ -1,15 +1,20 @@
|
|
1
1
|
class GovukComponent::Breadcrumbs < GovukComponent::Base
|
2
2
|
attr_accessor :breadcrumbs
|
3
3
|
|
4
|
-
def initialize(breadcrumbs:, classes: [], html_attributes: {})
|
4
|
+
def initialize(breadcrumbs:, hide_in_print: false, collapse_on_mobile: false, classes: [], html_attributes: {})
|
5
5
|
super(classes: classes, html_attributes: html_attributes)
|
6
6
|
|
7
|
-
@breadcrumbs
|
7
|
+
@breadcrumbs = breadcrumbs
|
8
|
+
@hide_in_print = hide_in_print
|
9
|
+
@collapse_on_mobile = collapse_on_mobile
|
8
10
|
end
|
9
11
|
|
10
12
|
private
|
11
13
|
|
12
14
|
def default_classes
|
13
|
-
%w(govuk-breadcrumbs)
|
15
|
+
%w(govuk-breadcrumbs).tap do |classes|
|
16
|
+
classes << "govuk-!-display-none-print" if @hide_in_print
|
17
|
+
classes << "govuk-breadcrumbs--collapse-on-mobile" if @collapse_on_mobile
|
18
|
+
end
|
14
19
|
end
|
15
20
|
end
|
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.6
|
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-26 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.26.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
|
@@ -215,7 +223,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
215
223
|
- !ruby/object:Gem::Version
|
216
224
|
version: '0'
|
217
225
|
requirements: []
|
218
|
-
rubygems_version: 3.1.
|
226
|
+
rubygems_version: 3.1.4
|
219
227
|
signing_key:
|
220
228
|
specification_version: 4
|
221
229
|
summary: Lightweight set of reusable GOV.UK Design System components
|