From 76ddd3dcb537002fb53cc1fc1ecf17f24fd5f78a Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Mon, 3 Aug 2020 11:16:10 -0400 Subject: [PATCH] Add page titles --- lib/wiki_web/controllers/page_controller.ex | 6 +++--- lib/wiki_web/templates/layout/app.html.eex | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/wiki_web/controllers/page_controller.ex b/lib/wiki_web/controllers/page_controller.ex index 262e2ea..09659f6 100644 --- a/lib/wiki_web/controllers/page_controller.ex +++ b/lib/wiki_web/controllers/page_controller.ex @@ -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 diff --git a/lib/wiki_web/templates/layout/app.html.eex b/lib/wiki_web/templates/layout/app.html.eex index b0d5f6e..0043046 100644 --- a/lib/wiki_web/templates/layout/app.html.eex +++ b/lib/wiki_web/templates/layout/app.html.eex @@ -4,7 +4,7 @@ - Wiki + <%= assigns[:page_title] || "Wiki" %> "/>