easy_flow 0.4.1 → 0.4.2

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: 40a016478b5c039fb2f7400893c890980fd1c66f52b835f61be7a3a68061a71d
4
- data.tar.gz: c8c747889382a26e6c2d340b330f45a802932bac768da695845e697df722848c
3
+ metadata.gz: ecb99b16819c39ee6779f505087103685f5451955584173180cee6a134ba99d7
4
+ data.tar.gz: 4c88735a46f9e295546aa10b7f88af016e306f55d4157e1f92f9b86de7efa9c8
5
5
  SHA512:
6
- metadata.gz: 4a42a48255633d247401da16dfb668d0c774c90e0f8a70df7bef426c6a7f5d59f674837337177856c3d7a0e7106993077d1038fbfe2bc0c6953a8624930a45bf
7
- data.tar.gz: 4bd045161d5eb15f7ed880df701d6ed7e5016a408fea9da21d98bc4234776b585c12099dcf9224d70a1003252bb12c6db69a38ffff45001d7f6e4898bd356c8d
6
+ metadata.gz: bfbff203e5039e389a78a1efc0fe3a7851ac06342ea231a8f58f8fc119f65abcf223d7a03fd3af399749e58daed91cb709dcb18e3d4fdba10cf89f79c81b5e4e
7
+ data.tar.gz: 69c08d5dec817a6c8105c37e59e4fa953252c78a5dad1c53ece0d072397297beb6d2ce273eeb2e4fe50c9ecfef18d634e0b361b1b33cc287376ca594745065d7
@@ -4,6 +4,9 @@ module EasyFlow
4
4
 
5
5
  layout -> { flow_host.layout }
6
6
  helper KeystoneUiHelper
7
+ helper AppRoutesHelper
8
+
9
+ before_action { AppRoutesHelper.define_app_route_helpers }
7
10
 
8
11
  rescue_from NotPublished, NotPermitted, Withdrawn, with: :refuse
9
12
 
@@ -13,10 +13,18 @@ module EasyFlow
13
13
 
14
14
  helper KeystoneUiHelper
15
15
  helper KeystoneUi::React::MountHelper
16
- helper EasyFlow::Engine.routes.url_helpers
16
+ helper AppRoutesHelper
17
+
18
+ before_action { AppRoutesHelper.define_app_route_helpers }
19
+
20
+ helper_method :flow_routes
17
21
 
18
22
  private
19
23
 
24
+ def flow_routes
25
+ @flow_routes ||= ActionDispatch::Routing::RoutesProxy.new(_routes, self, _routes.url_helpers)
26
+ end
27
+
20
28
  def refuse_a_host_not_set_up
21
29
  head :not_found unless flow_host.set_up?
22
30
  end
@@ -0,0 +1,12 @@
1
+ module EasyFlow
2
+ module AppRoutesHelper
3
+ def self.define_app_route_helpers
4
+ @app_route_helpers_defined ||= begin
5
+ (Rails.application.routes.named_routes.helper_names - EasyFlow::Engine.routes.named_routes.helper_names).each do |name|
6
+ define_method(name) { |*args, **options| main_app.public_send(name, *args, **options) }
7
+ end
8
+ true
9
+ end
10
+ end
11
+ end
12
+ end
@@ -1,11 +1,11 @@
1
1
  <%= ui_page(max_width: :lg) do %>
2
2
  <p class="mb-4">
3
- <%= link_to "← Back to the flow", manage_flow_path(@flow), class: "text-sm text-accent-600 hover:text-accent-700" %>
3
+ <%= link_to "← Back to the flow", flow_routes.manage_flow_path(@flow), class: "text-sm text-accent-600 hover:text-accent-700" %>
4
4
  </p>
5
5
 
6
- <%= ui_form_page(title: "Definition", back_url: manage_flow_path(@flow), subtitle: @flow.slug) %>
6
+ <%= ui_form_page(title: "Definition", back_url: flow_routes.manage_flow_path(@flow), subtitle: @flow.slug) %>
7
7
 
8
- <%= ui_form(action: manage_flow_definition_path(@flow), method: :patch) do %>
8
+ <%= ui_form(action: flow_routes.manage_flow_definition_path(@flow), method: :patch) do %>
9
9
  <%= ui_textarea(name: "definition", value: JSON.pretty_generate(@flow.document), rows: 30) %>
10
10
 
11
11
  <%= ui_button(label: "Save", type: :submit) %>
@@ -1,11 +1,11 @@
1
1
  <%= ui_page(max_width: :lg) do %>
2
2
  <p class="mb-4">
3
- <%= link_to "← Back to the flow", manage_flow_path(@flow), class: "text-sm text-accent-600 hover:text-accent-700" %>
3
+ <%= link_to "← Back to the flow", flow_routes.manage_flow_path(@flow), class: "text-sm text-accent-600 hover:text-accent-700" %>
4
4
  </p>
5
5
 
6
- <%= ui_form_page(title: "Edit details", back_url: manage_flow_path(@flow)) %>
6
+ <%= ui_form_page(title: "Edit details", back_url: flow_routes.manage_flow_path(@flow)) %>
7
7
 
