Class: CCS::Components::GovUK::SummaryList::Row::Actions
- Defined in:
- lib/ccs/components/govuk/summary_list/row/actions.rb
Overview
GOV.UK Summary list row actions
Constant Summary collapse
- DEFAULT_ATTRIBUTES =
The default attributes for the summary list row actions
{ class: 'govuk-summary-list__actions' }.freeze
Instance Method Summary collapse
-
#initialize(items:, card_title: nil, **options) ⇒ Actions
constructor
A new instance of Actions.
-
#render ⇒ ActiveSupport::SafeBuffer
Generates the HTML for the GOV.UK Summary list row actions.
Constructor Details
#initialize(items:, card_title: nil, **options) ⇒ Actions
Returns a new instance of Actions.
28 29 30 31 32 |
# File 'lib/ccs/components/govuk/summary_list/row/actions.rb', line 28 def initialize(items:, card_title: nil, **) super(**) @action_links = items.map { |item| Action::Link.new(card_title: card_title, context: @context, **item) } end |
Instance Method Details
#render ⇒ ActiveSupport::SafeBuffer
Generates the HTML for the GOV.UK Summary list row actions
38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/ccs/components/govuk/summary_list/row/actions.rb', line 38 def render tag.dd(class: @options[:attributes][:class]) do if action_links.length == 1 action_links.first.render else tag.ul(class: 'govuk-summary-list__actions-list') do action_links.each do |action_link| concat(tag.li(action_link.render, class: 'govuk-summary-list__actions-list-item')) end end end end end |