Skip to content

Commit

Permalink
put format put_root_layout/2 (phoenixframework#5439)
Browse files Browse the repository at this point in the history
  • Loading branch information
ByeongUkChoi authored May 24, 2023
1 parent 5193c7d commit a409855
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion guides/contexts.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion guides/controllers.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion guides/plug.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion guides/request_lifecycle.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions guides/routing.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion installer/templates/phx_web/router.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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 %>
Expand Down
2 changes: 1 addition & 1 deletion installer/test/phx_new_umbrella_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion test/phoenix/controller/controller_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
4 changes: 2 additions & 2 deletions test/phoenix/controller/render_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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]<html>\n <title>Hello</title>\n Hello\n\n</html>\nROOTEND\n"
Expand All @@ -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]<html>\n <title>Hello</title>\n Hello\n\n</html>\nROOTEND\n"
Expand Down

0 comments on commit a409855

Please sign in to comment.