handle unfiled tasks (#51)

This commit is contained in:
Matthew Ryan Dillon 2020-11-21 17:17:29 -07:00 committed by GitHub
parent d57fdd0d0f
commit 8201dfbf7a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 29 additions and 9 deletions

View file

@ -134,13 +134,13 @@ defmodule TaskDetailsComponent do
to: @route_index_tasks.(@socket),
class: "delete is-pulled-right"
) %>
<%= if(not is_nil(@task.due_at) or is_nil(@task.filed_at)) do %>
<%= if(not is_nil(@task.due_at) or length(@task.plans) == 0) do %>
<div class="tags">
<%= if(not is_nil(@task.due_at)) do %>
<span class="tag is-warning">
due: <%= @task.due_at %>
</span><% end %>
<%= if(is_nil(@task.filed_at)) do %>
<%= if(length(@task.plans) == 0) do %>
<span class="tag is-danger">
unfiled
</span>

View file

@ -38,7 +38,7 @@ defmodule PlannerWeb.TasksLive do
socket
|> assign(:active_task, task_id)
|> assign(:active_plan, nil)
|> assign(:tasks, Tasks.list_unfinished_tasks())
|> assign(:tasks, Tasks.list_unfiled_tasks())
|> add_task_routes()
{:noreply, assign(socket, :active_task, task_id)}
@ -72,7 +72,7 @@ defmodule PlannerWeb.TasksLive do
socket
|> assign(:active_task, nil)
|> assign(:active_plan, nil)
|> assign(:tasks, Tasks.list_unfinished_tasks())
|> assign(:tasks, Tasks.list_unfiled_tasks())
|> add_task_routes()
{:noreply, socket}
@ -94,7 +94,7 @@ defmodule PlannerWeb.TasksLive do
<%= error_tag(f, :name) %>
</div>
</form>
<%= live_patch("all unfinished tasks", to: Routes.tasks_path(@socket, :index), class: "panel-block") %>
<%= live_patch("unfiled", to: Routes.tasks_path(@socket, :index), class: "panel-block") %>
<%= for plan <- @plans do %>
<%= live_patch(
plan.name,
@ -109,7 +109,7 @@ defmodule PlannerWeb.TasksLive do
<div class="column">
<%= case @active_plan do %>
<%= nil -> %>
<h4 class="title is-4">all unfinished tasks</h4>
<h4 class="title is-4">unfiled</h4>
<% _ -> %>
<h4 class="title is-4">
<button
@ -220,7 +220,7 @@ defmodule PlannerWeb.TasksLive do
defp refresh_tasks_and_flash_msg(socket, msg) do
tasks =
case socket.assigns.active_plan do
nil -> Tasks.list_unfinished_tasks()
nil -> Tasks.list_unfiled_tasks()
plan -> Tasks.list_unfinished_tasks_by_plan_id(plan.id)
end