Class: CCS::Components::GovUK::Details
- Defined in:
- lib/ccs/components/govuk/details.rb
Overview
GOV.UK Details
This is used to generate the details component from the GDS - Components - Details
Constant Summary collapse
- DEFAULT_ATTRIBUTES =
The default attributes for the details
{ class: 'govuk-details' }.freeze
Instance Method Summary collapse
-
#initialize(summary_text:, **options) ⇒ Details
constructor
A new instance of Details.
-
#render { ... } ⇒ ActiveSupport::SafeBuffer
Generates the HTML for the GOV.UK Details component.
Constructor Details
#initialize(summary_text:, **options) ⇒ Details
Returns a new instance of Details.
27 28 29 30 31 |
# File 'lib/ccs/components/govuk/details.rb', line 27 def initialize(summary_text:, **) super(**) @summary_text = summary_text end |
Instance Method Details
#render { ... } ⇒ ActiveSupport::SafeBuffer
Generates the HTML for the GOV.UK Details component
40 41 42 43 44 45 |
# File 'lib/ccs/components/govuk/details.rb', line 40 def render(&block) tag.details(**[:attributes]) do concat(tag.summary(tag.span(summary_text, class: 'govuk-details__summary-text'), class: 'govuk-details__summary')) concat(tag.div(class: 'govuk-details__text', &block)) end end |