effective_bootstrap 0.4.5 → 0.4.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/helpers/effective_bootstrap_helper.rb +22 -0
- data/lib/effective_bootstrap/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 001fe5fbf1a05352d82ae59be2b0181078e391f2
|
4
|
+
data.tar.gz: 24d5ec77cc725518659bcde94d09e80a37209395
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95d57accc1d088e060bfb7c1d66deb5625dca51f627e1c0f7cdb7d68f80589d68f192cc22bbd33efe6c17b9260e045d3c14bbd3e72b27bfbe44df30a1a9a81d6
|
7
|
+
data.tar.gz: 5ab5aa1dfd214b0ff47935425f9839ab55c888f8c9a6beb072845bee00c5a586261d7df3e8da7db9d05d1dcdb6c224dda15406ef0a073cff88ca0e3bf80766d5
|
@@ -1,6 +1,28 @@
|
|
1
1
|
# Boostrap4 Helpers
|
2
2
|
|
3
3
|
module EffectiveBootstrapHelper
|
4
|
+
# https://getbootstrap.com/docs/4.0/components/collapse/
|
5
|
+
|
6
|
+
# = collapse('toggle visibility') do
|
7
|
+
# %p Something
|
8
|
+
# %p Collapsed
|
9
|
+
|
10
|
+
# collapse(items.length, class: 'btn btn-primary') do
|
11
|
+
# items.map { |item| content_tag(:div, item.to_s) }.join.html_safe
|
12
|
+
# end
|
13
|
+
def collapse(label, opts = {}, &block)
|
14
|
+
raise 'expected a block' unless block_given?
|
15
|
+
|
16
|
+
id = "collapse-#{''.object_id}"
|
17
|
+
|
18
|
+
link_opts = { 'data-toggle': 'collapse', role: 'button', href: "##{id}", 'aria-controls': "##{id}", 'aria-expanded': false }
|
19
|
+
|
20
|
+
content_tag(:a, label, link_opts.merge(opts)) +
|
21
|
+
content_tag(:div, class: 'collapse', id: id) do
|
22
|
+
content_tag(:div, capture(&block), class: 'card card-body mt-2')
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
4
26
|
# Button Dropdowns
|
5
27
|
# https://getbootstrap.com/docs/4.0/components/dropdowns/
|
6
28
|
#
|