Pow: Custom render layout template.

Created on 16 May 2019  路  2Comments  路  Source: danschultzer/pow

I currently use a different layout template for my registration / session view than is what is my app's default layout.

IE: This was how I render my own custom layout when using my own auth lib

  render("new.html", layout: {PolymorphicProductionsWeb.LayoutView, "full-header.html"},

from the looks of it there is nothing allowing me customization of which layout to use when calling render from the controller.

https://github.com/danschultzer/pow/blob/master/lib/pow/phoenix/controllers/session_controller.ex#L24-L30

Thoughts?

Most helpful comment

You can use Phoenix.Controller.put_layout/2. In your router.ex you can set it as a pipeline:

pipeline :pow_layout do
  plug :put_layout, {PolymorphicProductionsWeb.LayoutView, 鈥渇ull-header.html鈥潁
end

scope "/" do
  pipe_through [:browser, :pow_layout]

  pow_routes()
end

All 2 comments

You can use Phoenix.Controller.put_layout/2. In your router.ex you can set it as a pipeline:

pipeline :pow_layout do
  plug :put_layout, {PolymorphicProductionsWeb.LayoutView, 鈥渇ull-header.html鈥潁
end

scope "/" do
  pipe_through [:browser, :pow_layout]

  pow_routes()
end

Awesome, thank you! Thats really cool I had no idea you could do that.

Was this page helpful?
0 / 5 - 0 ratings