Class: CCS::Components::GovUK::SummaryList::Row
- Defined in:
- lib/ccs/components/govuk/summary_list/row.rb,
lib/ccs/components/govuk/summary_list/row/key.rb,
lib/ccs/components/govuk/summary_list/row/value.rb,
lib/ccs/components/govuk/summary_list/row/actions.rb
Overview
GOV.UK Summary list row
Generates the HTML for a summary list row
Defined Under Namespace
Constant Summary collapse
- DEFAULT_ATTRIBUTES =
The default attributes for the summary list row
{ class: 'govuk-summary-list__row' }.freeze
Instance Method Summary collapse
-
#initialize(any_row_has_actions:, key:, value:, actions: nil, card_title: nil, **options) ⇒ Row
constructor
A new instance of Row.
-
#render ⇒ ActiveSupport::SafeBuffer
Generates the HTML for the GOV.UK Summary list row.
Constructor Details
#initialize(any_row_has_actions:, key:, value:, actions: nil, card_title: nil, **options) ⇒ Row
Returns a new instance of Row.
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 |
Instance Method Details
#render ⇒ ActiveSupport::SafeBuffer
Generates the HTML for the GOV.UK Summary list row
57 58 59 60 61 62 63 |
# File 'lib/ccs/components/govuk/summary_list/row.rb', line 57 def render tag.div(class: [:attributes][:class]) do concat(key.render) concat(value.render) concat(actions.render) if actions end end |