Class: CCS::Components::GovUK::Accordion::Section::Content
- Inherits:
-
Object
- Object
- CCS::Components::GovUK::Accordion::Section::Content
- Includes:
- ActionView::Context, ActionView::Helpers
- Defined in:
- lib/ccs/components/govuk/accordion/section/content.rb
Overview
GOV.UK Accordion Section Content
The individual accordion section content
Instance Method Summary collapse
-
#initialize(section:, accordion_id:, index:) ⇒ Content
constructor
A new instance of Content.
-
#render ⇒ ActiveSupport::SafeBuffer
Generates the HTML for the GOV.UK Accordion Section Content.
Constructor Details
#initialize(section:, accordion_id:, index:) ⇒ Content
Returns a new instance of Content.
33 34 35 36 37 |
# File 'lib/ccs/components/govuk/accordion/section/content.rb', line 33 def initialize(section:, accordion_id:, index:) @section = section @accordion_id = accordion_id @index = index end |
Instance Method Details
#render ⇒ ActiveSupport::SafeBuffer
Generates the HTML for the GOV.UK Accordion Section Content
43 44 45 46 47 |
# File 'lib/ccs/components/govuk/accordion/section/content.rb', line 43 def render tag.div(class: 'govuk-accordion__section-content', id: "#{accordion_id}-content-#{index}") do section[:content] || tag.p(section[:text], class: 'govuk-body') end end |