Pow.Phoenix.ViewHelpers (Pow v1.0.22) View Source

Module that renders views.

By default, the controller views and templates in this library will be used, and the layout view will be based on the module namespace of the Endpoint module.

By setting the :web_module key in config, the controller and layout views can be used from this context app.

So if you set up your endpoint like this:

defmodule MyAppWeb.Endpoint do
  plug Pow.Plug.Session
end

Only MyAppWeb.LayoutView will be used from your app. However, if you set up the endpoint with a :web_module key:

defmodule MyAppWeb.Endpoint do
  plug Pow.Plug.Session, web_module: MyAppWeb
end

The following modules are will be used from your app:

  • MyAppWeb.LayoutView
  • MyAppWeb.Pow.RegistrationView
  • MyAppWeb.Pow.SessionView

And also the following templates has to exist in lib/my_project_web/templates/pow:

  • registration/new.html.eex
  • registration/edit.html.eex
  • session/new.html.eex

Link to this section Summary

Functions

Generates the view module atom.

Updates the view and layout view in the connection.

Link to this section Functions

Link to this function

build_view_module(default_view, web_module)

View Source

Specs

build_view_module(module(), module() | nil) :: module()

Generates the view module atom.

If no web_module is provided, the Pow view module is returned.

When web_module is provided, the view module will be changed from Pow.Phoenix.RegistrationView to CustomWeb.Pow.RegistrationView

Specs

layout(Plug.Conn.t()) :: Plug.Conn.t()

Updates the view and layout view in the connection.

The layout view is always updated. If :web_module is not provided, it'll be computed from the Endpoint module, and the default Pow view module is returned.

When :web_module is provided, both the view module and the layout view module will be computed. See build_view_module/2 for more.