unfinish tasks

This commit is contained in:
Matthew Ryan Dillon 2021-01-31 16:35:51 -07:00
parent dc146b85c3
commit a804998c4a
4 changed files with 21 additions and 1 deletions

View file

@ -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">

View file

@ -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