summaryrefslogtreecommitdiff
path: root/app/controllers/dashboard/tasks_controller.rb
blob: a8884be54e4f0f9117a7bc25560eda01d1c068f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
class Dashboard::TasksController < Dashboard::ApplicationController
  def index
    @tasks = TasksFinder.new(current_user, params).execute
    @tasks = @tasks.page(params[:page]).per(PER_PAGE)
  end

  def destroy
    task.done!

    respond_to do |format|
      format.html { redirect_to dashboard_tasks_path, notice: 'Task was successfully marked as done.' }
      format.js { render nothing: true }
    end
  end

  private

  def task
    @task ||= current_user.tasks.find(params[:id])
  end
end