Class: GovukComponent::SummaryListComponent
- Defined in:
- app/components/govuk_component/summary_list_component.rb
Defined Under Namespace
Classes: ActionComponent, KeyComponent, RowComponent, ValueComponent
Instance Attribute Summary collapse
-
#borders ⇒ Object
readonly
Returns the value of attribute borders.
Attributes inherited from Base
Attributes included from Traits::CustomHtmlAttributes
Instance Method Summary collapse
- #any_row_has_actions? ⇒ Boolean
- #classes ⇒ Object
-
#initialize(borders: true, classes: [], html_attributes: {}) ⇒ SummaryListComponent
constructor
A new instance of SummaryListComponent.
Methods included from Govuk::Components::Helpers::CssUtilities
Constructor Details
#initialize(borders: true, classes: [], html_attributes: {}) ⇒ SummaryListComponent
Returns a new instance of SummaryListComponent.
6 7 8 9 10 |
# File 'app/components/govuk_component/summary_list_component.rb', line 6 def initialize(borders: true, classes: [], html_attributes: {}) super(classes: classes, html_attributes: html_attributes) @borders = borders end |
Instance Attribute Details
#borders ⇒ Object (readonly)
Returns the value of attribute borders.
2 3 4 |
# File 'app/components/govuk_component/summary_list_component.rb', line 2 def borders @borders end |
Instance Method Details
#any_row_has_actions? ⇒ Boolean
12 13 14 |
# File 'app/components/govuk_component/summary_list_component.rb', line 12 def any_row_has_actions? rows.any? { |row| row.href.present? } end |
#classes ⇒ Object
16 17 18 |
# File 'app/components/govuk_component/summary_list_component.rb', line 16 def classes super.append(borders_class).compact end |