ultimate_turbo_modal 1.5.0 → 1.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.tool-versions +1 -1
- data/CHANGELOG.md +8 -0
- data/Gemfile.lock +3 -3
- data/lib/phlex/deferred_render_with_main_content.rb +2 -2
- data/lib/ultimate_turbo_modal/base.rb +22 -18
- data/lib/ultimate_turbo_modal/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e5258352e110cc8d743f60743d8c2842daa3e925ec3b9671713c5b28cd25e59a
|
4
|
+
data.tar.gz: 9488206059b94dc6f3613b0725a59a1fba3cfadc8a2414e6ee3cd21f4b978f71
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fdeb4c4f19c6875ea1d401427d76ac5c46b30ffc96faad82ca683dce05588b0dc720d701cdd49968d9580889a477bdd06de261b1cc25631041221c483192e947
|
7
|
+
data.tar.gz: 02633313f6ba5a54b023ccea29bb73162d067268e0730ea832d54d9a59e519a95c0062dc7603c233ead3f5a4c702d632c0ef3f61d0d4ca5dbe53b2cc8ccf8014
|
data/.tool-versions
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
ruby 3.
|
1
|
+
ruby 3.3.0
|
2
2
|
nodejs 18.9.0
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
## [1.6.1] - 2024-01-10
|
2
|
+
|
3
|
+
- Added ability to specify data attributes for the content div within the modal. Useful to specify a Stimulus controller, for example.
|
4
|
+
|
5
|
+
## [1.6.0] - 2023-12-25
|
6
|
+
|
7
|
+
- Support for Ruby 3.3
|
8
|
+
|
1
9
|
## [1.5.0] - 2023-11-28
|
2
10
|
|
3
11
|
- Allow whitelisting out-of-modal CSS selectors to not dismiss modal when clicked
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
ultimate_turbo_modal (1.
|
4
|
+
ultimate_turbo_modal (1.6.1)
|
5
5
|
phlex-rails (>= 1.0, < 2.0)
|
6
6
|
rails (>= 7)
|
7
7
|
stimulus-rails
|
@@ -130,7 +130,7 @@ GEM
|
|
130
130
|
net-smtp (0.4.0)
|
131
131
|
net-protocol
|
132
132
|
nio4r (2.5.9)
|
133
|
-
nokogiri (1.
|
133
|
+
nokogiri (1.16.0-arm64-darwin)
|
134
134
|
racc (~> 1.4)
|
135
135
|
parallel (1.23.0)
|
136
136
|
parser (3.2.2.4)
|
@@ -146,7 +146,7 @@ GEM
|
|
146
146
|
zeitwerk (~> 2.6)
|
147
147
|
psych (5.1.1.1)
|
148
148
|
stringio
|
149
|
-
racc (1.7.
|
149
|
+
racc (1.7.3)
|
150
150
|
rack (3.0.8)
|
151
151
|
rack-session (2.0.0)
|
152
152
|
rack (>= 3.0.0)
|
@@ -11,6 +11,7 @@ class UltimateTurboModal::Base < Phlex::HTML
|
|
11
11
|
# @param header_divider [Boolean] Whether to show a divider between the header and the main content
|
12
12
|
# @param padding [Boolean] Whether to add padding around the modal content
|
13
13
|
# @param request [ActionDispatch::Request] The current Rails request object
|
14
|
+
# @param content_div_data [Hash] `data` attribute for the div where the modal content will be rendered
|
14
15
|
# @param title [String] The title of the modal
|
15
16
|
def initialize(
|
16
17
|
advance: UltimateTurboModal.configuration.advance,
|
@@ -22,6 +23,7 @@ class UltimateTurboModal::Base < Phlex::HTML
|
|
22
23
|
header: UltimateTurboModal.configuration.header,
|
23
24
|
header_divider: UltimateTurboModal.configuration.header_divider,
|
24
25
|
padding: UltimateTurboModal.configuration.padding,
|
26
|
+
content_div_data: nil,
|
25
27
|
request: nil, title: nil
|
26
28
|
)
|
27
29
|
@advance = !!advance
|
@@ -34,6 +36,7 @@ class UltimateTurboModal::Base < Phlex::HTML
|
|
34
36
|
@header = header
|
35
37
|
@header_divider = header_divider
|
36
38
|
@padding = padding
|
39
|
+
@content_div_data = content_div_data
|
37
40
|
@request = request
|
38
41
|
@title = title
|
39
42
|
|
@@ -70,7 +73,7 @@ class UltimateTurboModal::Base < Phlex::HTML
|
|
70
73
|
|
71
74
|
private
|
72
75
|
|
73
|
-
attr_accessor :request, :allowed_click_outside_selector
|
76
|
+
attr_accessor :request, :allowed_click_outside_selector, :content_div_data
|
74
77
|
|
75
78
|
def padding? = !!@padding
|
76
79
|
|
@@ -107,26 +110,26 @@ class UltimateTurboModal::Base < Phlex::HTML
|
|
107
110
|
|
108
111
|
## HTML components
|
109
112
|
|
110
|
-
def modal(&)
|
113
|
+
def modal(&block)
|
111
114
|
outer_divs do
|
112
115
|
div_content do
|
113
116
|
div_header
|
114
|
-
div_main(&)
|
117
|
+
div_main(&block)
|
115
118
|
div_footer if footer?
|
116
119
|
end
|
117
120
|
end
|
118
121
|
end
|
119
122
|
|
120
|
-
def outer_divs(&)
|
123
|
+
def outer_divs(&block)
|
121
124
|
div_dialog do
|
122
125
|
div_overlay
|
123
126
|
div_outer do
|
124
|
-
div_inner(&)
|
127
|
+
div_inner(&block)
|
125
128
|
end
|
126
129
|
end
|
127
130
|
end
|
128
131
|
|
129
|
-
def div_dialog(&)
|
132
|
+
def div_dialog(&block)
|
130
133
|
div(id: "modal-container",
|
131
134
|
class: self.class::DIV_DIALOG_CLASSES,
|
132
135
|
role: "dialog",
|
@@ -152,30 +155,31 @@ class UltimateTurboModal::Base < Phlex::HTML
|
|
152
155
|
close_button: close_button?.to_s,
|
153
156
|
header_divider: header_divider?.to_s,
|
154
157
|
footer_divider: footer_divider?.to_s
|
155
|
-
}, &)
|
158
|
+
}, &block)
|
156
159
|
end
|
157
160
|
|
158
161
|
def div_overlay
|
159
162
|
div(id: "modal-overlay", class: self.class::DIV_OVERLAY_CLASSES)
|
160
163
|
end
|
161
164
|
|
162
|
-
def div_outer(&)
|
163
|
-
div(id: "modal-outer", class: self.class::DIV_OUTER_CLASSES, &)
|
165
|
+
def div_outer(&block)
|
166
|
+
div(id: "modal-outer", class: self.class::DIV_OUTER_CLASSES, &block)
|
164
167
|
end
|
165
168
|
|
166
|
-
def div_inner(&)
|
167
|
-
div(id: "modal-inner", class: self.class::DIV_INNER_CLASSES, &)
|
169
|
+
def div_inner(&block)
|
170
|
+
div(id: "modal-inner", class: self.class::DIV_INNER_CLASSES, data: content_div_data, &block)
|
168
171
|
end
|
169
172
|
|
170
|
-
def div_content(&)
|
171
|
-
|
173
|
+
def div_content(&block)
|
174
|
+
data = (content_div_data || {}).merge({modal_target: "content"})
|
175
|
+
div(id: "modal-content", class: self.class::DIV_CONTENT_CLASSES, data:, &block)
|
172
176
|
end
|
173
177
|
|
174
|
-
def div_main(&)
|
175
|
-
div(id: "modal-main", class: self.class::DIV_MAIN_CLASSES, &)
|
178
|
+
def div_main(&block)
|
179
|
+
div(id: "modal-main", class: self.class::DIV_MAIN_CLASSES, &block)
|
176
180
|
end
|
177
181
|
|
178
|
-
def div_header(&)
|
182
|
+
def div_header(&block)
|
179
183
|
div(id: "modal-header", class: self.class::DIV_HEADER_CLASSES) do
|
180
184
|
div_title
|
181
185
|
button_close
|
@@ -207,13 +211,13 @@ class UltimateTurboModal::Base < Phlex::HTML
|
|
207
211
|
end
|
208
212
|
end
|
209
213
|
|
210
|
-
def close_button_tag(&)
|
214
|
+
def close_button_tag(&block)
|
211
215
|
button(type: "button",
|
212
216
|
aria: {label: "close"},
|
213
217
|
class: self.class::CLOSE_BUTTON_TAG_CLASSES,
|
214
218
|
data: {
|
215
219
|
action: @close_button_data_action
|
216
|
-
}, &)
|
220
|
+
}, &block)
|
217
221
|
end
|
218
222
|
|
219
223
|
def icon_close
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ultimate_turbo_modal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carl Mercier
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: phlex-rails
|
@@ -124,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
124
124
|
- !ruby/object:Gem::Version
|
125
125
|
version: '0'
|
126
126
|
requirements: []
|
127
|
-
rubygems_version: 3.4
|
127
|
+
rubygems_version: 3.5.4
|
128
128
|
signing_key:
|
129
129
|
specification_version: 4
|
130
130
|
summary: UTMR aims to be the be-all and end-all of Turbo Modals.
|