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 +4 -4
- data/lib/bootstrap4_helper/modal.rb +25 -6
- data/lib/bootstrap4_helper/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 201fec26b2a05fac10b958a08380937f58b38be45b6b67f90352c12871769206
|
4
|
+
data.tar.gz: f171f43fdb7db816c1761cf0e6c2826acaa2f0b69c78a6169f1c936bca397e1e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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:
|
88
|
+
type: 'button',
|
87
89
|
class: block_given? ? klass : 'close',
|
88
|
-
data:
|
89
|
-
aria:
|
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:
|
138
|
+
id: id,
|
137
139
|
class: "modal-#{type} #{klass}",
|
138
|
-
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
|
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.
|
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-
|
11
|
+
date: 2021-06-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|