diff options
author | Phil Hughes <me@iamphill.com> | 2016-03-17 16:08:59 +0300 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2016-03-17 16:08:59 +0300 |
commit | 41c107beccda574aefd3e5d992345087b2e0d848 (patch) | |
tree | 4289913a852453a663f1a12e6c0c9e456b96b76f /app/controllers/dashboard/todos_controller.rb | |
parent | 421215e3385860af42530895c22021c0704275e2 (diff) |
Mark all as done through AJAX
Diffstat (limited to 'app/controllers/dashboard/todos_controller.rb')
-rw-r--r-- | app/controllers/dashboard/todos_controller.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/app/controllers/dashboard/todos_controller.rb b/app/controllers/dashboard/todos_controller.rb index 10120dfdf3b..7857af9c5de 100644 --- a/app/controllers/dashboard/todos_controller.rb +++ b/app/controllers/dashboard/todos_controller.rb @@ -25,6 +25,10 @@ class Dashboard::TodosController < Dashboard::ApplicationController respond_to do |format| format.html { redirect_to dashboard_todos_path, notice: 'All todos were marked as done.' } format.js { render nothing: true } + format.json do + find_todos + render json: { count: @todos.size, done_count: current_user.todos.done.count } + end end end |