Torch v2.0.0-rc.3 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
__phoenix_recompile__?() View Source
Returns true whenever the list of templates changes in the filesystem.
__resource__() View Source
The resource name, as an atom, for this view
__templates__() View Source
Returns the template root alongside all templates.
flash_message(conn, type)
View Source
flash_message(Plug.Conn.t(), type :: atom() | String.t()) :: Phoenix.HTML.safe()
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>"
render(template, assigns \\ %{}) View Source
Renders the given template locally.
template_not_found(template, assigns)
View Source
template_not_found(Phoenix.Template.name(), map()) :: no_return()
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.