toastify 1.1.0 → 1.2.1

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: cc7349a13221be5cd792458f297854e87cbfe246996e3a1a605a601adbbb487c
4
- data.tar.gz: 5c3312cb801c7f50b92b4ff32ac9d5a1005bacf791ce27732ee1bd176b5dfbf1
3
+ metadata.gz: a0f7f533d69bf852bede962509bd4f893854d59381465e674a84dcc2af573441
4
+ data.tar.gz: 35ead30f183fc0eb86727b710469de755e6bbca6892a00230076a14f3741258e
5
5
  SHA512:
6
- metadata.gz: a5d2762be86db79033de87a095201bcd717087778449f39f6d59cc8516443208dffd214a268a7c0fd8f9acff569be3c2a6c21cf8a40015606087be1db5c8286a
7
- data.tar.gz: a12bf06c49a854ad24f49935fa16a2b9333401bf56c00db3ece9d070f9dc67fb8db762b6b78ac01f7ed7484cf3f4ed0d84a7487e9182c6fcb8ab7c960f7d7833
6
+ metadata.gz: 7f5888be3af3cfaf5dbce6d665c392174c3601cb2c14a8210f1ec328b02412aa975deda65e99298cb87ce89dc111223531f506681fa024aabce271ca370b5b53
7
+ data.tar.gz: 55b26d76af3a72a432f726eba31712eea1239acfc2c7cd06e67703692ddfcbd74168da33e6bea43643903a3d2c38314231b8b1924c0be4d66007e2cffe71e6f2
@@ -55,11 +55,13 @@ module Toastify
55
55
  "error" => "error",
56
56
  "info" => "info",
57
57
  "warning" => "warning",
58
+ "default" => "default",
58
59
  }
59
60
 
60
61
  script_lines = []
61
62
  flash.each do |flash_type, message|
62
63
  next if flash_type.to_s.start_with?("toast_")
64
+ next unless Toastify::FLASH_KEYS.include?(flash_type.to_s)
63
65
 
64
66
  type = type_map.fetch(flash_type.to_s, "default")
65
67
  position = flash[:toast_position] || default_position
@@ -75,8 +77,11 @@ module Toastify
75
77
  script_lines << "window.Toastify && window.Toastify.show('#{safe_message}', { type: '#{j(type.to_s)}', position: '#{j(position.to_s)}', autoClose: #{auto_close.to_i}, theme: '#{j(theme.to_s)}', transition: '#{j(transition.to_s)}', closeButton: #{!!close_button}, pauseOnHover: #{!!pause_on_hover}, draggable: #{!!draggable} });"
76
78
  end
77
79
 
78
- # Discard so it doesn't show up again
79
- flash.keys.reject { |type| type.to_s.start_with?("toast_") }.each do |type|
80
+ # Discard consumed toast flashes only; leave other keys (e.g. :alert) intact
81
+ flash.keys.each do |type|
82
+ next if type.to_s.start_with?("toast_")
83
+ next unless Toastify::FLASH_KEYS.include?(type.to_s)
84
+
80
85
  flash.discard(type)
81
86
  end
82
87
 
@@ -11,7 +11,9 @@ module Toastify
11
11
  def append_toastify_to_response
12
12
  return unless request.format.turbo_stream? || turbo_frame_request?
13
13
 
14
- toast_flashes = flash.reject { |type, _| type.to_s.start_with?("toast_") }
14
+ toast_flashes = flash.reject do |type, _|
15
+ type.to_s.start_with?("toast_") || !Toastify::FLASH_KEYS.include?(type.to_s)
16
+ end
15
17
  return unless toast_flashes.any?
16
18
 
17
19
  script_content = helpers.toastify_script_tag
@@ -1,3 +1,3 @@
1
1
  module Toastify
2
- VERSION = "1.1.0"
2
+ VERSION = "1.2.1"
3
3
  end
data/lib/toastify.rb CHANGED
@@ -4,4 +4,5 @@ require "toastify/application_helper"
4
4
  require "toastify/controller"
5
5
 
6
6
  module Toastify
7
+ FLASH_KEYS = %w[success error warning alert info notice default].freeze
7
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: toastify
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - vasanthakumar-a
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-04-21 00:00:00.000000000 Z
11
+ date: 2026-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails