trenpixster / addict

User management lib for Phoenix Framework
MIT License
645 stars 99 forks source link

Specify layout as option in configuration #99

Open nkezhaya opened 8 years ago

nkezhaya commented 8 years ago

(As opposed to being forced to use addict/addict.html)

joshuaswilcox commented 8 years ago

can you not change

plug :put_layout, {Addict.AddictView, "addict.html"}

to be a different file?

glaszig commented 8 years ago

@joshuaswilcox i was under that impression, too, but it somehow has no effect.

i tried

plug :put_layout, {MyApp.LayoutView, "app.html"}
joshuaswilcox commented 8 years ago

Hmm, yeah i thought i had that working, but I guess not

joshuaswilcox commented 8 years ago

I seems that doing that in the controller does nothing because in addict/lib/addict/controller.ex

  defp put_addict_layout(conn) do
    conn
    |> put_layout({Addict.AddictView, "addict.html"})
  end

is defined and piped into each route

  def login(%{method: "GET"} = conn, _) do
    csrf_token = generate_csrf_token
    conn
    |> put_addict_layout
    |> render("login.html", csrf_token: csrf_token)
  end

so I guess you need to override the controller to change it