effective_bootstrap 0.5.12 → 0.5.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/helpers/effective_bootstrap_helper.rb +10 -6
- 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: 304054fe5d1bb425baf0317458767ca21d106349222cde6575928b0e94efcb15
|
4
|
+
data.tar.gz: 4b158a21a29561a6aef46b56acc3121e69117d830089d8041f6f2bcb0ab6e149
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0012550c7d4c442ef9cfca8a036472f588cff000151d9afe1bcc0518d59833e531c4b62aafb8df3d42bf33d06360c5bb99977870ae8839ec8cbe3a052c87aa6
|
7
|
+
data.tar.gz: fd72295a790e104d0f19ca95e7c8fea04d8b15bce7c607f798412afbd28f3ebd3319444b464f358a5fa0ab1732fcefd2316c7b907fb183e65bc3346e603ab9e2
|
@@ -4,22 +4,26 @@ module EffectiveBootstrapHelper
|
|
4
4
|
# https://getbootstrap.com/docs/4.0/components/collapse/
|
5
5
|
|
6
6
|
# = collapse('toggle visibility') do
|
7
|
-
# %p Something
|
8
|
-
# %p Collapsed
|
7
|
+
# %p Something Collapsed
|
9
8
|
|
10
|
-
# collapse(
|
9
|
+
# = collapse('already expanded', show: true) do
|
10
|
+
# %p Something Expanded
|
11
|
+
|
12
|
+
# collapse(items.length, class: 'btn btn-primary', card_class: 'mt-2') do
|
11
13
|
# items.map { |item| content_tag(:div, item.to_s) }.join.html_safe
|
12
14
|
# end
|
13
15
|
def collapse(label, opts = {}, &block)
|
14
16
|
raise 'expected a block' unless block_given?
|
15
17
|
|
16
18
|
id = "collapse-#{''.object_id}"
|
19
|
+
show = (opts.delete(:show) == true)
|
17
20
|
|
18
|
-
link_opts = { 'data-toggle': 'collapse', role: 'button', href: "##{id}", 'aria-controls': "##{id}", 'aria-expanded':
|
21
|
+
link_opts = { 'data-toggle': 'collapse', role: 'button', href: "##{id}", 'aria-controls': "##{id}", 'aria-expanded': show }
|
22
|
+
card_class = opts.delete(:card_class)
|
19
23
|
|
20
24
|
content_tag(:a, label, link_opts.merge(opts)) +
|
21
|
-
content_tag(:div, class: 'collapse',
|
22
|
-
content_tag(:div, capture(&block), class: 'card card-body
|
25
|
+
content_tag(:div, id: id, class: ['collapse', ('show' if show)].compact.join(' ')) do
|
26
|
+
content_tag(:div, capture(&block), class: ['card', 'card-body', card_class.presence].compact.join(' '))
|
23
27
|
end
|
24
28
|
end
|
25
29
|
|
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.5.
|
4
|
+
version: 0.5.13
|
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: 2019-
|
11
|
+
date: 2019-06-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|