Class: Dashboard::TodosController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Dashboard::TodosController
- Includes:
- ActionView::Helpers::NumberHelper, Gitlab::Utils::StrongMemoize, PaginatedCollection
- Defined in:
- app/controllers/dashboard/todos_controller.rb
Instance Method Summary collapse
Instance Method Details
#bulk_restore ⇒ Object
55 56 57 58 59 |
# File 'app/controllers/dashboard/todos_controller.rb', line 55 def bulk_restore TodoService.new.restore_todos(current_user.todos.id_in(params[:ids]), current_user) render json: todos_counts end |
#destroy ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'app/controllers/dashboard/todos_controller.rb', line 25 def destroy todo = current_user.todos.find(params[:id]) TodoService.new.resolve_todo(todo, current_user, resolved_by_action: :mark_done) respond_to do |format| format.html do redirect_to dashboard_todos_path, status: :found, notice: _('To-do item successfully marked as done.') end format.js { head :ok } format.json { render json: todos_counts } end end |
#destroy_all ⇒ Object
39 40 41 42 43 44 45 46 47 |
# File 'app/controllers/dashboard/todos_controller.rb', line 39 def destroy_all updated_ids = TodoService.new.resolve_todos(@todos, current_user, resolved_by_action: :mark_all_done) respond_to do |format| format.html { redirect_to dashboard_todos_path, status: :found, notice: _('Everything on your to-do list is marked as done.') } format.js { head :ok } format.json { render json: todos_counts.merge(updated_ids: updated_ids) } end end |
#index ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'app/controllers/dashboard/todos_controller.rb', line 15 def index @sort = params[:sort] @todos = @todos.page(params[:page]) @todos = @todos.with_entity_associations return if redirect_out_of_range(@todos, todos_page_count(@todos)) @allowed_todos = ::Todos::AllowedTargetFilterService.new(@todos, current_user).execute end |
#restore ⇒ Object
49 50 51 52 53 |
# File 'app/controllers/dashboard/todos_controller.rb', line 49 def restore TodoService.new.restore_todo(current_user.todos.find(params[:id]), current_user) render json: todos_counts end |