easy_flow 0.21.0 → 0.22.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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8c1b56b170c92f6fa9d7c2edc9864de42dfaef4dc97d41822442ca289722a91e
|
|
4
|
+
data.tar.gz: b4aa7640c10adcac242e412837870517ad688c463624d7f53dea366e4b6d0e96
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6a9ea816b147d6782cdc106113aeae7d95b0396679f920203afafad68f130a5895efb9ba0a020a7c55438260c2d8a782d58399a2aefd97574467be10255b5fe8
|
|
7
|
+
data.tar.gz: 1084833772e7cea7306b369543e362d46fa552222bb398ae1bd0edc7d52aa4d7bc20ddeaac3021f301d2b9e65c662e195a489e96d09653b3b54840ffd345f364
|
|
@@ -45,7 +45,15 @@ module EasyFlow
|
|
|
45
45
|
end
|
|
46
46
|
|
|
47
47
|
def run_location(run)
|
|
48
|
-
flow_routes.run_path(run)
|
|
48
|
+
flow_routes.run_path(run_address(run))
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def run_address(run)
|
|
52
|
+
run
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def find_run(runs, address)
|
|
56
|
+
runs.find(address)
|
|
49
57
|
end
|
|
50
58
|
|
|
51
59
|
def start_run(flow)
|
|
@@ -101,7 +109,7 @@ module EasyFlow
|
|
|
101
109
|
end
|
|
102
110
|
|
|
103
111
|
def admitted_run
|
|
104
|
-
found = Run.where(flow: hosted_flows)
|
|
112
|
+
found = find_run(Run.where(flow: hosted_flows), params[:id])
|
|
105
113
|
|
|
106
114
|
Admission.of_run(found, permitted: permitted?(found.flow))
|
|
107
115
|
end
|
data/lib/easy_flow/version.rb
CHANGED
|
@@ -21,6 +21,8 @@ A Rails engine for flows an admin draws on a canvas and a visitor runs one step
|
|
|
21
21
|
- `EasyFlow::FlowsController` — the visitor controller; the app subclasses it to serve one host's flows from its own routes and to change what happens at the start, on each step and at the finish.
|
|
22
22
|
- `hosted_by` — class method on a `FlowsController` subclass naming the host whose flows it serves.
|
|
23
23
|
- `routed_by` — class method on a `FlowsController` subclass naming the prefix of the app's own route names that the controller redirects and links to.
|
|
24
|
+
- `run_address` — private method a `FlowsController` subclass overrides to give the value put in a run's address in place of its id.
|
|
25
|
+
- `find_run` — private method a `FlowsController` subclass overrides to find a run, among the host's own runs, from the value in its address.
|
|
24
26
|
- `EasyFlow::Run` — the stored record of one visitor's pass through a flow, started with `EasyFlow::Run.start` on the live version or a chosen published one and pinned to that version, moved on past a waiting step with `advance`, read for the output its flow ended with by `output`, for whether it ended at an End step by `ended_at_end?`, for the step a loop stopped it at by `stopped_on_loop`, for when each step visit was completed by `completed_at` and for the time a Wait step holds it until by `held_until`, and linked to the runs its Flow steps started by `inner_runs`, to the one it is waiting on by `waiting_on`, and to the run that started it by `parent_run`.
|
|
25
27
|
- `EasyFlow::QuestionRunner` — reads a flow document: its steps, the next step for a set of answers and the times their steps were completed, the answers on the path taken, and a question's text and an answer's label.
|
|
26
28
|
|
|
@@ -330,6 +332,7 @@ Use this when an admin should edit a value that belongs to one of the app's own
|
|
|
330
332
|
- `finished(answers, run)` — called when the visitor reaches the end. `answers` is the answers on the path taken, keyed by step id as symbols, each a string or, for a checklist, an array of strings. `run` is the stored `EasyFlow::Run`, or `nil` when the admin set the flow to save nothing. A flow the admin set to save on finish gets its run created at this point. To act on which way the flow ended, read `run.output`; when `run` is `nil` there is no output to read. It must render or redirect. Default: the engine's completion page, which lists each answer on the path taken by its label, a checklist's answer as the labels of everything ticked joined into one sentence, and a File upload step's answer as the name the host's file store gives the file.
|
|
331
333
|
- `start_run(flow)` — creates the run when a visitor starts a flow the admin set to save each step. Call `super` and change the run it returns, for example to set its `owner` or `label`. To start the run on a version other than the live one, return `EasyFlow::Run.start(flow, version: ...)` instead of calling `super`; see "Start a run on a chosen version".
|
|
332
334
|
- `runner_for(definition)` — returns the runner used for each step. Return a subclass of `EasyFlow::QuestionRunner` to change what the step and completion pages read from it, built with `host: flow_host`, such as `IntakeRunner.new(definition, host: flow_host)`. A runner built without `host:` ignores the host's `allowed_answers`, so every step offers every answer and none is filled in or skipped.
|
|
335
|
+
- `run_address(run)` and `find_run(runs, address)` — name a run in the controller's own addresses by something other than its id, such as a random code kept on one of the app's own records. `run_address(run)` returns the value put in the run's address, and is used for the address a visitor is sent to after starting a run or answering a step and for the step form's address. `find_run(runs, address)` returns the run that address names, found within `runs`, which holds only runs of the host's own flows, and raises `ActiveRecord::RecordNotFound` when there is none. Override both together. Default: the run's id, and `runs.find(address)`.
|
|
333
336
|
5. Visit `/<path>/<slug>` for a published flow and walk it to the end.
|
|
334
337
|
|
|
335
338
|
### Start a run on a chosen version
|
data/the_local/interface.yml
CHANGED