8
- <%= ui_form(action: manage_flow_path(@flow), method: :patch) do %>
8
+ <%= ui_form(action: flow_routes.manage_flow_path(@flow), method: :patch) do %>
9
9
  <%= ui_section(title: "How this is introduced") do %>
10
10
  <label class="block text-sm font-medium mb-1">Title</label>
11
11
  <%= ui_input(name: "flow[title]", value: @flow.title) %>
@@ -6,9 +6,9 @@
6
6
  columns: [ { title: "Title" }, { slug: "Slug" }, { kind: "Kind" }, { status: "Status" } ],
7
7
  empty_message: "No flows yet."
8
8
  ) do |table| %>
9
- <% table.link(:title) { |flow| manage_flow_path(flow) } %>
9
+ <% table.link(:title) { |flow| flow_routes.manage_flow_path(flow) } %>
10
10
  <% table.actions do |flow| %>
11
- <%= ui_form(action: manage_flow_path(flow), method: :delete) do %>
11
+ <%= ui_form(action: flow_routes.manage_flow_path(flow), method: :delete) do %>
12
12
  <%= ui_button(label: "Remove", type: :submit, variant: :secondary) %>
13
13
  <% end %>
14
14
  <% end %>
@@ -19,7 +19,7 @@
19
19
  <%= ui_alert(message: @flow.errors.full_messages.to_sentence, type: :error) %>
20
20
  <% end %>
21
21
 
22
- <%= ui_form(action: manage_flows_path, method: :post) do %>
22
+ <%= ui_form(action: flow_routes.manage_flows_path, method: :post) do %>
23
23
  <label class="block text-sm font-medium mb-1">Slug</label>
24
24
  <%= ui_input(name: "flow[slug]", placeholder: "e.g. business-scorecard") %>
25
25
 
@@ -14,13 +14,13 @@
14
14
  onclick="document.dispatchEvent(new CustomEvent('easy_flow:open-flow'))"
15
15
  class="inline-flex items-center justify-center font-semibold rounded-lg border-0 cursor-pointer bg-accent-600 text-white hover:bg-accent-700 text-base px-4 py-2">This flow</button>
16
16
 
17
- <%= ui_button(label: "Try it", href: manage_flow_preview_path(@flow), variant: :secondary) %>
17
+ <%= ui_button(label: "Try it", href: flow_routes.manage_flow_preview_path(@flow), variant: :secondary) %>
18
18
 
19
- <%= ui_button(label: "All flows", href: manage_flows_path, variant: :secondary) %>
19
+ <%= ui_button(label: "All flows", href: flow_routes.manage_flows_path, variant: :secondary) %>
20
20
  </div>
21
21
  </header>
22
22
 
23
- <%= react_ui("easy_flow/flow-editor", { base: manage_flow_canvas_path(@flow), token: form_authenticity_token, initial: @canvas },
23
+ <%= react_ui("easy_flow/flow-editor", { base: flow_routes.manage_flow_canvas_path(@flow), token: form_authenticity_token, initial: @canvas },
24
24
  class: "min-h-0 flex-1",
25
25
  data: { flow_canvas: true }) %>
26
26
  </div>
@@ -1,6 +1,6 @@
1
1
  <%= ui_page(max_width: :lg) do %>
2
2
  <p class="mb-4">
3
- <%= link_to "← Back to the flow", manage_flow_path(@flow), class: "text-sm text-accent-600 hover:text-accent-700" %>
3
+ <%= link_to "← Back to the flow", flow_routes.manage_flow_path(@flow), class: "text-sm text-accent-600 hover:text-accent-700" %>
4
4
  </p>
5
5
 
6
6
  <%= ui_page_header(title: "History", subtitle: @flow.title.presence || @flow.slug) %>
@@ -30,7 +30,7 @@
30
30
 
31
31
  <% unless version == @versions.first %>
32
32
  <%= button_to "Return the flow to this version",
33
- return_manage_flow_version_path(@flow, version),
33
+ flow_routes.return_manage_flow_version_path(@flow, version),
34
34
  form: { data: { turbo: false } }, data: { return: true },
35
35
  class: "mt-3 inline-flex items-center rounded-lg border border-gray-300 bg-white px-3 py-1.5 text-sm text-gray-900 hover:bg-gray-50 cursor-pointer" %>
36
36
  <% end %>
@@ -1,3 +1,3 @@
1
1
  module EasyFlow
2
- VERSION = "0.4.1"
2
+ VERSION = "0.4.2"
3
3
  end
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.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - tylercschneider
@@ -61,6 +61,7 @@ files:
61
61
  - app/controllers/easy_flow/manage/flows_controller.rb
62
62
  - app/controllers/easy_flow/manage/previews_controller.rb
63
63
  - app/controllers/easy_flow/manage/versions_controller.rb
64
+ - app/helpers/easy_flow/app_routes_helper.rb
64
65
  - app/javascript/easy_flow/canvas.jsx
65
66
  - app/javascript/easy_flow/canvas/Canvas.jsx
66
67
  - app/javascript/easy_flow/canvas/Connector.jsx