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

Module that renders templates.

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

By setting the :web_module key in config, the controller and layout templates 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.Layouts 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 will be used from your app:

  • MyAppWeb.Layouts
  • MyAppWeb.Pow.RegistrationHTML
  • MyAppWeb.Pow.SessionHTML

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

  • registration_html/new.html.heex
  • registration_html/edit.html.heex
  • session_html/new.html.heex

Summary

Functions

Generates the template module atom.

Updates the layout module in the connection.

Functions

Link to this function

build_view_module(default_view, web_module)

View Source
@spec build_view_module(module(), module() | nil) :: module()

Generates the template module atom.

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

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

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

Updates the layout module in the connection.

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

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