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 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: {}, **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
# File 'lib/plutonium/ui/wizard/summary_display.rb', line 17

def initialize(object, fields:, inputs: {}, **options)
  options[:key] = :wizard
  @summary_fields = fields
  @summary_inputs = inputs
  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 Method Details

#display_templateObject



24
25
26
27
28
# File 'lib/plutonium/ui/wizard/summary_display.rb', line 24

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