Class: Plutonium::UI::Form::Wizard
- Defined in:
- lib/plutonium/ui/form/wizard.rb
Overview
Renders the CURRENT wizard step through the existing resource-form pipeline
(§7). It rides Form::Resource unchanged — the only wizard-specific wiring
is the per-step adapter (resource_definition), the value source (the
wizard's typed data, so inputs render seeded from staged data for
resume/back, including repeater rows), the wizard[...] param namespace,
the step POST URL, and a hidden _direction (default next).
Constant Summary
Constants included from Concerns::RendersNestedResourceFields
Concerns::RendersNestedResourceFields::DEFAULT_NESTED_LIMIT, Concerns::RendersNestedResourceFields::NESTED_OPTION_KEYS, Concerns::RendersNestedResourceFields::SINGULAR_MACROS
Instance Attribute Summary collapse
-
#wizard ⇒ Plutonium::Wizard::Base
readonly
The run being rendered.
Attributes inherited from Resource
#resource_definition, #resource_fields, #singular_resource
Instance Method Summary collapse
-
#initialize(step:, data:, action:, fields:, wizard:, **options) ⇒ Wizard
constructor
A new instance of Wizard.
Methods inherited from Resource
Methods included from Component::Behaviour
Methods included from Component::Tokens
Methods included from Component::Kit
#BuildActionButton, #BuildActionsDropdown, #BuildAvatar, #BuildBlock, #BuildBreadcrumbs, #BuildBulkActionsToolbar, #BuildColorModeSelector, #BuildDynaFrameContent, #BuildDynaFrameHost, #BuildEmptyCard, #BuildFrameNavigatorPanel, #BuildModalCentered, #BuildModalSlideover, #BuildPageHeader, #BuildPanel, #BuildRowActionsDropdown, #BuildSkeletonTable, #BuildTabList, #BuildTableFilterPills, #BuildTableInfo, #BuildTablePagination, #BuildTableScopesBar, #BuildTableScopesPills, #BuildTableSearchBar, #BuildTableToolbar, #BuildTableViewSwitcher, #method_missing, #respond_to_missing?
Constructor Details
#initialize(step:, data:, action:, fields:, wizard:, **options) ⇒ Wizard
Returns a new instance of Wizard.
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/plutonium/ui/form/wizard.rb', line 23 def initialize(step:, data:, action:, fields:, wizard:, **, &) @step = step @wizard = wizard [:key] = :wizard [:as] = :wizard [:action] = action [:resource_fields] = fields [:resource_definition] = Plutonium::Wizard::StepAdapter.new(step) [:singular_resource] = true super(data, **, &) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Plutonium::UI::Component::Kit
Instance Attribute Details
#wizard ⇒ Plutonium::Wizard::Base (readonly)
The run being rendered. Public because a step's proc-valued option is how an option depends on the run, and reaching the run is the whole point:
input :tier, as: :select,
choices: ->(form) { form.wizard.anchor.available_tiers }
Deliberately NOT reached by rebinding a zero-arity proc to the wizard.
A step block is instance_exec'd against a FieldCapture at class load,
so its closure holds nothing useful — but that is equally true of a
form_layout block and its Builder, and the answer there is to ask for
the receiver rather than have it swapped in silently. Same answer here:
-> { … } means what it reads like wherever it is written, and an
input line moved between a definition and a step keeps its meaning.
form.object, alongside this, is the step's staged data.
52 53 54 |
# File 'lib/plutonium/ui/form/wizard.rb', line 52 def wizard @wizard end |