Torch v2.0.0-rc.2 Torch.FlashView View Source

Contains functions for dealing with flash messages.

Link to this section Summary

Functions

Returns true whenever the list of templates changes in the filesystem

The resource name, as an atom, for this view

Returns the template root alongside all templates

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

Link to this function

__phoenix_recompile__?() View Source

Returns true whenever the list of templates changes in the filesystem.

The resource name, as an atom, for this view

Returns the template root alongside all templates.

Link to this function

flash_message(conn, type) View Source
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
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.