ultimate_turbo_modal 1.2.1 → 1.3.0
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/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/README.md +19 -3
- data/lib/ultimate_turbo_modal/base.rb +8 -2
- data/lib/ultimate_turbo_modal/flavors/tailwind.rb +11 -1
- data/lib/ultimate_turbo_modal/flavors/vanilla.rb +5 -1
- data/lib/ultimate_turbo_modal/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: b09b8cb53143af89cae066415021da467520342232aa61eec3c53b93fbc57b0d
|
|
4
|
+
data.tar.gz: b8c033322d1af2cf0117e7bbadf914668bdd8c7eb540487eadaccd31722a3473
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fbe3f49e69952e28b6fcd3b26d7423700d10f5703a6802acb5be6a9dbdf7cff0003e01a44c4afdae255fd314f78e9c008f1d40f95f78254d6d8c6600762b398d
|
|
7
|
+
data.tar.gz: 66a67b13c8dfc6e8b1b0b36a091d1595034cce465196aa73c03f8fedcf09db4f1e733b8c13041f8e923fd6ab52697adb54b0e33e8308a3092365af062b9fd6b5
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
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
|
|
|
@@ -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.0
|
|
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-15 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: phlex-rails
|