Class: PlanMyStuff::Issues::TakesController

Inherits:
ApplicationController show all
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

Instance Method Details

#createObject

POST /issues/:issue_id/take



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 14

def create
  issue_number = params[:issue_id].to_i
  repo = params[:repo]

  project_item = PlanMyStuff::Pipeline::IssueLinker.find_project_item(issue_number)
  project_item ||= add_to_pipeline(issue_number, repo)

  PlanMyStuff::Pipeline.take!(project_item)
  assign_current_user(project_item)
  flash[:success] ||= "Issue ##{issue_number} taken."

  redirect_to(plan_my_stuff.issue_path(issue_number, repo: repo))
rescue ArgumentError, PlanMyStuff::Error => e
  flash[:error] = e.message
  redirect_to(plan_my_stuff.issue_path(issue_number, repo: repo))
end