Class: Plutonium::UI::Wizard::SummaryDisplay

Inherits:
Display::Base
  • Object
show all
Defined in:
lib/plutonium/ui/wizard/summary_display.rb

Overview

A tiny read-only display over the wizard's typed data snapshot, used by the review step's auto-summary (§2.5). Reuses the Plutonium display pipeline (Display::Base + its inferred-type builder + field(...).wrapped) so each field's label and value formatting match the rest of the app, rather than re-implementing value rendering.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Component::Behaviour

#around_template

Methods included from Component::Tokens

#classes, #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(object, fields:, inputs: {}, wizard: nil, **options) ⇒ SummaryDisplay

Returns a new instance of SummaryDisplay.

Parameters:

  • object (Object)

    the wizard data snapshot.

  • fields (Array<Symbol>)

    scalar field names to summarize.

  • inputs (Hash) (defaults to: {})

    the step's input config (=> {options:}), so a field's declared as: informs the display component (e.g. a :text input renders via the markdown/text display tag).



17
18
19
20
21
22
23
# File 'lib/plutonium/ui/wizard/summary_display.rb', line 17

def initialize(object, fields:, inputs: {}, wizard: nil, **options)
  options[:key] = :wizard
  @summary_fields = fields
  @summary_inputs = inputs
  @wizard = wizard
  super(object, **options)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Plutonium::UI::Component::Kit

Instance Attribute Details

#wizardPlutonium::Wizard::Base? (readonly)

The wizard driving this run. Present for the same reason the step form exposes it: an ->(form) { form.wizard… } option asks the form for it, and on the review page this component stands in for the form.

Returns:



29
30
31
# File 'lib/plutonium/ui/wizard/summary_display.rb', line 29

def wizard
  @wizard
end

Instance Method Details

#display_templateObject



31
32
33
34
35
# File 'lib/plutonium/ui/wizard/summary_display.rb', line 31

def display_template
  dl(class: "grid grid-cols-1 sm:grid-cols-2 gap-x-6 gap-y-3") do
    @summary_fields.each { |name| render_summary_field(name) }
  end
end