bootstrap4_helper 1.1.1 → 1.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5955ec587e3cd9c46b93382fdbfefdb8e19283307e266e3d0d40ff60378c78f5
4
- data.tar.gz: 9c6dd4decbd54700ca73bbfc2372fc78360218a6b5fa3b8a21ee08e5b1d39058
3
+ metadata.gz: dcd8899a1dfc67e56574cd1f0c78d65e45dc3cf6a5f1e9c87bb9c249c89f23e8
4
+ data.tar.gz: 1eabeb64cc4d1c29b7c47af427336b3c40b0a16b65917c5fb857ef293bb6f042
5
5
  SHA512:
6
- metadata.gz: 86c09350eb4ed4514d1aa07d1346617920d99c9164e426f1d43c767539a4cd952f86674d4e14c506c3d911c7e0c1998ab0dce41c8ce4f710268b58d874dbb7c6
7
- data.tar.gz: 76dd20e7db8086165f1b78c97ebc4de3465db2b44393f847439a1da2ef60a95e1be4a180f6e73da7eb5a16f998604b889b8c613b3e1699f8423f424d7ab6a3ae
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] :id
19
- # @option opts [String] :class
20
- # @option opts [Hash] :data
21
- # @option opts [String] :parent
22
- # @option opts [String] :target
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 = opts.fetch(:id, uuid)
28
- @class = opts.fetch(:class, '')
29
- @data = opts.fetch(:data, {})
30
- @parent = opts.fetch(:parent, nil)
31
- @target = @data.fetch(:target, uuid)
32
- @content = block || proc { '' }
33
- @card = Card.new(@template)
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 = { parent: "##{@parent}" } if @parent.present?
65
+ data = { parent: "##{@parent}" } if @parent.present?
66
+ klass = 'collapse'
67
+ klass += ' show' if @expanded
65
68
 
66
- content_tag :div, id: @target, class: 'collapse', data: data do
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
@@ -1,3 +1,3 @@
1
1
  module Bootstrap4Helper
2
- VERSION = '1.1.1'.freeze
2
+ VERSION = '1.2.0'.freeze
3
3
  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.1.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: 2020-07-16 00:00:00.000000000 Z
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.3
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