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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fb51a11fd1f4a71bc4eec59d1ce63e41617ba18a7ad8bd10f9359ff182b20dd4
4
- data.tar.gz: 4ffdc6148a49de0d4e96ce54d5c7996da717bbf2d69789f1fd7076b77c9bf0e8
3
+ metadata.gz: cc7349a13221be5cd792458f297854e87cbfe246996e3a1a605a601adbbb487c
4
+ data.tar.gz: 5c3312cb801c7f50b92b4ff32ac9d5a1005bacf791ce27732ee1bd176b5dfbf1
5
5
  SHA512:
6
- metadata.gz: 98267e7a27bd414779e4e6f0526dd80aeece3e85997e6d735cdcdccf91d68fc67130ff9989cdcfe0fc3d9839acf4bea94a443f66eb5324ce55ae8e054f1239bd
7
- data.tar.gz: 3b6e90230c0c3b45c716c2ec17f50d813207228abeb69a0a60d03e475adbac620a2e600f4311cc5f6aa53294dcaa281e2ba54cf3867e71bdc6eee6e68f20bfce
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="346" height="85" alt="Light Theme Example" src="https://github.com/user-attachments/assets/b7a3123a-89a3-4f49-97ff-aa25f4b870d0" />
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
 
@@ -3,13 +3,13 @@ module Toastify
3
3
  extend ActiveSupport::Concern
4
4
 
5
5
  included do
6
- after_action :append_toastify_to_stream
6
+ after_action :append_toastify_to_response
7
7
  end
8
8
 
9
9
  private
10
10
 
11
- def append_toastify_to_stream
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
- stream_tag = turbo_stream.append("flash-outlet", script_content)
20
+ if request.format.turbo_stream?
21
+ payload = turbo_stream.append("flash-outlet", script_content).to_s
21
22
 
22
- if response.body.is_a?(String)
23
- response.body += stream_tag.to_s
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
- response.body = response.body.to_s + stream_tag.to_s
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
@@ -1,3 +1,3 @@
1
1
  module Toastify
2
- VERSION = "1.0.1"
2
+ VERSION = "1.1.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: toastify
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - vasanthakumar-a