easy_flow 0.39.0 → 0.40.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: 6b149b55629914a9ccc0cb3d30f7dc4688f6a24e85131cc4706cd969e4dde44e
4
- data.tar.gz: e0f11051707fe000eb4c755e7c2f8bb3ac18bffb79addb9f5490ae318d633e84
3
+ metadata.gz: bcd7bccbce5cec4efbbda2f71ebc1069e62cc62a89625f3f372fe868bca0f485
4
+ data.tar.gz: e9c92a26b35349dc4bc9212f6e8537e438704f5c1089324ce82afefa8895f9ef
5
5
  SHA512:
6
- metadata.gz: 4872c78fe7b63df9b8b75e9eab0765001b559ecd72416eb4528b4b317d8665fb318deed214ae74871acd3036e531287f2039d690c97fc9f0ea1b4a438ede1752
7
- data.tar.gz: 99cc4153c0540f2395e0edc3e56b542a2340181a565dd70280f49c703cfe42af33fa11fa41b7e3f514f3b35a361e65382c3039f97fc4cdc165d75883f96451a0
6
+ metadata.gz: 3a1b45db59065f32ebee00c9b0b01c55d0687b4d20c8a73b2d2375e11170de5f26563975ea55859ece0e562b9c5a4790c7d85eb995a86929be93cc2f2c0e7384
7
+ data.tar.gz: 5b5aa3776d66cdb58422e439a8c28382c35bf6e5b9c4d222e8863ea0880813b9b6083e4517b9488256827752b1704bc45b690a6ab2c54eb78f4bdc5ce40bc05a
@@ -87,6 +87,7 @@ module EasyFlow
87
87
 
88
88
  live_version&.update!(status: :superseded)
89
89
  version.update!(status: :live)
90
+ EasyFlow.host_named(host).published(self)
90
91
  end
91
92
 
92
93
  def available?
@@ -3,7 +3,7 @@ module EasyFlow
3
3
  BackLink = Data.define(:label, :address)
4
4
 
5
5
  attr_reader :name, :back_link
6
- attr_writer :layout, :admin_layout, :offers, :allowed_answers, :always_show_insert_buttons, :hide_step_type_codes, :marks_ends
6
+ attr_writer :layout, :admin_layout, :offers, :allowed_answers, :always_show_insert_buttons, :hide_step_type_codes, :marks_ends, :on_publish
7
7
  attr_accessor :admin_authentication_method, :visitor_authorization_method, :refusal_method, :owner_method, :finds_flows_across_owners, :publish_note
8
8
 
9
9
  def initialize(name)
@@ -61,6 +61,10 @@ module EasyFlow
61
61
  @setting_explanations.to_h.dig(step_type.to_s, setting.to_s).presence
62
62
  end
63
63
 
64
+ def published(flow)
65
+ @on_publish&.call(flow)
66
+ end
67
+
64
68
  def offers?(step_type)
65
69
  @offers.nil? || @offers.map(&:to_s).include?(step_type.to_s)
66
70
  end
@@ -1,3 +1,3 @@
1
1
  module EasyFlow
2
- VERSION = "0.39.0"
2
+ VERSION = "0.40.0"
3
3
  end
@@ -102,6 +102,7 @@ easy_flow declares no commands of its own for this local. Its surface is split b
102
102
  - **Hidden step type codes** — a setting a host may turn on, `hide_step_type_codes`, that hides step type code names on its canvas. The add menu lists each step type by its name alone, and a step's box shows its step type's name in place of the code name, with a step that has no name of its own headed by its step type's name. It is off by default, and with it off the add menu and step boxes show the code names. The settings panel shows a step's id and code name either way.
103
103
  - **Publish note** — a setting a host may set, `publish_note`, whose sentence is shown directly under the Publish button in its flow panel. With none set, the panel shows no note.
