Class: Jura::Component::Issue::ChangeColumn

Inherits:
Object
  • Object
show all
Defined in:
lib/jura/component/issue/change_column.rb

Class Method Summary collapse

Class Method Details

.render(issue) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/jura/component/issue/change_column.rb', line 7

def self.render(issue)
  prompt = TTY::Prompt.new

  transitions = Api::Transitions.all(issue['id'])

  status = prompt.select("Choose the status") do |menu|
    transitions.each do |t|
      menu.choice t['name'], t
    end

    menu.choice 'Cancel', 'cancel'
  end

  if status == 'cancel'
    Sprint::Active.display_submenu(prompt, issue)
    return
  end

  unless prompt.yes?("Do you want to change the status of this issue to '#{status['name']}'?")
    render(issue)
  end

  Spinner.render(
    "Changed status of this issue from #{issue['fields']['status']['name']} to #{status['name']}!", clear: false
  ) do
    Api::Transitions.transition(issue['id'], { transition: { id: status['id'] } })
  end

  puts ""
end