add containers show page

This commit is contained in:
2022-01-31 21:56:02 -05:00
parent b14c5ce88a
commit cc7162d267
3 changed files with 60 additions and 41 deletions

View File

@ -14,10 +14,20 @@ defmodule CanneryWeb.ContainerLive.Show do
@impl true
def handle_params(%{"id" => id}, _, socket) do
{:noreply,
socket
|> assign(:page_title, page_title(socket.assigns.live_action))
|> assign(:container, Containers.get_container!(id))}
socket =
socket
|> assign(
page_title: page_title(socket.assigns.live_action),
container: Containers.get_container!(id)
)
{:noreply, socket}
end
@impl true
def handle_event("delete", _, socket) do
socket.assigns.container |> Containers.delete_container!()
{:noreply, socket |> push_redirect(to: Routes.container_index_path(socket, :index))}
end
defp page_title(:show), do: "Show Container"