Remove 'done' from task form. Add newest to top. Move done tasks to bottom

This commit is contained in:
KaungKaung
2026-01-30 11:29:17 +06:30
parent 6716129d4a
commit 4c30a133d3
5 changed files with 17 additions and 15 deletions

View File

@@ -2,19 +2,21 @@
<p><%= @project.description %></p>
<%= turbo_frame_tag "tasks" do %>
<ul id="tasks_list">
<% # First: pending or in-progress tasks %>
<%= render @project.tasks.reject { |t| t.status == "done" } %>
<% done_tasks = @project.tasks.select { |t| t.status == "done" } %>
<% if done_tasks.any? %>
<%= render done_tasks %>
<ul id="active_tasks">
<% @project.tasks.where(status: %w[to_do in_progress]).each do |task| %>
<%= render partial: "tasks/task", locals: { task: task } %>
<% end %>
</ul>
<ul id="done_tasks">
<% @project.tasks.where(status: "done").each do |task| %>
<%= render partial: "tasks/task", locals: { task: task } %>
<% end %>
</ul>
<% end %>
<%= turbo_frame_tag "new_task" do %>
<br>
<h2>Add New Task</h2>
<%= render "tasks/form", project: @project, task: Task.new %>
<% end %>