Class: ThinkFeelDoEngine::Manage::TasksController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- ThinkFeelDoEngine::Manage::TasksController
- Defined in:
- app/controllers/think_feel_do_engine/manage/tasks_controller.rb
Overview
User manages task creation, destruction, and assignment for groups
Constant Summary
Constants inherited from ApplicationController
ApplicationController::CSRF_COOKIE_NAME, ApplicationController::CSRF_HEADER_NAME, ApplicationController::INACTIVE_MESSAGE, ApplicationController::ROOT_URI
Instance Method Summary collapse
Methods inherited from ApplicationController
#access_denied_resource_path, #after_sign_in_path_for, #after_sign_out_path_for, #raise_not_found!, #render_not_found
Instance Method Details
#create ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'app/controllers/think_feel_do_engine/manage/tasks_controller.rb', line 17 def create @task = current_user.tasks.build(task_params) :create, @task if @task.save redirect_to arm_manage_tasks_group_path(@group.arm, @group), notice: "Task assigned." else errors = @task.errors..join(", ") flash[:alert] = "Unable to assign task: #{errors}" redirect_to arm_manage_tasks_group_path(@group.arm, @group) end end |
#destroy ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'app/controllers/think_feel_do_engine/manage/tasks_controller.rb', line 30 def destroy :destroy, @task group = @task.group if @task.complete_participant_list.present? flash[:alert] = "Unable to delete task from group, "\ "at least one related task status is complete." elsif @task.destroy flash[:success] = "Task unassigned from group." else errors = @task.errors..join(", ") flash[:alert] = "Unable to delete task from group: #{errors}" end redirect_to arm_manage_tasks_group_path(group.arm, group) end |
#index ⇒ Object
12 13 14 15 |
# File 'app/controllers/think_feel_do_engine/manage/tasks_controller.rb', line 12 def index :update, @group @learning_tasks = @group.learning_tasks end |