@@ -3,24 +3,43 @@ defmodule ComponentsGuideWeb.AccessibilityFirstController do
3
3
require Logger
4
4
5
5
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" )
7
9
end
8
10
9
11
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" )
11
15
end
12
16
13
17
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" )
15
21
end
16
22
17
23
@ articles [ "navigation" , "landmarks" , "roles" , "accessible-name" , "forms" , "content" ]
18
24
19
25
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 )
21
29
end
22
30
23
31
def show ( conn , _params ) do
24
32
raise Phoenix.Router.NoRouteError , conn: conn , router: ComponentsGuideWeb.Router
25
33
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
26
45
end
0 commit comments