summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2017-03-16 11:29:10 +0000
committerFilipa Lacerda <filipa@gitlab.com>2017-03-16 11:29:10 +0000
commit774e0e3bfe2d35e8b7eb704ab856549559965dfe (patch)
tree71fcb583132741efaa3db2055d9962c2d175d338 /app/controllers
parent9ce549b22ae453acf87b883afe8943123d0c48fe (diff)
parent5f9ace8eb1d71b35c92156177465b066ebbc4a3e (diff)
downloadgitlab-ce-774e0e3bfe2d35e8b7eb704ab856549559965dfe.tar.gz
Merge branch '27114-add-undo-mark-all-as-done-to-todos' into 'master'
Add 'Undo mark all as done' to Todos Closes #27114 See merge request !9890
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/dashboard/todos_controller.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/app/controllers/dashboard/todos_controller.rb b/app/controllers/dashboard/todos_controller.rb
index 5848ca62777..498690e8f11 100644
--- a/app/controllers/dashboard/todos_controller.rb
+++ b/app/controllers/dashboard/todos_controller.rb
@@ -22,12 +22,12 @@ class Dashboard::TodosController < Dashboard::ApplicationController
end
def destroy_all
- TodoService.new.mark_todos_as_done(@todos, current_user)
+ updated_ids = TodoService.new.mark_todos_as_done(@todos, current_user)
respond_to do |format|
format.html { redirect_to dashboard_todos_path, notice: 'All todos were marked as done.' }
format.js { head :ok }
- format.json { render json: todos_counts }
+ format.json { render json: todos_counts.merge(updated_ids: updated_ids) }
end
end
@@ -37,6 +37,12 @@ class Dashboard::TodosController < Dashboard::ApplicationController
render json: todos_counts
end
+ def bulk_restore
+ TodoService.new.mark_todos_as_pending_by_ids(params[:ids], current_user)
+
+ render json: todos_counts
+ end
+
# Used in TodosHelper also
def self.todos_count_format(count)
count >= 100 ? '99+' : count