Class: GovukComponent::SummaryListComponent
- Defined in:
- app/components/govuk_component/summary_list_component.rb
Defined Under Namespace
Classes: ActionComponent, CardComponent, KeyComponent, RowComponent, ValueComponent
Instance Attribute Summary collapse
-
#actions ⇒ Object
readonly
Returns the value of attribute actions.
-
#borders ⇒ Object
readonly
Returns the value of attribute borders.
-
#card ⇒ Object
readonly
Returns the value of attribute card.
-
#visually_hidden_action_suffix ⇒ Object
readonly
Returns the value of attribute visually_hidden_action_suffix.
Attributes inherited from Base
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(rows: nil, actions: true, borders: config.default_summary_list_borders, card: {}, visually_hidden_action_suffix: nil, classes: [], html_attributes: {}) ⇒ SummaryListComponent
constructor
A new instance of SummaryListComponent.
Methods inherited from Base
Constructor Details
#initialize(rows: nil, actions: true, borders: config.default_summary_list_borders, card: {}, visually_hidden_action_suffix: nil, classes: [], html_attributes: {}) ⇒ SummaryListComponent
Returns a new instance of SummaryListComponent.
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/components/govuk_component/summary_list_component.rb', line 15 def initialize(rows: nil, actions: true, borders: config.default_summary_list_borders, card: {}, visually_hidden_action_suffix: nil, classes: [], html_attributes: {}) @borders = borders @show_actions_column = actions @card = GovukComponent::SummaryListComponent::CardComponent.new(**card) if card.present? @visually_hidden_action_suffix = visually_hidden_action_suffix super(classes:, html_attributes:) return unless rows.presence build(rows) end |
Instance Attribute Details
#actions ⇒ Object (readonly)
Returns the value of attribute actions.
3 4 5 |
# File 'app/components/govuk_component/summary_list_component.rb', line 3 def actions @actions end |
#borders ⇒ Object (readonly)
Returns the value of attribute borders.
3 4 5 |
# File 'app/components/govuk_component/summary_list_component.rb', line 3 def borders @borders end |
#card ⇒ Object (readonly)
Returns the value of attribute card.
3 4 5 |
# File 'app/components/govuk_component/summary_list_component.rb', line 3 def card @card end |
#visually_hidden_action_suffix ⇒ Object (readonly)
Returns the value of attribute visually_hidden_action_suffix.
3 4 5 |
# File 'app/components/govuk_component/summary_list_component.rb', line 3 def visually_hidden_action_suffix @visually_hidden_action_suffix end |
Instance Method Details
#call ⇒ Object
28 29 30 31 32 |
# File 'app/components/govuk_component/summary_list_component.rb', line 28 def call summary_list = tag.dl(**html_attributes) { safe_join(rows) } (card?) ? card_with(summary_list) : summary_list end |