Show Done tasks and Fixed turbo frame and stream bug

This commit is contained in:
KaungKaung
2026-01-30 09:38:32 +06:30
parent 7c9aef4324
commit 7f6123a6e6
4 changed files with 27 additions and 35 deletions

View File

@@ -1,15 +1,20 @@
<turbo-frame id="<%= dom_id(task) %>">
<li>
<%= task.title %> (<%= task.status %>)
<%= link_to "Destroy", project_task_path(task.project, task),
data: { turbo_method: :delete, turbo_confirm: "Are you sure?" } %>
<li id="<%= dom_id(task) %>" class="task-item <%= 'done-task' if task.status == 'done' %>">
<div class="task-title"><%= task.title %></div>
<div class="task-status"><%= task.status.titleize %></div>
<div class="task-actions flex gap-2">
<% unless task.status == "done" %>
<%= button_to "Complete",
complete_project_task_path(task.project, task),
method: :patch,
form: { data: { turbo_frame: dom_id(task) } } %>
data: { turbo_frame: dom_id(task) },
class: "task-btn complete-btn" %>
<% end %>
</li>
<%= link_to "Destroy",
project_task_path(task.project, task),
data: { turbo_method: :delete, turbo_confirm: "Are you sure?" },
class: "task-btn destroy-btn" %>
</div>
</li>
</turbo-frame>

View File

@@ -1,10 +1,3 @@
<%= turbo_stream.replace dom_id(@task) do %>
<li>
<%= @task.title %> (<%= @task.status %>)
<%= link_to "Destroy", project_task_path(@project, @task), data: {
turbo_method: :delete,
turbo_confirm: "Are you sure?"
} %>
</li>
<%= render @task %>
<% end %>

View File

@@ -1,7 +1,7 @@
<%= turbo_stream.append "tasks_list" do %>
<%= render partial: "tasks/task", locals: { task: @task } %>
<%= turbo_stream.append "tasks" do %>
<%= render @task %> <!-- renders _task.html.erb -->
<% end %>
<%= turbo_stream.replace "new_task" do %>
<%= render partial: "tasks/form", locals: { project: @project, task: Task.new } %>
<%= render "tasks/form", project: @project, task: Task.new %>
<% end %>