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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 431900298f2dd1776506ce479700539f5e29d4f8e9632458be551407500b6514
4
- data.tar.gz: 321d4d181e2e541ee41a2794c23218a577b8c5c281d533b71d64040c6bd65a90
3
+ metadata.gz: 304054fe5d1bb425baf0317458767ca21d106349222cde6575928b0e94efcb15
4
+ data.tar.gz: 4b158a21a29561a6aef46b56acc3121e69117d830089d8041f6f2bcb0ab6e149
5
5
  SHA512:
6
- metadata.gz: 2c095eb23ead07a01b6b161c8f7c3eb8e03c51b2549db18a0e606e8d4ee48e79672f3142fa94ad43f1c79b5812b01c2694e2fc9438f5aca815d28ceea6aae66d
7
- data.tar.gz: 6785956d550af1b250a4b6bc7de5196dc617dbfc592f800461b94c45056e3612fdef20742f42f26279d7a962464ab5895eadf03836ccdd0c87c0bd811277a665
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(items.length, class: 'btn btn-primary') do
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': false }
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', id: id) do
22
- content_tag(:div, capture(&block), class: 'card card-body mt-2')
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
 
@@ -1,3 +1,3 @@
1
1
  module EffectiveBootstrap
2
- VERSION = '0.5.12'.freeze
2
+ VERSION = '0.5.13'.freeze
3
3
  end
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.12
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-05-31 00:00:00.000000000 Z
11
+ date: 2019-06-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails