diff --git a/guides/contexts.md b/guides/contexts.md index 3894cf451d..7ce19df4e3 100644 --- a/guides/contexts.md +++ b/guides/contexts.md @@ -711,7 +711,7 @@ We won't focus on a real user authentication system at this point, but by the ti plug :accepts, ["html"] plug :fetch_session plug :fetch_live_flash - plug :put_root_layout, {HelloWeb.LayoutView, :root} + plug :put_root_layout, html: {HelloWeb.LayoutView, :root} plug :protect_from_forgery plug :put_secure_browser_headers + plug :fetch_current_user diff --git a/guides/controllers.md b/guides/controllers.md index d9f322f4fb..6ca3346427 100644 --- a/guides/controllers.md +++ b/guides/controllers.md @@ -216,7 +216,7 @@ defmodule HelloWeb.Router do plug :accepts, ["html", "json"] plug :fetch_session plug :fetch_live_flash - plug :put_root_layout, {HelloWeb.LayoutView, :root} + plug :put_root_layout, html: {HelloWeb.LayoutView, :root} plug :protect_from_forgery plug :put_secure_browser_headers end diff --git a/guides/plug.md b/guides/plug.md index 469a9b0e56..97d525a9e7 100644 --- a/guides/plug.md +++ b/guides/plug.md @@ -189,7 +189,7 @@ defmodule HelloWeb.Router do plug :accepts, ["html"] plug :fetch_session plug :fetch_live_flash - plug :put_root_layout, {HelloWeb.LayoutView, :root} + plug :put_root_layout, html: {HelloWeb.LayoutView, :root} plug :protect_from_forgery plug :put_secure_browser_headers plug HelloWeb.Plugs.Locale, "en" diff --git a/guides/request_lifecycle.md b/guides/request_lifecycle.md index 90d5d1a809..79a1e88a73 100644 --- a/guides/request_lifecycle.md +++ b/guides/request_lifecycle.md @@ -46,7 +46,7 @@ defmodule HelloWeb.Router do plug :accepts, ["html"] plug :fetch_session plug :fetch_live_flash - plug :put_root_layout, {HelloWeb.Layouts, :root} + plug :put_root_layout, html: {HelloWeb.Layouts, :root} plug :protect_from_forgery plug :put_secure_browser_headers end diff --git a/guides/routing.md b/guides/routing.md index 34403e86b3..856982a3ce 100644 --- a/guides/routing.md +++ b/guides/routing.md @@ -16,7 +16,7 @@ defmodule HelloWeb.Router do plug :accepts, ["html"] plug :fetch_session plug :fetch_live_flash - plug :put_root_layout, {HelloWeb.Layouts, :root} + plug :put_root_layout, html: {HelloWeb.Layouts, :root} plug :protect_from_forgery plug :put_secure_browser_headers end @@ -457,7 +457,7 @@ defmodule HelloWeb.Router do plug :accepts, ["html"] plug :fetch_session plug :fetch_live_flash - plug :put_root_layout, {HelloWeb.Layouts, :root} + plug :put_root_layout, html: {HelloWeb.Layouts, :root} plug :protect_from_forgery plug :put_secure_browser_headers end @@ -502,7 +502,7 @@ defmodule HelloWeb.Router do plug :accepts, ["html"] plug :fetch_session plug :fetch_live_flash - plug :put_root_layout, {HelloWeb.Layouts, :root} + plug :put_root_layout, html: {HelloWeb.Layouts, :root} plug :protect_from_forgery plug :put_secure_browser_headers end diff --git a/installer/templates/phx_web/router.ex b/installer/templates/phx_web/router.ex index 2cc4b1e6b3..9d49c3d864 100644 --- a/installer/templates/phx_web/router.ex +++ b/installer/templates/phx_web/router.ex @@ -5,7 +5,7 @@ defmodule <%= @web_namespace %>.Router do plug :accepts, ["html"] plug :fetch_session plug :fetch_live_flash - plug :put_root_layout, {<%= @web_namespace %>.Layouts, :root} + plug :put_root_layout, html: {<%= @web_namespace %>.Layouts, :root} plug :protect_from_forgery plug :put_secure_browser_headers end<% end %> diff --git a/installer/test/phx_new_umbrella_test.exs b/installer/test/phx_new_umbrella_test.exs index 2e86d82b9f..684c9c7358 100644 --- a/installer/test/phx_new_umbrella_test.exs +++ b/installer/test/phx_new_umbrella_test.exs @@ -266,7 +266,7 @@ defmodule Mix.Tasks.Phx.New.UmbrellaTest do assert_file(web_path(@app, "lib/phx_umb_web/router.ex"), fn file -> assert file =~ ~s[plug :fetch_live_flash] - assert file =~ ~s[plug :put_root_layout, {PhxUmbWeb.Layouts, :root}] + assert file =~ ~s[plug :put_root_layout, html: {PhxUmbWeb.Layouts, :root}] assert file =~ ~s[get "/", PageController] end) diff --git a/test/phoenix/controller/controller_test.exs b/test/phoenix/controller/controller_test.exs index 64db87e558..7dbebd42c1 100644 --- a/test/phoenix/controller/controller_test.exs +++ b/test/phoenix/controller/controller_test.exs @@ -98,7 +98,7 @@ defmodule Phoenix.Controller.ControllerTest do conn = conn(:get, "/") assert root_layout(conn) == false - conn = put_root_layout(conn, {AppView, "root.html"}) + conn = put_root_layout(conn, html: {AppView, "root.html"}) assert root_layout(conn) == {AppView, "root.html"} conn = put_root_layout(conn, "bare.html") diff --git a/test/phoenix/controller/render_test.exs b/test/phoenix/controller/render_test.exs index 8f9399f708..b47c4e6145 100644 --- a/test/phoenix/controller/render_test.exs +++ b/test/phoenix/controller/render_test.exs @@ -45,7 +45,7 @@ defmodule Phoenix.Controller.RenderTest do conn = conn() |> put_layout({MyApp.LayoutView, "app.html"}) - |> put_root_layout({MyApp.LayoutView, "root.html"}) + |> put_root_layout(html: {MyApp.LayoutView, "root.html"}) |> render("index.html", title: "Hello") assert conn.resp_body == "ROOTSTART[Hello]\n Hello\n Hello\n\n\nROOTEND\n" @@ -63,7 +63,7 @@ defmodule Phoenix.Controller.RenderTest do conn = conn() |> put_layout({MyApp.LayoutView, "app.html"}) - |> put_root_layout({MyApp.LayoutView, :root}) + |> put_root_layout(html: {MyApp.LayoutView, :root}) |> render("index.html", title: "Hello") assert conn.resp_body == "ROOTSTART[Hello]\n Hello\n Hello\n\n\nROOTEND\n"