toastify 1.0.1 → 1.1.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/README.md +1 -5
- data/lib/toastify/controller.rb +18 -7
- data/lib/toastify/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cc7349a13221be5cd792458f297854e87cbfe246996e3a1a605a601adbbb487c
|
|
4
|
+
data.tar.gz: 5c3312cb801c7f50b92b4ff32ac9d5a1005bacf791ce27732ee1bd176b5dfbf1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a5d2762be86db79033de87a095201bcd717087778449f39f6d59cc8516443208dffd214a268a7c0fd8f9acff569be3c2a6c21cf8a40015606087be1db5c8286a
|
|
7
|
+
data.tar.gz: a12bf06c49a854ad24f49935fa16a2b9333401bf56c00db3ece9d070f9dc67fb8db762b6b78ac01f7ed7484cf3f4ed0d84a7487e9182c6fcb8ab7c960f7d7833
|
data/README.md
CHANGED
|
@@ -10,11 +10,7 @@ It can also be used directly in JavaScript (e.g., `Toastify.success("Saved!")`).
|
|
|
10
10
|
|
|
11
11
|
### Example Images
|
|
12
12
|
|
|
13
|
-
<img width="
|
|
14
|
-
|
|
15
|
-
<img width="338" height="87" alt="Dark Theme Example" src="https://github.com/user-attachments/assets/65671ac6-91d7-471f-9c03-6458023f3ae2" />
|
|
16
|
-
|
|
17
|
-
<img width="339" height="83" alt="Colored Theme Example" src="https://github.com/user-attachments/assets/1c99ffdb-dc3c-4fef-aa16-b7eff08e0cde" />
|
|
13
|
+
<img width="340" height="222" alt="Theme Examples" src="https://github.com/user-attachments/assets/ed0350ef-295d-4ba6-ab51-94a9e071eac4" />
|
|
18
14
|
|
|
19
15
|
## Installation
|
|
20
16
|
|
data/lib/toastify/controller.rb
CHANGED
|
@@ -3,13 +3,13 @@ module Toastify
|
|
|
3
3
|
extend ActiveSupport::Concern
|
|
4
4
|
|
|
5
5
|
included do
|
|
6
|
-
after_action :
|
|
6
|
+
after_action :append_toastify_to_response
|
|
7
7
|
end
|
|
8
8
|
|
|
9
9
|
private
|
|
10
10
|
|
|
11
|
-
def
|
|
12
|
-
return unless request.format.turbo_stream?
|
|
11
|
+
def append_toastify_to_response
|
|
12
|
+
return unless request.format.turbo_stream? || turbo_frame_request?
|
|
13
13
|
|
|
14
14
|
toast_flashes = flash.reject { |type, _| type.to_s.start_with?("toast_") }
|
|
15
15
|
return unless toast_flashes.any?
|
|
@@ -17,12 +17,23 @@ module Toastify
|
|
|
17
17
|
script_content = helpers.toastify_script_tag
|
|
18
18
|
return if script_content.blank?
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
if request.format.turbo_stream?
|
|
21
|
+
payload = turbo_stream.append("flash-outlet", script_content).to_s
|
|
21
22
|
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
if response.body.is_a?(String)
|
|
24
|
+
response.body += payload
|
|
25
|
+
else
|
|
26
|
+
response.body = response.body.to_s + payload
|
|
27
|
+
end
|
|
24
28
|
else
|
|
25
|
-
|
|
29
|
+
body = response.body.to_s
|
|
30
|
+
frame_closing_tag = "</turbo-frame>"
|
|
31
|
+
|
|
32
|
+
if body.include?(frame_closing_tag)
|
|
33
|
+
response.body = body.sub(frame_closing_tag, "#{script_content}#{frame_closing_tag}")
|
|
34
|
+
else
|
|
35
|
+
response.body = body + script_content.to_s
|
|
36
|
+
end
|
|
26
37
|
end
|
|
27
38
|
end
|
|
28
39
|
end
|
data/lib/toastify/version.rb
CHANGED