easy_flow 0.23.0 → 0.25.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/concerns/easy_flow/manage/draws_canvas.rb +1 -1
- data/app/controllers/easy_flow/flows_controller.rb +22 -4
- data/app/controllers/easy_flow/manage/canvas_controller.rb +1 -1
- data/app/controllers/easy_flow/manage/definitions_controller.rb +2 -2
- data/app/controllers/easy_flow/manage/flows_controller.rb +11 -5
- data/app/controllers/easy_flow/manage/previews_controller.rb +1 -1
- data/app/controllers/easy_flow/manage/versions_controller.rb +2 -2
- data/app/models/easy_flow/definition.rb +2 -0
- data/app/models/easy_flow/version.rb +2 -0
- data/app/views/easy_flow/flows/complete.html.erb +1 -1
- data/app/views/easy_flow/flows/show.html.erb +2 -2
- data/app/views/easy_flow/flows/step.html.erb +2 -2
- data/db/migrate/20261012210000_add_public_code_to_easy_flow_definitions.rb +17 -0
- data/db/migrate/20261012210100_add_public_code_to_easy_flow_versions.rb +17 -0
- data/lib/easy_flow/host.rb +1 -1
- data/lib/easy_flow/version.rb +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f7f3a5cbb2c164df9c3c513c7de107dcb30123987e5392853e76554c242aff84
|
|
4
|
+
data.tar.gz: 320ffff05f4107aa8573b2be17a41b5a4e7aa49759b6228c74f7cd7905501b5a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 40887692880f1f9f468d11818cac2912b2debb61bdce99a2e238d9be4338c4c915e61df7db046938f371c97eaf2e296ee2c8985a1a930960ef9ffc4bd45a25cb
|
|
7
|
+
data.tar.gz: e01daf58e09f740dd57a5e3690028755abd7c5b77f604bdf765c60637f0fb8974852eab79ed6ebc200225cca7ac4471fde33a75420ad7e00f87cd4ab786ac7f4
|
|
@@ -6,7 +6,7 @@ module EasyFlow
|
|
|
6
6
|
private
|
|
7
7
|
|
|
8
8
|
def canvas_payload(flow)
|
|
9
|
-
Canvas.new(canvas_document(flow), host: flow_host, flows: hosted_flows.order(:title), flow_path: ->(id) { manage_flow_path(id, from: flow
|
|
9
|
+
Canvas.new(canvas_document(flow), host: flow_host, flows: hosted_flows.order(:title), flow_path: ->(id) { manage_flow_path(hosted_flows.find_by(id: id) || id, from: flow) }, flow: flow).to_h
|
|
10
10
|
.merge("undoable" => flow.edit_history.undoable?, "redoable" => flow.edit_history.redoable?,
|
|
11
11
|
"changes" => listed_changes(flow), "flow" => flow_details(flow))
|
|
12
12
|
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
module EasyFlow
|
|
2
2
|
class FlowsController < ApplicationController
|
|
3
|
-
helper_method :flow_start_path, :flow_step_path, :previewing?, :step_form, :carries_answers
|
|
3
|
+
helper_method :flow_start_path, :flow_step_path, :previewing?, :step_form, :carries_answers?, :flow_address
|
|
4
4
|
|
|
5
5
|
def show
|
|
6
6
|
@flow = flow
|
|
@@ -60,6 +60,12 @@ module EasyFlow
|
|
|
60
60
|
Run.start(flow)
|
|
61
61
|
end
|
|
62
62
|
|
|
63
|
+
def flow_address(slug)
|
|
64
|
+
return slug unless flow_host.finds_flows_across_owners
|
|
65
|
+
|
|
66
|
+
(run&.flow || flow).public_code
|
|
67
|
+
end
|
|
68
|
+
|
|
63
69
|
def flow_start_path(slug)
|
|
64
70
|
flow_routes.flow_path(slug)
|
|
65
71
|
end
|
|
@@ -75,7 +81,7 @@ module EasyFlow
|
|
|
75
81
|
def step_form
|
|
76
82
|
return { url: run_location(run), method: :patch } if run
|
|
77
83
|
|
|
78
|
-
{ url: flow_step_path(@guide.slug), method: :get }
|
|
84
|
+
{ url: flow_step_path(flow_address(@guide.slug)), method: :get }
|
|
79
85
|
end
|
|
80
86
|
|
|
81
87
|
def carries_answers?
|
|
@@ -109,13 +115,25 @@ module EasyFlow
|
|
|
109
115
|
end
|
|
110
116
|
|
|
111
117
|
def admitted_run
|
|
112
|
-
found = find_run(Run.where(flow:
|
|
118
|
+
found = find_run(Run.where(flow: visited_flows), params[:id])
|
|
113
119
|
|
|
114
120
|
Admission.of_run(found, permitted: permitted?(found.flow))
|
|
115
121
|
end
|
|
116
122
|
|
|
117
123
|
def flow
|
|
118
|
-
@stored_flow ||= admit(
|
|
124
|
+
@stored_flow ||= admit(visited_flow)
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
def visited_flow
|
|
128
|
+
return hosted_flows.find_by(slug: params[:slug]) unless flow_host.finds_flows_across_owners
|
|
129
|
+
|
|
130
|
+
visited_flows.find_by_public_code!(params[:slug])
|
|
131
|
+
rescue ActiveRecord::RecordNotFound
|
|
132
|
+
nil
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
def visited_flows
|
|
136
|
+
flow_host.finds_flows_across_owners ? flow_host.flows : hosted_flows
|
|
119
137
|
end
|
|
120
138
|
|
|
121
139
|
def flowing_definition(flow)
|
|
@@ -2,11 +2,11 @@ module EasyFlow
|
|
|
2
2
|
module Manage
|
|
3
3
|
class DefinitionsController < BaseController
|
|
4
4
|
def edit
|
|
5
|
-
@flow = hosted_flows.
|
|
5
|
+
@flow = hosted_flows.find_by_public_code!(params[:flow_id])
|
|
6
6
|
end
|
|
7
7
|
|
|
8
8
|
def update
|
|
9
|
-
@flow = hosted_flows.
|
|
9
|
+
@flow = hosted_flows.find_by_public_code!(params[:flow_id])
|
|
10
10
|
@flow.edit_history.edit_document(JSON.parse(params.require(:definition)))
|
|
11
11
|
redirect_to manage_flow_path(@flow), notice: "Definition saved."
|
|
12
12
|
end
|
|
@@ -21,23 +21,23 @@ module EasyFlow
|
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
def show
|
|
24
|
-
@flow = hosted_flows.
|
|
25
|
-
@parent =
|
|
24
|
+
@flow = hosted_flows.find_by_public_code!(params[:id])
|
|
25
|
+
@parent = parent_flow
|
|
26
26
|
@canvas = canvas_payload(@flow)
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
def edit
|
|
30
|
-
@flow = hosted_flows.
|
|
30
|
+
@flow = hosted_flows.find_by_public_code!(params[:id])
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
def update
|
|
34
|
-
@flow = hosted_flows.
|
|
34
|
+
@flow = hosted_flows.find_by_public_code!(params[:id])
|
|
35
35
|
@flow.update!(flow_params)
|
|
36
36
|
redirect_to manage_flow_path(@flow), notice: "Saved."
|
|
37
37
|
end
|
|
38
38
|
|
|
39
39
|
def destroy
|
|
40
|
-
flow = hosted_flows.
|
|
40
|
+
flow = hosted_flows.find_by_public_code!(params[:id])
|
|
41
41
|
return redirect_to manage_flows_path, alert: flow.errors.full_messages.to_sentence unless flow.destroy
|
|
42
42
|
|
|
43
43
|
redirect_to manage_flows_path, notice: "Flow removed."
|
|
@@ -45,6 +45,12 @@ module EasyFlow
|
|
|
45
45
|
|
|
46
46
|
private
|
|
47
47
|
|
|
48
|
+
def parent_flow
|
|
49
|
+
hosted_flows.find_by_public_code!(params[:from]) if params[:from].present?
|
|
50
|
+
rescue ActiveRecord::RecordNotFound
|
|
51
|
+
nil
|
|
52
|
+
end
|
|
53
|
+
|
|
48
54
|
def ordered_flows
|
|
49
55
|
hosted_flows.order(:slug)
|
|
50
56
|
end
|
|
@@ -7,7 +7,7 @@ module EasyFlow
|
|
|
7
7
|
end
|
|
8
8
|
|
|
9
9
|
def return
|
|
10
|
-
flow.return_to(flow.definition_versions.
|
|
10
|
+
flow.return_to(flow.definition_versions.find_by_public_code!(params[:id]))
|
|
11
11
|
|
|
12
12
|
redirect_to manage_flow_path(flow), notice: "The flow is back to that version."
|
|
13
13
|
end
|
|
@@ -15,7 +15,7 @@ module EasyFlow
|
|
|
15
15
|
private
|
|
16
16
|
|
|
17
17
|
def flow
|
|
18
|
-
@flow ||= hosted_flows.
|
|
18
|
+
@flow ||= hosted_flows.find_by_public_code!(params[:flow_id])
|
|
19
19
|
end
|
|
20
20
|
end
|
|
21
21
|
end
|
|
@@ -2,6 +2,8 @@ module EasyFlow
|
|
|
2
2
|
class Definition < ApplicationRecord
|
|
3
3
|
self.table_name = "easy_flow_definitions"
|
|
4
4
|
|
|
5
|
+
has_public_code
|
|
6
|
+
|
|
5
7
|
enum :status, { active: "active", hidden: "hidden", inactive: "inactive" }
|
|
6
8
|
enum :kind, { scored: "scored", guide: "guide" }
|
|
7
9
|
enum :persists, { unsaved: "unsaved", each_step: "each_step", on_finish: "on_finish" }
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<% content_for(:title, "Complete") %>
|
|
2
2
|
|
|
3
|
-
<% starting_over = flow_start_path(@guide.slug) %>
|
|
3
|
+
<% starting_over = flow_start_path(flow_address(@guide.slug)) %>
|
|
4
4
|
|
|
5
5
|
<%= ui_page(max_width: :md) do %>
|
|
6
6
|
<%= ui_page_header(title: "That's everything", subtitle: "Thanks — here's what you told us") do |header| %>
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
<%= ui_section do %>
|
|
7
7
|
<div class="flex flex-wrap items-center gap-3">
|
|
8
8
|
<% if @flow.each_step? && @flow.definition.present? && !previewing? %>
|
|
9
|
-
<%= ui_form(action: flow_routes.flow_runs_path(@flow.slug), method: :post) do %>
|
|
9
|
+
<%= ui_form(action: flow_routes.flow_runs_path(flow_address(@flow.slug)), method: :post) do %>
|
|
10
10
|
<%= ui_button(label: @flow.start_label.presence || "Start", type: :submit) %>
|
|
11
11
|
<% end %>
|
|
12
12
|
<% else %>
|
|
13
|
-
<%= ui_button(label: @flow.start_label.presence || "Start", href: flow_step_path(@flow.slug)) %>
|
|
13
|
+
<%= ui_button(label: @flow.start_label.presence || "Start", href: flow_step_path(flow_address(@flow.slug))) %>
|
|
14
14
|
<% end %>
|
|
15
15
|
</div>
|
|
16
16
|
<% end %>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<% content_for(:title, @guide.headline) %>
|
|
2
2
|
|
|
3
3
|
<%= ui_page(max_width: :md) do %>
|
|
4
|
-
<%= link_to "← Start over", flow_start_path(@guide.slug), class: "text-sm text-accent-600 hover:text-accent-700" %>
|
|
4
|
+
<%= link_to "← Start over", flow_start_path(flow_address(@guide.slug)), class: "text-sm text-accent-600 hover:text-accent-700" %>
|
|
5
5
|
|
|
6
6
|
<div class="mt-6 mb-6">
|
|
7
7
|
<%= ui_progress(value: @answers.size, max: [ @guide.steps_on_path(@answers).size, 1 ].max, label: "Question #{@answers.size + 1}") %>
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
<% if @waiting %>
|
|
15
15
|
<p class="ks-hint">Waiting for <%= @waiting %>.</p>
|
|
16
16
|
<% if carries_answers? %>
|
|
17
|
-
<div class="mt-4"><%= ui_button(label: "Check again", href: "#{flow_step_path(@guide.slug)}?#{{ answers: @answers, completed_at: @progress.completed_at.transform_values(&:iso8601) }.to_query}", variant: :secondary) %></div>
|
|
17
|
+
<div class="mt-4"><%= ui_button(label: "Check again", href: "#{flow_step_path(flow_address(@guide.slug))}?#{{ answers: @answers, completed_at: @progress.completed_at.transform_values(&:iso8601) }.to_query}", variant: :secondary) %></div>
|
|
18
18
|
<% end %>
|
|
19
19
|
<% else %>
|
|
20
20
|
<%= form_with url: step_form[:url], method: step_form[:method], multipart: true, data: { turbo: false } do %>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
class AddPublicCodeToEasyFlowDefinitions < ActiveRecord::Migration[8.1]
|
|
2
|
+
class Record < ActiveRecord::Base
|
|
3
|
+
self.table_name = "easy_flow_definitions"
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
def up
|
|
7
|
+
add_column :easy_flow_definitions, :public_code, :string
|
|
8
|
+
Record.reset_column_information
|
|
9
|
+
Record.find_each { |record| record.update_columns(public_code: PublicCode.generate) }
|
|
10
|
+
change_column_null :easy_flow_definitions, :public_code, false
|
|
11
|
+
add_index :easy_flow_definitions, :public_code, unique: true
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def down
|
|
15
|
+
remove_column :easy_flow_definitions, :public_code
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
class AddPublicCodeToEasyFlowVersions < ActiveRecord::Migration[8.1]
|
|
2
|
+
class Record < ActiveRecord::Base
|
|
3
|
+
self.table_name = "easy_flow_versions"
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
def up
|
|
7
|
+
add_column :easy_flow_versions, :public_code, :string
|
|
8
|
+
Record.reset_column_information
|
|
9
|
+
Record.find_each { |record| record.update_columns(public_code: PublicCode.generate) }
|
|
10
|
+
change_column_null :easy_flow_versions, :public_code, false
|
|
11
|
+
add_index :easy_flow_versions, :public_code, unique: true
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def down
|
|
15
|
+
remove_column :easy_flow_versions, :public_code
|
|
16
|
+
end
|
|
17
|
+
end
|
data/lib/easy_flow/host.rb
CHANGED
|
@@ -2,7 +2,7 @@ module EasyFlow
|
|
|
2
2
|
class Host
|
|
3
3
|
attr_reader :name
|
|
4
4
|
attr_writer :layout, :admin_layout, :offers, :allowed_answers
|
|
5
|
-
attr_accessor :admin_authentication_method, :visitor_authorization_method, :refusal_method, :owner_method
|
|
5
|
+
attr_accessor :admin_authentication_method, :visitor_authorization_method, :refusal_method, :owner_method, :finds_flows_across_owners
|
|
6
6
|
|
|
7
7
|
def initialize(name)
|
|
8
8
|
@name = name.to_s
|
data/lib/easy_flow/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: easy_flow
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.25.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- tylercschneider
|
|
@@ -166,6 +166,8 @@ files:
|
|
|
166
166
|
- db/migrate/20261007120000_add_parent_run_to_easy_flow_runs.rb
|
|
167
167
|
- db/migrate/20261011130000_keep_step_visits_whole_in_easy_flow_runs.rb
|
|
168
168
|
- db/migrate/20261012200000_add_public_code_to_easy_flow_runs.rb
|
|
169
|
+
- db/migrate/20261012210000_add_public_code_to_easy_flow_definitions.rb
|
|
170
|
+
- db/migrate/20261012210100_add_public_code_to_easy_flow_versions.rb
|
|
169
171
|
- lib/easy_flow.rb
|
|
170
172
|
- lib/easy_flow/engine.rb
|
|
171
173
|
- lib/easy_flow/host.rb
|