Added complete button
This commit is contained in:
16
app/views/tasks/_task.html.erb
Normal file
16
app/views/tasks/_task.html.erb
Normal file
@@ -0,0 +1,16 @@
|
||||
<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?"
|
||||
} %>
|
||||
|
||||
<% unless task.status == "completed" %>
|
||||
<%= button_to "Complete", complete_project_task_path(task.project, task),
|
||||
method: :patch,
|
||||
form: { data: { turbo_frame: dom_id(task) } } %>
|
||||
<% end %>
|
||||
</li>
|
||||
</turbo-frame>
|
||||
10
app/views/tasks/complete.turbo_stream.erb
Normal file
10
app/views/tasks/complete.turbo_stream.erb
Normal file
@@ -0,0 +1,10 @@
|
||||
<%= 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>
|
||||
<% end %>
|
||||
@@ -1,11 +1,5 @@
|
||||
<%= turbo_stream.append "tasks_list" do %>
|
||||
<li id="<%= dom_id(@task) %>">
|
||||
<%= @task.title %> (<%= @task.status %>)
|
||||
<%= link_to "Destroy", project_task_path(@project, @task), data: {
|
||||
turbo_method: :delete,
|
||||
turbo_confirm: "Are you sure?"
|
||||
} %>
|
||||
</li>
|
||||
<%= render partial: "tasks/task", locals: { task: @task } %>
|
||||
<% end %>
|
||||
|
||||
<%= turbo_stream.replace "new_task" do %>
|
||||
|
||||
Reference in New Issue
Block a user