Add page titles
This commit is contained in:
parent
ecddb76101
commit
76ddd3dcb5
|
@ -62,7 +62,7 @@ defmodule WikiWeb.PageController do
|
||||||
|
|
||||||
def new(conn, params) do
|
def new(conn, params) do
|
||||||
changeset = Content.change_page(%Page{}, params, encrypt: false)
|
changeset = Content.change_page(%Page{}, params, encrypt: false)
|
||||||
render(conn, "new.html", changeset: changeset)
|
render(conn, "new.html", changeset: changeset, page_title: "New Page")
|
||||||
end
|
end
|
||||||
|
|
||||||
def create(conn, %{"page" => page_params} = params) do
|
def create(conn, %{"page" => page_params} = params) do
|
||||||
|
@ -98,13 +98,13 @@ defmodule WikiWeb.PageController do
|
||||||
|
|
||||||
def show(conn, _params) do
|
def show(conn, _params) do
|
||||||
page = Repo.preload(conn.assigns.page, [:uploads, :pages_linked_from])
|
page = Repo.preload(conn.assigns.page, [:uploads, :pages_linked_from])
|
||||||
render(conn, "show.html", page: page)
|
render(conn, "show.html", page: page, page_title: page.title)
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit(conn, _params) do
|
def edit(conn, _params) do
|
||||||
page = conn.assigns.page |> Repo.preload(:uploads)
|
page = conn.assigns.page |> Repo.preload(:uploads)
|
||||||
changeset = Content.change_page(page)
|
changeset = Content.change_page(page)
|
||||||
render(conn, "edit.html", page: page, changeset: changeset)
|
render(conn, "edit.html", page: page, changeset: changeset, page_title: "Edit #{page.title}")
|
||||||
end
|
end
|
||||||
|
|
||||||
def update(conn, %{"page" => page_params}) do
|
def update(conn, %{"page" => page_params}) do
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<meta charset="utf-8"/>
|
<meta charset="utf-8"/>
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
|
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||||
<title>Wiki</title>
|
<title><%= assigns[:page_title] || "Wiki" %></title>
|
||||||
<link rel="stylesheet" href="<%= Routes.static_path(@conn, "/css/app.css") %>"/>
|
<link rel="stylesheet" href="<%= Routes.static_path(@conn, "/css/app.css") %>"/>
|
||||||
<script defer type="text/javascript" src="<%= Routes.static_path(@conn, "/js/app.js") %>"></script>
|
<script defer type="text/javascript" src="<%= Routes.static_path(@conn, "/js/app.js") %>"></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
Loading…
Reference in New Issue