effective_bootstrap 0.6.13 → 0.6.14
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/helpers/effective_bootstrap_helper.rb +35 -3
- data/lib/effective_bootstrap/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d09651afef44e467ac4bc172e6f6848b3c7b4f2963d397ff537d0eb3f6a09aa
|
4
|
+
data.tar.gz: 017f6dc69cf9ccbf155ce434d92507af48e4d2df2d44bc195002d3a03108fc4d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a1ad447346b7471e0d189358e3db06a1aa65579abd361862e398009ec166055b3c3aeb33d57ba8bca3bbaa93caa3770ab41e22343367d8df4159e03d66dd806a
|
7
|
+
data.tar.gz: 2d754bdc159fb50a80f8a8ea8a15cc1a61528a1942da36f8012c08996018cba15d5044e7c2f53d3a3fc1469b32e578ea72272f34f3c2d3a45f50b233a4be0c27
|
@@ -1,6 +1,21 @@
|
|
1
1
|
# Boostrap4 Helpers
|
2
2
|
|
3
3
|
module EffectiveBootstrapHelper
|
4
|
+
# This is a special variant of collapse
|
5
|
+
# = accordion do
|
6
|
+
# = collapse('Add thing...') do
|
7
|
+
# %p Something to add
|
8
|
+
def accordion(options = nil, &block)
|
9
|
+
(options ||= {})[:class] = "accordion #{options.delete(:class)}".strip
|
10
|
+
|
11
|
+
id = "accordion-#{''.object_id}"
|
12
|
+
|
13
|
+
@_accordion_active = id
|
14
|
+
content = content_tag(:div, capture(&block), options.merge(id: id))
|
15
|
+
@_accordion_active = nil
|
16
|
+
content
|
17
|
+
end
|
18
|
+
|
4
19
|
# https://getbootstrap.com/docs/4.0/components/collapse/
|
5
20
|
|
6
21
|
# = collapse('toggle visibility') do
|
@@ -19,12 +34,29 @@ module EffectiveBootstrapHelper
|
|
19
34
|
show = (opts.delete(:show) == true)
|
20
35
|
|
21
36
|
link_opts = { 'data-toggle': 'collapse', role: 'button', href: "##{id}", 'aria-controls': "##{id}", 'aria-expanded': show }
|
37
|
+
|
38
|
+
link_opts[:class] = opts.delete(:link_class) || 'btn btn-link'
|
22
39
|
div_class = opts.delete(:div_class)
|
23
40
|
card_class = opts.delete(:card_class) || 'my-2'
|
24
41
|
|
25
|
-
|
26
|
-
|
27
|
-
content_tag(:div,
|
42
|
+
if @_accordion_active
|
43
|
+
# Accordion collapse
|
44
|
+
content_tag(:div, class: "card mb-0") do
|
45
|
+
content_tag(:div, class: "card-header") do
|
46
|
+
content_tag(:h2, class: "mb-0") do
|
47
|
+
content_tag(:button, label, link_opts.merge(class: "btn btn-link"))
|
48
|
+
end
|
49
|
+
end +
|
50
|
+
content_tag(:div, id: id, class: ['collapse', div_class, ('show' if show)].compact.join(' '), "data-parent": "##{@_accordion_active}") do
|
51
|
+
content_tag(:div, capture(&block), class: "card-body")
|
52
|
+
end
|
53
|
+
end
|
54
|
+
else
|
55
|
+
# Normal collapse
|
56
|
+
content_tag(:a, label, link_opts) +
|
57
|
+
content_tag(:div, id: id, class: ['collapse', div_class, ('show' if show)].compact.join(' ')) do
|
58
|
+
content_tag(:div, capture(&block), class: ['card', 'card-body', card_class].compact.join(' '))
|
59
|
+
end
|
28
60
|
end
|
29
61
|
end
|
30
62
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_bootstrap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-02-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|