Misc cleanup to tasks (#37)

This commit is contained in:
Matthew Ryan Dillon 2020-08-09 20:40:15 -07:00 committed by GitHub
parent aa02a8441b
commit 177067ab00
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 20 additions and 50 deletions

View file

@ -214,18 +214,6 @@ defmodule TaskEditComponent do
<%= error_tag(f, :due_at) %>
</div>
<div class="field">
<%= label(f, :finished_at, class: "label") do %>
<%= if(is_nil(@task.finished_at)) do %>
<%= checkbox(f, :finished_at) %>
<% else %>
<%= checkbox(f, :finished_at, checked_value: @task.finished_at) %>
<% end %>
finished
<% end %>
<%= error_tag(f, :finished_at) %>
</div>
<div class="control">
<%= submit("save", class: "button is-dark is-small") %>
</div>

View file

@ -12,7 +12,7 @@ defmodule PlannerWeb.TasksLive do
{:ok, socket}
end
def handle_params(%{"id" => task_id}, _, socket) do
def handle_params(%{"task_id" => task_id}, _, socket) do
case Tasks.verify_task_id_from_url(task_id) do
true -> {:noreply, assign(socket, :active_task, task_id)}
_ -> {:noreply, push_patch(socket, to: Routes.tasks_path(socket, :index))}
@ -76,7 +76,7 @@ defmodule PlannerWeb.TasksLive do
end
def handle_event("new-task", %{"task" => task_params}, socket) do
case Tasks.add_task(task_params) do
case Tasks.create_task(task_params) do
{:ok, task} ->
socket =
socket