bootstrap5_helper 1.0.0 → 1.0.1

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: d1dd8831d61ec067033a1681a8b91fb1b867fd55f06d36f71aa52488d1733bbf
4
- data.tar.gz: b5ebdbdedc4454e8de46cf5f871159d671e66e631c660bc58f8046d82f6c5871
3
+ metadata.gz: ddd5360c6d7fb29c1cb1eaa28a882785b64ceaa1d39ed460eadef28a101de043
4
+ data.tar.gz: 676196ec53f4480ec0855b51a541b686627fb3b95b162059feb98174e5d82525
5
5
  SHA512:
6
- metadata.gz: 4b89389edc7232c9382e4889ddf8685b8ccf3b1057ae0e0a7a0281126c3046d51560b08f7da716a3c9d03b0eccb9b53ad531d57054e128ebce54bd16b4032a87
7
- data.tar.gz: ce51660eca95ab8e0d1017eed62493cfdc4b048cd718f5728ea921e9dd9d91ef796a1550d0058c814d3759703cd33eb5f6e00b365b052cd901bd9f72fa910bc2
6
+ metadata.gz: fb1af7aa23cb5d2a989612b5ad8a5fa694fff894af7feeab2bb244f78b6395a546fc1bb6315e9b5b316164bfecee9d92042fab45dc8489590384fe9cba6a983a
7
+ data.tar.gz: a84bdbb6867e7a7c37e61a627fad0a0ce9f6bc136b45d73f164df130cc31313ec3416b87ff4c1e09fa35983323b999a5b3e245bfff9a1ab0d7c57ad2b0ff7055
@@ -11,18 +11,22 @@ module Bootstrap5Helper
11
11
  # @option opts [String] :id
12
12
  # @option opts [String] :class
13
13
  # @option opts [Hash] :data
14
+ # @option opts [Hash] :collapse
14
15
  #
15
16
  def initialize(template, parent_id = nil, opts = {}, &block)
16
17
  super(template)
17
18
 
18
- @parent = parent_id
19
- @id = opts.fetch(:id, uuid)
20
- @class = opts.fetch(:class, '')
21
- @data = opts.fetch(:data, {})
22
- @expanded = opts.fetch(:expanded, false)
23
- @header_id = uuid
24
- @collapse_id = uuid
25
- @content = block || proc { '' }
19
+ @parent = parent_id
20
+ @id = opts.fetch(:id, uuid)
21
+ @class = opts.fetch(:class, '')
22
+ @data = opts.fetch(:data, {})
23
+ @expanded = opts.fetch(:expanded, false)
24
+ @collapse = opts.fetch(:collapse, {})
25
+ @collapse_id = @collapse.fetch(:id, uuid)
26
+ @collapse_klass = @collapse.fetch(:class, '')
27
+ @collapse_data = @collapse.fetch(:data, {})
28
+ @header_id = uuid
29
+ @content = block || proc { '' }
26
30
  end
27
31
 
28
32
  # rubocop:disable Metrics/MethodLength
@@ -78,9 +82,11 @@ module Bootstrap5Helper
78
82
  content_tag(
79
83
  :div,
80
84
  id: @collapse_id,
81
- class: "accordion-collapse collapse #{@expanded ? 'show' : ''}",
85
+ class: "accordion-collapse collapse #{@collapse_klass} #{@expanded ? 'show' : ''}",
82
86
  aria: { labelledby: @header_id },
83
- data: { 'bs-parent' => @parent.present? ? "##{@parent}" : nil }
87
+ data: {
88
+ 'bs-parent' => @parent.present? ? "##{@parent}" : nil
89
+ }.merge(@collapse_data)
84
90
  ) do
85
91
  content_tag(
86
92
  :div,
@@ -24,6 +24,10 @@ module Bootstrap5Helper
24
24
  @content = block || proc { '' }
25
25
  end
26
26
 
27
+ # Used to generate a <tt>Accordion::Item</tt> component.
28
+ #
29
+ # @return [Accodion::Item]
30
+ #
27
31
  def item(*args, &block)
28
32
  Accordion::Item.new(self, (@always_open ? nil : @id), *args, &block)
29
33
  end
@@ -1,3 +1,3 @@
1
1
  module Bootstrap5Helper
2
- VERSION = '1.0.0'.freeze
2
+ VERSION = '1.0.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bootstrap5_helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert David
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-27 00:00:00.000000000 Z
11
+ date: 2022-09-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bootstrap