Class: CCS::Components::GovUK::ErrorSummary::Item
- Defined in:
- lib/ccs/components/govuk/error_summary/item.rb
Overview
GOV.UK Error Summary Item
The individual list item for the error summary
Constant Summary
Constants inherited from Base
Instance Method Summary collapse
-
#initialize(text:, href: nil, **options) ⇒ Item
constructor
A new instance of Item.
-
#render ⇒ ActiveSupport::SafeBuffer
Generates the HTML for the GOV.UK Error Summary Item.
Constructor Details
#initialize(text:, href: nil, **options) ⇒ Item
Returns a new instance of Item.
30 31 32 33 34 35 |
# File 'lib/ccs/components/govuk/error_summary/item.rb', line 30 def initialize(text:, href: nil, **) super(**) @text = text @href = href end |
Instance Method Details
#render ⇒ ActiveSupport::SafeBuffer
Generates the HTML for the GOV.UK Error Summary Item
41 42 43 44 45 46 47 48 49 |
# File 'lib/ccs/components/govuk/error_summary/item.rb', line 41 def render tag.li do if href link_to(text, href, **[:attributes]) else text end end end |