Class: CCS::Components::GovUK::StepByStepNavigation::Section::Content::List
- Inherits:
-
Object
- Object
- CCS::Components::GovUK::StepByStepNavigation::Section::Content::List
- Includes:
- ActionView::Context, ActionView::Helpers
- Defined in:
- 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
Overview
GOV.UK Step by step navigation section content list
Generates the list HTML for the step by step navigation section content
Defined Under Namespace
Classes: Item
Instance Method Summary collapse
-
#initialize(items:) ⇒ List
constructor
A new instance of List.
-
#render ⇒ ActiveSupport::SafeBuffer
Generates the HTML for the GOV.UK Step by step navigation section content list.
Constructor Details
#initialize(items:) ⇒ List
Returns a new instance of List.
31 32 33 |
# File 'lib/ccs/components/govuk/step_by_step_navigation/section/content/list.rb', line 31 def initialize(items:) @items = items.map { |item| Item.new(**item) } end |
Instance Method Details
#render ⇒ ActiveSupport::SafeBuffer
Generates the HTML for the GOV.UK Step by step navigation section content list
39 40 41 42 43 |
# File 'lib/ccs/components/govuk/step_by_step_navigation/section/content/list.rb', line 39 def render tag.ul(class: 'gem-c-step-nav__list gem-c-step-nav__list--choice', data: { length: items.length.to_s }) do items.each { |item| concat(item.render) } end end |