bootstrap4_helper 1.2.0 → 1.2.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: dcd8899a1dfc67e56574cd1f0c78d65e45dc3cf6a5f1e9c87bb9c249c89f23e8
4
- data.tar.gz: 1eabeb64cc4d1c29b7c47af427336b3c40b0a16b65917c5fb857ef293bb6f042
3
+ metadata.gz: 201fec26b2a05fac10b958a08380937f58b38be45b6b67f90352c12871769206
4
+ data.tar.gz: f171f43fdb7db816c1761cf0e6c2826acaa2f0b69c78a6169f1c936bca397e1e
5
5
  SHA512:
6
- metadata.gz: 1d4d6840a43370f5743315e3cc8c7deae8f2679dc3482eae721850c70fa24f7b44f356a45fae10184ee7e24143b922b38d64e9a1e91c2187bcbace323330677b
7
- data.tar.gz: bf48bdd5ce2000ca74854a4b5f1a68d50800d8f2ae1625145f4e47673c84673899b59e52466a778f6ef855de835fc6f51b8f41fcdb0d56a955d3ce74fdec92e6
6
+ metadata.gz: 8a63ba3c1dae1b90cc9536696475891621305c5025fbb1ed6a7ab64a6f3ea9c7b6a2ef58f773c1823c3037f0690c73331afb71daddfd480b3f63a96371732bae
7
+ data.tar.gz: 8978545cf5212adfea6062ac7d34f7fd245f556128bdeae01d753fc1c7832c11e48855974498b6034a63238005b25f3609e5ee2ae8feb09f1c4c2ca2f0f955a3
@@ -12,6 +12,7 @@ module Bootstrap4Helper
12
12
  # @option opts [Hash] :data
13
13
  # @option opts [Boolean] :scrollable
14
14
  # @option opts [Boolean] :vcentered
15
+ # @option opts [Symbol] :size
15
16
  #
16
17
  def initialize(template, opts = {}, &block)
17
18
  super(template)
@@ -21,6 +22,7 @@ module Bootstrap4Helper
21
22
  @data = opts.fetch(:data, {})
22
23
  @scrollable = opts.fetch(:scrollable, false)
23
24
  @vcentered = opts.fetch(:vcentered, false)
25
+ @size = opts.fetch(:size, nil)
24
26
  @content = block || proc { '' }
25
27
  end
26
28
 
@@ -83,10 +85,10 @@ module Bootstrap4Helper
83
85
 
84
86
  content_tag(
85
87
  :button,
86
- type: 'button',
88
+ type: 'button',
87
89
  class: block_given? ? klass : 'close',
88
- data: { dismiss: 'modal' },
89
- aria: { label: 'Close' }
90
+ data: { dismiss: 'modal' },
91
+ aria: { label: 'Close' }
90
92
  ) do
91
93
  block_given? ? yield : xbutton
92
94
  end
@@ -98,7 +100,7 @@ module Bootstrap4Helper
98
100
  #
99
101
  def to_s
100
102
  content_tag :div, id: @id, class: "modal #{@class}", tabindex: -1, role: 'dialog', data: @data do
101
- content_tag :div, class: "modal-dialog #{scrollable} #{vcentered}", role: 'document' do
103
+ content_tag :div, class: "modal-dialog #{size} #{scrollable} #{vcentered}", role: 'document' do
102
104
  content_tag(:div, class: 'modal-content') { @content.call(self) }
103
105
  end
104
106
  end
@@ -133,9 +135,9 @@ module Bootstrap4Helper
133
135
 
134
136
  content_tag(
135
137
  tag,
136
- id: id,
138
+ id: id,
137
139
  class: "modal-#{type} #{klass}",
138
- data: data,
140
+ data: data,
139
141
  &block
140
142
  )
141
143
  end
@@ -163,5 +165,22 @@ module Bootstrap4Helper
163
165
  def vcentered
164
166
  @vcentered ? 'modal-dialog-centered' : ''
165
167
  end
168
+
169
+ # Gets the size of the modal window.
170
+ #
171
+ # @return [String]
172
+ #
173
+ def size
174
+ case @size
175
+ when :xlarge
176
+ 'modal-xl'
177
+ when :large
178
+ 'modal-lg'
179
+ when :small
180
+ 'modal-sm'
181
+ else
182
+ ''
183
+ end
184
+ end
166
185
  end
167
186
  end
@@ -1,3 +1,3 @@
1
1
  module Bootstrap4Helper
2
- VERSION = '1.2.0'.freeze
2
+ VERSION = '1.2.1'.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.2.0
4
+ version: 1.2.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: 2021-02-03 00:00:00.000000000 Z
11
+ date: 2021-06-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails