feat: add completed tasks liveviews
This commit is contained in:
parent
035d2599ca
commit
20027b42f0
5 changed files with 204 additions and 0 deletions
43
lib/putzplan_web/live/completed_task_live/show.ex
Normal file
43
lib/putzplan_web/live/completed_task_live/show.ex
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
defmodule PutzplanWeb.CompletedTaskLive.Show do
|
||||
use PutzplanWeb, :live_view
|
||||
|
||||
@impl true
|
||||
def render(assigns) do
|
||||
~H"""
|
||||
<.header>
|
||||
Completed task <%= @completed_task.id %>
|
||||
<:subtitle>This is a completed_task record from your database.</:subtitle>
|
||||
|
||||
</.header>
|
||||
|
||||
<.list>
|
||||
|
||||
<:item title="Id"><%= @completed_task.id %></:item>
|
||||
|
||||
</.list>
|
||||
|
||||
<.back navigate={~p"/completed_tasks"}>Back to completed_tasks</.back>
|
||||
|
||||
|
||||
"""
|
||||
end
|
||||
|
||||
@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(
|
||||
:completed_task,
|
||||
Ash.get!(Putzplan.Tasks.CompletedTask, id, actor: socket.assigns.current_user)
|
||||
)}
|
||||
end
|
||||
|
||||
defp page_title(:show), do: "Show Completed task"
|
||||
defp page_title(:edit), do: "Edit Completed task"
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue