@@ -3,24 +3,43 @@ defmodule ComponentsGuideWeb.AccessibilityFirstController do
33 require Logger
44
55 def index ( conn , _params ) do
6- render ( conn , "index.html" , article: "intro" )
6+ conn
7+ |> assign ( :page_title , page_title ( nil ) )
8+ |> render ( "index.html" , article: "intro" )
79 end
810
911 def show ( conn , % { "id" => "widgets-cheatsheet" } ) do
10- render ( conn , "widgets-cheatsheet.html" )
12+ conn
13+ |> assign ( :page_title , "Accessible Widgets Cheatsheet" )
14+ |> render ( "widgets-cheatsheet.html" )
1115 end
1216
1317 def show ( conn , % { "id" => "properties-cheatsheet" } ) do
14- render ( conn , "properties-cheatsheet.html" )
18+ conn
19+ |> assign ( :page_title , "Accessible Properties Cheatsheet" )
20+ |> render ( "properties-cheatsheet.html" )
1521 end
1622
1723 @ articles [ "navigation" , "landmarks" , "roles" , "accessible-name" , "forms" , "content" ]
1824
1925 def show ( conn , % { "id" => article } ) when article in @ articles do
20- render ( conn , "index.html" , article: article )
26+ conn
27+ |> assign ( :page_title , page_title ( article ) )
28+ |> render ( "index.html" , article: article )
2129 end
2230
2331 def show ( conn , _params ) do
2432 raise Phoenix.Router.NoRouteError , conn: conn , router: ComponentsGuideWeb.Router
2533 end
34+
35+ defp page_title ( "navigation" ) , do: "Accessibility-First Navigation"
36+ defp page_title ( "landmarks" ) , do: "Accessibility-First Landmarks"
37+ defp page_title ( "roles" ) , do: "Accessibility-First Roles"
38+ defp page_title ( "forms" ) , do: "Accessibility-First Forms"
39+ defp page_title ( "content" ) , do: "Accessibility-First Content"
40+ defp page_title ( "accessible-name" ) , do: "Learning Accessible Names"
41+
42+ defp page_title ( _ ) do
43+ "Accessibility-First Development"
44+ end
2645end
0 commit comments