View Source Torch.FlashView (Torch v5.4.0)
This module is deprecated. This module will be fully removed in Torch 6.0.
Contains functions for dealing with flash messages.
Summary
Functions
flash_messages(assigns)
deprecated
DEPRECATED: Use Torch.Components.flash_messages/1 component instead
Functions
This function is deprecated. Use Torch.Components.flash_messages/1 instead.
@spec flash_messages(%{assigns: %{flash: map()}}) :: Phoenix.LiveView.Rendered.t()
DEPRECATED: Use Torch.Components.flash_messages/1 component instead
Returns a formatted group of all flash messages available.
Parameters
assigns
: The currentPlug.Conn.assigns
map.
Example
iex> conn = %Plug.Conn{assigns: %{flash: %{"error" => "Error Message", "info" => "Info Message", "custom" => "Custom flash key"}}}
...> flash_messages(conn.assigns) |> Phoenix.HTML.Safe.to_iodata() |> IO.iodata_to_binary()
"<section id=\"torch-flash-messages\">\n <div class=\"torch-container\">\n <p class=\"torch-flash custom\">Custom flash key <button class=\"torch-flash-close\">x</button></p><p class=\"torch-flash error\">Error Message <button class=\"torch-flash-close\">x</button></p><p class=\"torch-flash info\">Info Message <button class=\"torch-flash-close\">x</button></p>\n </div>\n</section>"