Add Authors

mix phx.gen.live Authors Author authors name:string description:text homepage_name:string homepage_url:string
This commit is contained in:
Thelonius Kort
2022-12-26 17:12:46 +01:00
parent 08481a12a8
commit 005a9d9337
12 changed files with 565 additions and 0 deletions

View File

@ -0,0 +1,21 @@
defmodule OutlookWeb.AuthorLive.Show do
use OutlookWeb, :live_view
alias Outlook.Authors
@impl true
def mount(_params, _session, socket) do
{:ok, socket}
end
@impl true
def handle_params(%{"id" => id}, _, socket) do
{:noreply,
socket
|> assign(:page_title, page_title(socket.assigns.live_action))
|> assign(:author, Authors.get_author!(id))}
end
defp page_title(:show), do: "Show Author"
defp page_title(:edit), do: "Edit Author"
end