Repository: phoenixframework/phoenix
Pull request #3660 (2020-01-24 22:57:45)

Fix file path formatting
Adjustment for file path code highlighting in Contexts Guide.

We have:
... `lib/hello_web/views/session_view.ex:`
... `lib/hello_web/templates/session/new.html.eex:`

We wish
... `lib/hello_web/views/session_view.ex`:
... `lib/hello_web/templates/session/new.html.eex`:


Patch:
diff --git a/guides/contexts.md b/guides/contexts.md
index 5ef1dad3f..f4d5ebfcc 100644
--- a/guides/contexts.md
+++ b/guides/contexts.md
@@ -525,7 +525,7 @@ We used `resources` to generate a set of routes under the `"/session"` path. Thi
 
 We defined an `authenticate_user/2` plug in the router which simply uses `Plug.Conn.get_session/2` to check for a `:user_id` in the session. If we find one, it means a user has previously authenticated, and we call into `Hello.Accounts.get_user!/1` to place our `:current_user` into the connection assigns. If we don't have a session, we add a flash error message, redirect to the homepage, and we use `Plug.Conn.halt/1` to halt further plugs downstream from being invoked. We won't use this new plug quite yet, but it will be ready and waiting as we add authenticated routes in just a moment.
 
-Lastly, we need `SessionView` to render a template for our login form. Create a new file in `lib/hello_web/views/session_view.ex:`
+Lastly, we need `SessionView` to render a template for our login form. Create a new file in `lib/hello_web/views/session_view.ex`:
 
 ```elixir
 defmodule HelloWeb.SessionView do
@@ -533,7 +533,7 @@ defmodule HelloWeb.SessionView do
 end
 ```
 
-Next, add a new template in `lib/hello_web/templates/session/new.html.eex:`
+Next, add a new template in `lib/hello_web/templates/session/new.html.eex`:
 
 ```eex
 <h1>Sign in</h1>
diff --git a/installer/templates/phx_web/templates/layout/app.html.eex b/installer/templates/phx_web/templates/layout/app.html.eex
index 114b7e9c4..f2fb33446 100644
--- a/installer/templates/phx_web/templates/layout/app.html.eex
+++ b/installer/templates/phx_web/templates/layout/app.html.eex
@@ -4,7 +4,7 @@
     <meta charset="utf-8"/>
     <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
     <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
-    <title><%= app_module %> · Phoenix Framework</title>
+    <title><%%= assigns[:page_title] || "<%= app_module %> · Phoenix Framework" %></title>
     <link rel="stylesheet" href="<%%= Routes.static_path(@conn, "/css/app.css") %>"/>
     <%%= csrf_meta_tag() %>
   </head>


Test patch:
diff --git a/installer/test/phx_new_test.exs b/installer/test/phx_new_test.exs
index feab93a83..e5abc009b 100644
--- a/installer/test/phx_new_test.exs
+++ b/installer/test/phx_new_test.exs
@@ -77,7 +77,7 @@ defmodule Mix.Tasks.Phx.NewTest do
       assert_file "phx_blog/lib/phx_blog_web/router.ex", "defmodule PhxBlogWeb.Router"
       assert_file "phx_blog/lib/phx_blog_web.ex", "defmodule PhxBlogWeb"
       assert_file "phx_blog/lib/phx_blog_web/templates/layout/app.html.eex",
-                  "<title>PhxBlog · Phoenix Framework</title>"
+                  "<title><%= assigns[:page_title] || \"PhxBlog · Phoenix Framework\" %></title>"
       assert_file "phx_blog/lib/phx_blog_web/templates/page/index.html.eex", fn file ->
         version = Application.spec(:phx_new, :vsn) |> to_string() |> Version.parse!()
         changelog_vsn = "v#{version.major}.#{version.minor}"
diff --git a/installer/test/phx_new_umbrella_test.exs b/installer/test/phx_new_umbrella_test.exs
index ef75ef45e..d02239b4e 100644
--- a/installer/test/phx_new_umbrella_test.exs
+++ b/installer/test/phx_new_umbrella_test.exs
@@ -117,7 +117,7 @@ defmodule Mix.Tasks.Phx.New.UmbrellaTest do
 
       assert_file web_path(@app, "lib/#{@app}_web/router.ex"), "defmodule PhxUmbWeb.Router"
       assert_file web_path(@app, "lib/#{@app}_web/templates/layout/app.html.eex"),
-                  "<title>PhxUmb · Phoenix Framework</title>"
+                  "<title><%= assigns[:page_title] || \"PhxUmb · Phoenix Framework\" %></title>"
 
       assert_file web_path(@app, "test/#{@app}_web/views/page_view_test.exs"),
                   "defmodule PhxUmbWeb.PageViewTest"
@@ -500,7 +500,7 @@ defmodule Mix.Tasks.Phx.New.UmbrellaTest do
         assert_file "another/lib/another/router.ex", "defmodule Another.Router"
         assert_file "another/lib/another.ex", "defmodule Another"
         assert_file "another/lib/another/templates/layout/app.html.eex",
-                    "<title>Another · Phoenix Framework</title>"
+                    "<title><%= assigns[:page_title] || \"Another · Phoenix Framework\" %></title>"
 
         # webpack
         assert_file "another/.gitignore", "/assets/node_modules"