Method: CCS::Components::GovUK::Accordion::Section::Header#render

Defined in:
lib/ccs/components/govuk/accordion/section/header.rb

#renderActiveSupport::SafeBuffer

Generates the HTML for the GOV.UK Accordion Section Header

Returns:

  • (ActiveSupport::SafeBuffer)


44
45
46
47
48
49
50
51
# File 'lib/ccs/components/govuk/accordion/section/header.rb', line 44

def render
  tag.div(class: 'govuk-accordion__section-header') do
    concat(tag.send("h#{heading_level}", class: 'govuk-accordion__section-heading') do
      tag.span(section[:heading], class: 'govuk-accordion__section-button', id: "#{accordion_id}-heading-#{index}")
    end)
    concat(tag.div(section[:summary], class: 'govuk-accordion__section-summary govuk-body', id: "#{accordion_id}-summary-#{index}")) if section[:summary]
  end
end