Remove 'done' from task form. Add newest to top. Move done tasks to bottom
This commit is contained in:
@@ -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 %>
|
||||
|
||||
Reference in New Issue
Block a user