diff --git a/app/controllers/tasks_controller.rb b/app/controllers/tasks_controller.rb index f72a3c2..b4d7211 100644 --- a/app/controllers/tasks_controller.rb +++ b/app/controllers/tasks_controller.rb @@ -30,15 +30,16 @@ class TasksController < ApplicationController end end - def complete - @task = @project.tasks.find(params[:id]) - @task.update(status: "done") - respond_to do |format| - format.turbo_stream - format.html { redirect_to @project } + def complete + @task = @project.tasks.find(params[:id]) + @task.update(status: "done") + + respond_to do |format| + format.turbo_stream + format.html { redirect_to @project } + end end -end private diff --git a/app/views/tasks/_task.html.erb b/app/views/tasks/_task.html.erb index 77098b5..750ef9e 100644 --- a/app/views/tasks/_task.html.erb +++ b/app/views/tasks/_task.html.erb @@ -2,15 +2,14 @@
  • <%= task.title %> (<%= task.status %>) - <%= link_to "Destroy", project_task_path(task.project, task), data: { - turbo_method: :delete, - turbo_confirm: "Are you sure?" - } %> + <%= 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) } } %> + <% unless task.status == "done" %> + <%= button_to "Complete", + complete_project_task_path(task.project, task), + method: :patch, + form: { data: { turbo_frame: dom_id(task) } } %> <% end %>
  • - + \ No newline at end of file