Module: DlnkToast::Streams
- Defined in:
- lib/dlnk_toast/streams.rb
Instance Method Summary collapse
-
#toast(type, message) ⇒ Object
Append a toast notification via Turbo Stream.
Instance Method Details
#toast(type, message) ⇒ Object
Append a toast notification via Turbo Stream.
turbo_stream.toast(:notice, "Saved!")
turbo_stream.toast(:alert, "Something went wrong.")
10 11 12 13 14 15 16 |
# File 'lib/dlnk_toast/streams.rb', line 10 def toast(type, ) return if .blank? append "dlnk-toast-container", partial: "dlnk_toast/toast_message", locals: { type: type.to_sym, message: } end |