Class: PlanMyStuff::Issues::TakesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- PlanMyStuff::Issues::TakesController
- Defined in:
- app/controllers/plan_my_stuff/issues/takes_controller.rb
Overview
Moves an issue’s pipeline ProjectItem to “Started” via PlanMyStuff::Pipeline.take!. Backs the “Take” button on the mounted issue show view (T-RC-017). The primary UI path for a dev picking up work on an issue they’ve been assigned to.
Instance Method Summary collapse
-
#create ⇒ Object
POST /issues/:issue_id/take.
-
#destroy ⇒ Object
DELETE /issues/:issue_id/take.
Instance Method Details
#create ⇒ Object
POST /issues/:issue_id/take
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'app/controllers/plan_my_stuff/issues/takes_controller.rb', line 13 def create issue = PlanMyStuff::Issue.find(params[:issue_id]) guard_already_taken!(issue) project_item = PlanMyStuff::Pipeline::IssueLinker.find_project_item(issue.number) project_item ||= add_to_pipeline(issue) PlanMyStuff::Pipeline.take!(project_item) assign_current_user(project_item) flash[:success] ||= "Issue ##{issue.number} taken." redirect_to(plan_my_stuff.issue_path(issue)) rescue ArgumentError, PlanMyStuff::Error => e pms_handle_rescue(e) flash[:error] = e. redirect_to(plan_my_stuff.issue_path(params[:issue_id])) end |
#destroy ⇒ Object
DELETE /issues/:issue_id/take
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'app/controllers/plan_my_stuff/issues/takes_controller.rb', line 32 def destroy issue = PlanMyStuff::Issue.find(params[:issue_id]) login = current_user_login guard_release!(issue, login) remaining = issue.assignees - [login] project_item = PlanMyStuff::Pipeline::IssueLinker.find_project_item(issue.number) if project_item.present? if remaining.empty? issue.update!(assignees: []) project_item.destroy! else project_item.assign!(remaining) end else issue.update!(assignees: remaining) end flash[:success] = "Issue ##{issue.number} released." redirect_to(plan_my_stuff.issue_path(issue)) rescue ArgumentError, PlanMyStuff::Error => e pms_handle_rescue(e) flash[:error] = e. redirect_to(plan_my_stuff.issue_path(params[:issue_id])) end |