Method: CCS::Components::GovUK::SummaryList::Row#initialize

Defined in:
lib/ccs/components/govuk/summary_list/row.rb

#initialize(any_row_has_actions:, key:, value:, actions: nil, card_title: nil) ⇒ Row

Returns a new instance of Row.

Parameters:

  • any_row_has_actions (Boolean)

    flag to indicate if any rows have actions

  • key (Hash)

    attributes for the key, see Key#initialize for more details.

  • value (Hash)

    attributes for the value, see Value#initialize for more details.

  • actions (Hash) (defaults to: nil)

    attributes for the actions, see Actions#initialize for more details.

  • card_title (String) (defaults to: nil)

    the text for the card title

  • options (Hash)

    options that will be used in customising the HTML



39
40
41
42
43
44
45
46
47
48
49
# File 'lib/ccs/components/govuk/summary_list/row.rb', line 39

def initialize(any_row_has_actions:, key:, value:, actions: nil, card_title: nil, **)
  super(**)

  actions_present = actions && actions[:items].present?

  @options[:attributes][:class] << ' govuk-summary-list__row--no-actions' if any_row_has_actions && !actions_present

  @key = Key.new(context: @context, **key)
  @value = Value.new(context: @context, **value)
  @actions = Actions.new(context: @context, card_title: card_title, **actions) if actions_present
end