diff options
author | Jacopo <beschi.jacopo@gmail.com> | 2017-01-29 10:44:30 +0100 |
---|---|---|
committer | Jacopo <beschi.jacopo@gmail.com> | 2017-03-16 07:15:00 +0100 |
commit | 5f9ace8eb1d71b35c92156177465b066ebbc4a3e (patch) | |
tree | 5af8e80ecace78f4d165cb470062e6a2cd53c853 /app/controllers | |
parent | 5e05d6b8cf26c424378ef6091a4b38c2d424808e (diff) | |
download | gitlab-ce-5f9ace8eb1d71b35c92156177465b066ebbc4a3e.tar.gz |
Add 'Undo mark all as done' to Todos
Added the ability to 'Undo mark all as done' todos marked as complete with 'Mark all as done'
in the 'Todo' tab of the Todo dashboard.
The operation undos only the todo previously marked as done with the 'Mark al as done' button.
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/dashboard/todos_controller.rb | 10 |
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 |