View Source Torch.FlashView (Torch v4.1.0)
Contains functions for dealing with flash messages.
Link to this section Summary
Functions
The resource name, as an atom, for this view
Returns a formatted flash message of the given type.
Renders the given template locally.
Callback invoked when no template is found. By default it raises but can be customized to render a particular template.
Link to this section Functions
The resource name, as an atom, for this view
Specs
flash_message(Plug.Conn.t(), type :: atom() | String.t()) :: Phoenix.HTML.safe()
Returns a formatted flash message of the given type.
Parameters
conn
: The currentPlug.Conn
.type
: The flash type, such as:error
.
Example
iex> conn = %Plug.Conn{private: %{phoenix_flash: %{"error" => "Error Message"}}}
...> flash_message(conn, "error") |> safe_to_string()
"<p class=\"torch-flash error\">Error Message <button class='torch-flash-close'>x</button></p>"
Renders the given template locally.
Specs
template_not_found(Phoenix.Template.name(), map()) :: no_return()
Callback invoked when no template is found. By default it raises but can be customized to render a particular template.