Class: FlowController
Instance Method Summary
collapse
#sign_in
#active_nav, #current_user, #signed_in?
Instance Method Details
#cancel ⇒ Object
56
57
|
# File 'app/controllers/flow_controller.rb', line 56
def cancel
end
|
#create ⇒ Object
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
37
38
39
40
41
42
43
|
# File 'app/controllers/flow_controller.rb', line 11
def create
@meta_title = 'Create Flow'
if request.method == 'POST'
begin
@flow = Distribot::Flow.create!(JSON.parse(params[:json], symbolize_names: true))
flash[:notice] = 'Successfully Created'
redirect_to show_flow_path(flow_id: @flow.id)
rescue
flash[:error] = 'There was a problem - please try again'
begin
@flow = Distribot::Flow.new(JSON.parse(params[:json]))
rescue JSON::ParserError => e
flash[:error] = "Invalid JSON: #{e}"
@flow_json = params[:json]
@flow = Distribot::Flow.new()
end
end
else
@flow = Distribot::Flow.new(
phases: [
{
name: "start",
is_initial: true,
transitions_to: "finish"
},
{
name: "finish",
is_final: true,
}
]
)
end
end
|
#list ⇒ Object
5
6
7
8
9
|
# File 'app/controllers/flow_controller.rb', line 5
def list
@meta_title = 'Active Flows'
@flows = Distribot::Flow.active
render @flows.empty? ? :empty_list : :list
end
|
#pause ⇒ Object
50
51
|
# File 'app/controllers/flow_controller.rb', line 50
def pause
end
|
#resume ⇒ Object
53
54
|
# File 'app/controllers/flow_controller.rb', line 53
def resume
end
|
#show ⇒ Object
45
46
47
48
|
# File 'app/controllers/flow_controller.rb', line 45
def show
@flow = Distribot::Flow.find(params[:flow_id])
@meta_title = "View Flow #{@flow.id}"
end
|