Module: Plutonium::Wizard::Driving

Extended by:
ActiveSupport::Concern
Includes:
StructuredInputs::ParamsConcern
Included in:
Resource::Controllers::WizardActions, Controller
Defined in:
lib/plutonium/wizard/driving.rb

Overview

Surface-agnostic runner-driving logic shared by every wizard launch surface (§6). It is mixed into:

  • Controller — the standalone portal-level register_wizard controller (non-anchored), and
  • Resource::Controllers::WizardActions — the resource-mounted member/collection actions (anchored anchor comes from the scoped, policy- gated resource_record!, exactly like interactive record actions).

Both surfaces share the per-request flow: resolve the instance (URL token / anchor + current_user owner + portal scoped_entity scope) → build the Runner → check entry authorization → GET renders the current step / POST dispatches on params[:_direction] (back / cancel / advance+finalize).

Surfaces differ only in a small set of hooks (the wizard class, the anchor, the per-step URL, completion/exit targets, and authorization), which the including controller overrides.

Constant Summary collapse

SESSION_TOKENS_KEY =

The Rails-session bucket holding per-wizard guest run ids (§4.5). A guest (anonymous) run's token lives under session[SESSION_TOKENS_KEY][wizard_key].

"plutonium_wizards"
WIZARD_RETURN_TO_KEY =

The Rails-session bucket holding the per-wizard "return to" path captured at launch — the page the user came from. Cancel redirects there instead of the host root. Namespaced per wizard so two in-flight wizards don't clobber each other.

"plutonium_wizard_return_to"

Class Method Summary collapse

Methods included from StructuredInputs::ParamsConcern

#clean_structured_inputs

Class Method Details

.session_token_key(wizard_class) ⇒ Object

The per-wizard key under SESSION_TOKENS_KEY for a guest run's token.



37
38
39
# File 'lib/plutonium/wizard/driving.rb', line 37

def self.session_token_key(wizard_class)
  wizard_class.name.underscore.tr("/", "_")
end