easy_flow 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/controllers/easy_flow/flows_controller.rb +21 -6
- data/lib/easy_flow/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8ff52593be51a666b42de7e2b05f7fea31de7b09240a21884d341ee0d7bfc1d2
|
|
4
|
+
data.tar.gz: cb2902b162132cdbfa5060b64acc49835fdbfaeacffc83665a8d2ab74a5de722
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 10a1e356dfcddc779ffc9f0ada50195c03a676ff2717ed64f0e6bbbbab1df3e834e6f7be22758a0de79c7ee6e490fe471c1654d4f4af97f1172a9bed69f2749b
|
|
7
|
+
data.tar.gz: 4cb65c539b7a12d104e0c12db6cb304267ef966b892ba3cdfe920e0e4e50d703936189ad685a2412761e5f4c4e9bed292048723c8c1c84e9ff43408a83eb193b
|
|
@@ -7,11 +7,11 @@ module EasyFlow
|
|
|
7
7
|
end
|
|
8
8
|
|
|
9
9
|
def start
|
|
10
|
-
redirect_to
|
|
10
|
+
redirect_to run_location(start_run(flow))
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
def step
|
|
14
|
-
@guide =
|
|
14
|
+
@guide = runner_for(running_definition)
|
|
15
15
|
@progress = progress
|
|
16
16
|
@guide.run(@progress)
|
|
17
17
|
@answers = @progress.recorded
|
|
@@ -24,11 +24,23 @@ module EasyFlow
|
|
|
24
24
|
|
|
25
25
|
def update
|
|
26
26
|
params[:back] ? progress.discard_last : record_submitted
|
|
27
|
-
redirect_to
|
|
27
|
+
redirect_to run_location(run)
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
private
|
|
31
31
|
|
|
32
|
+
def runner_for(definition)
|
|
33
|
+
QuestionRunner.new(definition)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def run_location(run)
|
|
37
|
+
easy_flow.run_path(run)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def start_run(flow)
|
|
41
|
+
Run.start(flow)
|
|
42
|
+
end
|
|
43
|
+
|
|
32
44
|
def flow_start_path(slug)
|
|
33
45
|
easy_flow.flow_path(slug)
|
|
34
46
|
end
|
|
@@ -42,7 +54,7 @@ module EasyFlow
|
|
|
42
54
|
end
|
|
43
55
|
|
|
44
56
|
def step_form
|
|
45
|
-
return { url:
|
|
57
|
+
return { url: run_location(run), method: :patch } if run
|
|
46
58
|
|
|
47
59
|
{ url: flow_step_path(@guide.slug), method: :get }
|
|
48
60
|
end
|
|
@@ -53,7 +65,10 @@ module EasyFlow
|
|
|
53
65
|
|
|
54
66
|
def render_completion
|
|
55
67
|
@answered = @guide.state_on_path(@answers)
|
|
56
|
-
@progress.finish(@answered)
|
|
68
|
+
finished(@answered, @progress.finish(@answered))
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def finished(_answers, _run)
|
|
57
72
|
render :complete
|
|
58
73
|
end
|
|
59
74
|
|
|
@@ -97,7 +112,7 @@ module EasyFlow
|
|
|
97
112
|
end
|
|
98
113
|
|
|
99
114
|
def asked
|
|
100
|
-
|
|
115
|
+
runner_for(run.pinned_definition).steps.map(&:id)
|
|
101
116
|
end
|
|
102
117
|
end
|
|
103
118
|
end
|
data/lib/easy_flow/version.rb
CHANGED