Add page titles

This commit is contained in:
Shadowfacts 2020-08-03 11:16:10 -04:00
parent ecddb76101
commit 76ddd3dcb5
Signed by: shadowfacts
GPG Key ID: 94A5AB95422746E5
2 changed files with 4 additions and 4 deletions

View File

@ -62,7 +62,7 @@ defmodule WikiWeb.PageController do
def new(conn, params) do
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
def create(conn, %{"page" => page_params} = params) do
@ -98,13 +98,13 @@ defmodule WikiWeb.PageController do
def show(conn, _params) do
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
def edit(conn, _params) do
page = conn.assigns.page |> Repo.preload(:uploads)
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
def update(conn, %{"page" => page_params}) do

View File

@ -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>Wiki</title>
<title><%= assigns[:page_title] || "Wiki" %></title>
<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>
</head>