104
104
  - **Back link** — a setting a host may set, `back_link`, holding a label and an address, or a callable that takes the flow being shown and returns them, that shows a button with that label and address in its builder header in place of `All flows`. With a callable, each flow's canvas shows the back link worked out for that flow. With none set, the header shows `All flows`.
105
+ - **On publish** — a setting a host may set, `on_publish`, holding a callable that takes a flow. easy_flow calls it each time a new version of one of that host's flows goes live, from the canvas's Publish button or from the app calling publish. Publishing a version that is already live does not call it. With none set, nothing is called.
105
106
  - **Host setting explanations** — a setting a host may set, `setting_explanations`, giving its own explanation for one setting of one step type, including a setting inside a list. It shows in place of the step type's own. A setting it gives none for shows the step type's own, and with none set nothing changes.
106
107
  - **Flow panel** — the panel the `This flow` button opens on the canvas, on every host. It shows Create version and Publish above its lists of problems and changes. Each problem is a sentence naming the step by its name, or by its step type's name when it has none, never by its id, and saying what to do to clear it. Several saves to the same step in a row show as one line in the changes list, named by the step's latest name. A save, a move and any other change each keep their own line, and the history of versions still lists every change a version captured.
107
108
  - **Picture mark** — the words `Has a picture` on the box of a step with a picture on the canvas, on every host.
@@ -63,6 +63,7 @@ A Rails engine for flows an admin draws on a canvas and a visitor runs one step
63
63
  - `marks_ends` — set to `true` to have this host's admins mark each End step as success or failure. The End step's settings then show a Mark with those two choices, and publishing one of this host's flows with an End left unmarked is refused, the refusal shown on that End's card. With none set, End steps show no mark and publish as they do. Ask the developer whether this host's runs need to say if they ended well.
64
64
  - `publish_note` — a sentence shown directly under the Publish button in this host's flow panel. It is shown as plain text. With none set, the panel shows no note.
65
65
  - `back_link` — a hash with a `label` and an `address`, such as `{ label: "Games", address: "/admin/games" }`, that shows a button with that label and address in this host's builder header in place of `All flows`. The header then has no `All flows` button. A hash missing either key raises `ArgumentError` when the host is declared, and a blank value is not refused. The address is used as written and is not checked, so it comes from the app's own configuration and never from a request. It may instead be a callable that takes the flow being shown and returns that hash, such as `->(flow) { { label: "Funnel", address: "/funnels/#{flow.owner_id}" } }`, so each flow's canvas links to a page of its own, such as its owner record's page. A returned hash missing either key raises `ArgumentError` when that flow's canvas is opened. With none set, the header shows `All flows`.
66
+ - `on_publish` — a callable that takes a flow, such as `->(flow) { RecountJob.perform_later(flow.id) }`, that easy_flow calls each time a new version of one of this host's flows goes live, whether an admin pressed Publish on the canvas or the app called `publish` on the flow. It runs inside the publish request, so slow work belongs in a job it starts. Publishing a version that is already live does not call it. With none set, nothing is called. Ask the developer what the app must do when a flow goes live.
66
67
  - `setting_explanations` — this host's own explanations for step type settings, as a hash of step type name to setting name to a sentence, such as `{ multiple_select: { category: "The round this question counts toward.", "answers.weight" => "Points this answer adds to the score." } }`. A setting inside a list is named by the list and the setting joined with a dot, and a list setting's own explanation is named by the list alone. The sentence is shown as plain text under the setting in the step's settings, in place of the step type's own. A setting with none, or with a blank one, shows the step type's own, if it has one. A step type or setting name that matches nothing is ignored. A value that is not text, such as a nested hash, raises `ArgumentError` when the host is declared. With none set, every setting shows the step type's own explanation.
67
68
 
68
69
  Each method named here must exist on the base controller. Ask the developer to point at it or write it. Do not invent its logic.
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.39.0
4
+ version: 0.40.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - tylercschneider