unfinish tasks
This commit is contained in:
parent
dc146b85c3
commit
a804998c4a
4 changed files with 21 additions and 1 deletions
lib/planner_web/live
|
@ -86,7 +86,11 @@ defmodule TaskComponent do
|
|||
phx-value-task-id="<%= @task.id %>">
|
||||
</button>
|
||||
<% _ -> %>
|
||||
!
|
||||
<span
|
||||
class="pointer"
|
||||
phx-click="unfinish-task" phx-value-task-id="<%= @task.id %>">
|
||||
!
|
||||
</span>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="ml-5-5">
|
||||
|
|
|
@ -194,6 +194,12 @@ defmodule PlannerWeb.TasksLive do
|
|||
{:noreply, push_patch(socket, to: route)}
|
||||
end
|
||||
|
||||
def handle_event("unfinish-task", %{"task-id" => task_id}, socket) do
|
||||
{_, _} = Tasks.unfinish_task_by_id!(task_id)
|
||||
route = get_index_route(socket)
|
||||
{:noreply, push_patch(socket, to: route)}
|
||||
end
|
||||
|
||||
def handle_event("new-task", %{"task" => task_params}, socket) do
|
||||
add_new_task(task_params, socket.assigns.active_plan, socket)
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue