ultimate_turbo_modal 1.2.1 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +2 -1
- data/README.md +19 -3
- data/lib/ultimate_turbo_modal/base.rb +8 -2
- data/lib/ultimate_turbo_modal/flavors/tailwind.rb +12 -2
- data/lib/ultimate_turbo_modal/flavors/vanilla.rb +5 -1
- 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: '079b28d06be34aba1359de1c34042f9f2ef131421f37af1a7f3c8619e156e68b'
|
4
|
+
data.tar.gz: 551d973abd6d0c51f0ad1e01e87ead35697030e4fcce5f62ac591dc09683a284
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 611ce181e6be8833b0b0c094bf2a776edf85dd050ca93fcf866401c1a3e05c0f81c2be519ba2ea8e98efd3ce3b28d7ee0fb2bb6512938a0142149b80fe9ac05e
|
7
|
+
data.tar.gz: 77159bc4ce94a2bf2cc1abddbc068efe4b5bb3c821494d937262411961c2cfdc0df036fb83ed7dd56f8d25c1743d85d585e572a085f7374d8eecc050ec2bd11a
|
data/CHANGELOG.md
CHANGED
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.3.1)
|
5
5
|
phlex-rails (>= 1.0, < 2.0)
|
6
6
|
rails (>= 7)
|
7
7
|
stimulus-rails
|
@@ -250,6 +250,7 @@ GEM
|
|
250
250
|
|
251
251
|
PLATFORMS
|
252
252
|
arm64-darwin-22
|
253
|
+
arm64-darwin-23
|
253
254
|
|
254
255
|
DEPENDENCIES
|
255
256
|
rake (~> 13.0)
|
data/README.md
CHANGED
@@ -159,7 +159,7 @@ If a URL is specified as a String, the browser history will advance, and the URL
|
|
159
159
|
|
160
160
|
### `title`, default: `nil`
|
161
161
|
|
162
|
-
Title to display in the modal header.
|
162
|
+
Title to display in the modal header. Alternatively, you can set the title with a block.
|
163
163
|
|
164
164
|
### `header`, default: `true`
|
165
165
|
|
@@ -173,8 +173,6 @@ Whether to display a divider below the header.
|
|
173
173
|
|
174
174
|
Whether to display a divider above the footer. The divider will not appear if no footer was specified.
|
175
175
|
|
176
|
-
|
177
|
-
|
178
176
|
### Example usage with options
|
179
177
|
|
180
178
|
```erb
|
@@ -189,6 +187,24 @@ Whether to display a divider above the footer. The divider will not appear if no
|
|
189
187
|
<% end %>
|
190
188
|
```
|
191
189
|
|
190
|
+
### Title and Footer
|
191
|
+
|
192
|
+
You can set a custom title and footer by passing a block. For example
|
193
|
+
|
194
|
+
```erb
|
195
|
+
<%= modal do |m| %>
|
196
|
+
<% m.title do %>
|
197
|
+
<div>My Title</div>
|
198
|
+
<% end %>
|
199
|
+
|
200
|
+
Modal body
|
201
|
+
|
202
|
+
<% m.footer do %>
|
203
|
+
<input type="submit" form="myform">Submit</input>
|
204
|
+
<% end %>
|
205
|
+
<% end %>
|
206
|
+
```
|
207
|
+
|
192
208
|
## Installing & Configuring Idiomorph
|
193
209
|
|
194
210
|
Idiomorph can morph Turbo Frame responses to allow seemless navigation within Turbo Frames
|
@@ -49,25 +49,31 @@ class UltimateTurboModal::Base < Phlex::HTML
|
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
|
+
def title(&block)
|
53
|
+
@title_block = block
|
54
|
+
end
|
55
|
+
|
52
56
|
def footer(&block)
|
53
57
|
@footer = block
|
54
58
|
end
|
55
59
|
|
56
60
|
private
|
57
61
|
|
58
|
-
attr_accessor :request
|
62
|
+
attr_accessor :request
|
59
63
|
|
60
64
|
def padding? = !!@padding
|
61
65
|
|
62
66
|
def close_button? = !!@close_button
|
63
67
|
|
68
|
+
def title_block? = !!@title_block
|
69
|
+
|
64
70
|
def title? = !!@title
|
65
71
|
|
66
72
|
def header? = !!@header
|
67
73
|
|
68
74
|
def footer? = @footer.present?
|
69
75
|
|
70
|
-
def header_divider? = !!@header_divider && title?
|
76
|
+
def header_divider? = !!@header_divider && (@title_block || title?)
|
71
77
|
|
72
78
|
def footer_divider? = !!@footer_divider && footer?
|
73
79
|
|
@@ -76,6 +76,12 @@ module UltimateTurboModal::Flavors
|
|
76
76
|
div(id: "modal-main", class: "group-data-[padding=true]:p-4 group-data-[padding=true]:pt-2", &)
|
77
77
|
end
|
78
78
|
|
79
|
+
def header_block
|
80
|
+
return if @header_block.blank?
|
81
|
+
render @header_block
|
82
|
+
nil
|
83
|
+
end
|
84
|
+
|
79
85
|
def div_header(&)
|
80
86
|
div(id: "modal-header", class: "flex justify-between items-center w-full py-4 rounded-t dark:border-gray-600 group-data-[header-divider=true]:border-b group-data-[header=false]:absolute") do
|
81
87
|
div_title
|
@@ -85,7 +91,11 @@ module UltimateTurboModal::Flavors
|
|
85
91
|
|
86
92
|
def div_title
|
87
93
|
div(id: "modal-title", class: "pl-4") do
|
88
|
-
|
94
|
+
if @title_block.present?
|
95
|
+
render @title_block
|
96
|
+
else
|
97
|
+
h3(id: "modal-title-h", class: "group-data-[title=false]:hidden text-lg font-semibold text-gray-900 dark:text-white") { @title }
|
98
|
+
end
|
89
99
|
end
|
90
100
|
end
|
91
101
|
|
@@ -96,7 +106,7 @@ module UltimateTurboModal::Flavors
|
|
96
106
|
end
|
97
107
|
|
98
108
|
def button_close
|
99
|
-
div(id: "modal-close", class: "mr-4") do
|
109
|
+
div(id: "modal-close", class: "mr-4 group-data-[close-button=false]:hidden") do
|
100
110
|
close_button_tag do
|
101
111
|
icon_close
|
102
112
|
span(class: "sr-only") { "Close modal" }
|
@@ -79,7 +79,11 @@ module UltimateTurboModal::Flavors
|
|
79
79
|
|
80
80
|
def div_title
|
81
81
|
div(id: "modal-title", class: "modal-title") do
|
82
|
-
|
82
|
+
if @title_block.present?
|
83
|
+
render @title_block
|
84
|
+
else
|
85
|
+
h3(id: "modal-title-h", class: "modal-title-h") { @title }
|
86
|
+
end
|
83
87
|
end
|
84
88
|
end
|
85
89
|
|
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.3.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: 2023-11-
|
11
|
+
date: 2023-11-23 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.4.1
|
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.
|