summaryrefslogtreecommitdiff
path: root/app/controllers/dashboard
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2016-02-20 11:53:25 -0800
committerDouwe Maan <douwe@selenight.nl>2016-02-20 11:59:19 -0800
commitd53ae7f14d7c24ee590ba57632d267ec01706aa4 (patch)
tree930d407446a93197bfd41e4accd8800c95810a80 /app/controllers/dashboard
parent57d16552ff769cc5b41737de803bc2ddc4813f4e (diff)
downloadgitlab-ce-d53ae7f14d7c24ee590ba57632d267ec01706aa4.tar.gz
Add "Mark all as done" button
Diffstat (limited to 'app/controllers/dashboard')
-rw-r--r--app/controllers/dashboard/todos_controller.rb16
1 files changed, 15 insertions, 1 deletions
diff --git a/app/controllers/dashboard/todos_controller.rb b/app/controllers/dashboard/todos_controller.rb
index ed11ca5c0eb..4e8ebfb06a0 100644
--- a/app/controllers/dashboard/todos_controller.rb
+++ b/app/controllers/dashboard/todos_controller.rb
@@ -1,6 +1,7 @@
class Dashboard::TodosController < Dashboard::ApplicationController
+ before_filter :find_todos, only: [:index, :destroy_all]
+
def index
- @todos = TodosFinder.new(current_user, params).execute
@todos = @todos.page(params[:page]).per(PER_PAGE)
end
@@ -13,9 +14,22 @@ class Dashboard::TodosController < Dashboard::ApplicationController
end
end
+ def destroy_all
+ @todos.each(&:done)
+
+ respond_to do |format|
+ format.html { redirect_to dashboard_todos_path, notice: 'All todos were marked as done.' }
+ format.js { render nothing: true }
+ end
+ end
+
private
def todo
@todo ||= current_user.todos.find(params[:id])
end
+
+ def find_todos
+ @todos = TodosFinder.new(current_user, params).execute
+ end
end