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
|
# File 'lib/3llo/command/card/add.rb', line 7
def execute(board_id)
list_options =
API::List
.find_all_by_board(board_id)
.map { |list| [list.name, list.id] }
.to_h()
interface = Application.fetch_interface!()
interface.print_frame do
if list_options.any?
list_id = interface.input.select(
"Choose the list this card should belong to:",
list_options
)
name = interface.input.ask("Name:", required: true)
description = interface.input.multiline("Description:").join("")
API::Card.create(name, description, list_id)
interface.puts("Card has been created.")
else
interface.puts("There is no list on board.")
end
end
end
|