bootstrap4_helper 1.1.1 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bootstrap4_helper/accordion.rb +20 -17
- data/lib/bootstrap4_helper/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: dcd8899a1dfc67e56574cd1f0c78d65e45dc3cf6a5f1e9c87bb9c249c89f23e8
|
4
|
+
data.tar.gz: 1eabeb64cc4d1c29b7c47af427336b3c40b0a16b65917c5fb857ef293bb6f042
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d4d6840a43370f5743315e3cc8c7deae8f2679dc3482eae721850c70fa24f7b44f356a45fae10184ee7e24143b922b38d64e9a1e91c2187bcbace323330677b
|
7
|
+
data.tar.gz: bf48bdd5ce2000ca74854a4b5f1a68d50800d8f2ae1625145f4e47673c84673899b59e52466a778f6ef855de835fc6f51b8f41fcdb0d56a955d3ce74fdec92e6
|
@@ -11,26 +11,27 @@ module Bootstrap4Helper
|
|
11
11
|
].freeze
|
12
12
|
|
13
13
|
# Class constructor
|
14
|
-
# -
|
15
14
|
#
|
16
15
|
# @param [ActionView] template
|
17
16
|
# @param [Hash] opts
|
18
|
-
# @option opts [String]
|
19
|
-
# @option opts [String]
|
20
|
-
# @option opts [Hash]
|
21
|
-
# @option opts [String]
|
22
|
-
# @option opts [String]
|
17
|
+
# @option opts [String] :id
|
18
|
+
# @option opts [String] :class
|
19
|
+
# @option opts [Hash] :data
|
20
|
+
# @option opts [String] :parent
|
21
|
+
# @option opts [String] :target
|
22
|
+
# @option opts [Boolean] :expanded
|
23
23
|
#
|
24
24
|
def initialize(template, opts = {}, &block)
|
25
25
|
super(template)
|
26
26
|
|
27
|
-
@id
|
28
|
-
@class
|
29
|
-
@data
|
30
|
-
@parent
|
31
|
-
@
|
32
|
-
@
|
33
|
-
@
|
27
|
+
@id = opts.fetch(:id, uuid)
|
28
|
+
@class = opts.fetch(:class, '')
|
29
|
+
@data = opts.fetch(:data, {})
|
30
|
+
@parent = opts.fetch(:parent, nil)
|
31
|
+
@expanded = opts.fetch(:expanded, false)
|
32
|
+
@target = @data.fetch(:target, uuid)
|
33
|
+
@content = block || proc { '' }
|
34
|
+
@card = Card.new(@template)
|
34
35
|
end
|
35
36
|
|
36
37
|
# Builds a header component for the accordion, which is actually the header
|
@@ -61,9 +62,11 @@ module Bootstrap4Helper
|
|
61
62
|
# @return [String]
|
62
63
|
#
|
63
64
|
def body(opts = {}, &block)
|
64
|
-
data
|
65
|
+
data = { parent: "##{@parent}" } if @parent.present?
|
66
|
+
klass = 'collapse'
|
67
|
+
klass += ' show' if @expanded
|
65
68
|
|
66
|
-
content_tag :div, id: @target, class:
|
69
|
+
content_tag :div, id: @target, class: klass, data: data do
|
67
70
|
@card.body(opts, &block)
|
68
71
|
end
|
69
72
|
end
|
@@ -83,7 +86,7 @@ module Bootstrap4Helper
|
|
83
86
|
end
|
84
87
|
end
|
85
88
|
|
86
|
-
# Checks if the Object reponds to missing.
|
89
|
+
# Checks if the Object reponds to missing.
|
87
90
|
#
|
88
91
|
#
|
89
92
|
def respond_to_missing?(method, include_private = false)
|
@@ -96,7 +99,7 @@ module Bootstrap4Helper
|
|
96
99
|
# @return [String]
|
97
100
|
#
|
98
101
|
def to_s
|
99
|
-
content_tag :div, class: "card #{@class}", data: @data do
|
102
|
+
content_tag :div, id: @id, class: "card #{@class}", data: @data.except(:target) do
|
100
103
|
@content.call(self)
|
101
104
|
end
|
102
105
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bootstrap4_helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert David
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -182,7 +182,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
182
182
|
- !ruby/object:Gem::Version
|
183
183
|
version: '0'
|
184
184
|
requirements: []
|
185
|
-
rubygems_version: 3.1
|
185
|
+
rubygems_version: 3.0.1
|
186
186
|
signing_key:
|
187
187
|
specification_version: 4
|
188
188
|
summary: Library for rapidly building bootstrap 4 components
|