Class: PlanMyStuff::ProjectItems::StatusesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/plan_my_stuff/project_items/statuses_controller.rb

Overview

Handles moving a project item to a new status column via CRUD-style routes. Backs the status dropdown on the project board view (T-046).

PATCH /projects/:project_id/items/:item_id/status -> update (moves to new status)

Instance Method Summary collapse

Instance Method Details

#updateObject

PATCH /projects/:project_id/items/:item_id/status



12
13
14
15
16
17
18
19
20
21
22
# File 'app/controllers/plan_my_stuff/project_items/statuses_controller.rb', line 12

def update
  item = find_project_item

  item.move_to!(params[:status])

  flash[:success] = "Item moved to #{params[:status]}."
  redirect_to(plan_my_stuff.project_path(params[:project_id]))
rescue ArgumentError, PMS::Error => e
  flash[:error] = e.message
  redirect_to(plan_my_stuff.project_path(params[:project_id]))
end