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

Link to this function

flash_message(conn, type)

View Source

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 current Plug.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>"
Link to this function

render(template, assigns \\ %{})

View Source

Renders the given template locally.

Link to this function

template_not_found(template, assigns)

View Source

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.