Class: CCS::Components::GovUK::StepByStepNavigation::Section
- Defined in:
- lib/ccs/components/govuk/step_by_step_navigation/section.rb,
lib/ccs/components/govuk/step_by_step_navigation/section/content.rb,
lib/ccs/components/govuk/step_by_step_navigation/section/heading.rb,
lib/ccs/components/govuk/step_by_step_navigation/section/content/list.rb,
lib/ccs/components/govuk/step_by_step_navigation/section/content/list/item.rb,
lib/ccs/components/govuk/step_by_step_navigation/section/content/paragraph.rb
Overview
GOV.UK Step by step navigation section
The individual section for the step by step navigation
Defined Under Namespace
Constant Summary
Constants inherited from Base
Instance Method Summary collapse
-
#initialize(heading:, content:, index:, context:) ⇒ Section
constructor
A new instance of Section.
-
#render ⇒ ActiveSupport::SafeBuffer
Generates the HTML for the GOV.UK Step by step navigation section.
Constructor Details
#initialize(heading:, content:, index:, context:) ⇒ Section
Returns a new instance of Section.
32 33 34 35 36 37 38 39 40 |
# File 'lib/ccs/components/govuk/step_by_step_navigation/section.rb', line 32 def initialize(heading:, content:, index:, context:) super(context: context) @options[:attributes][:class] = 'gem-c-step-nav__step js-step' @options[:attributes][:id] = heading[:text].downcase.gsub(' ', '-').gsub('(', '').gsub(')', '') @heading = Heading.new(index: index, **heading) @content = Content.new(content_items: content, index: index, id: @options[:attributes][:id]) end |
Instance Method Details
#render ⇒ ActiveSupport::SafeBuffer
Generates the HTML for the GOV.UK Step by step navigation section
46 47 48 49 50 51 |
# File 'lib/ccs/components/govuk/step_by_step_navigation/section.rb', line 46 def render tag.li(class: @options[:attributes][:class], id: @options[:attributes][:id]) do concat(heading.render) concat(content.render) end end |