Class: GOVUKDesignSystemFormBuilder::Elements::ErrorSummary
- Includes:
- Traits::Error, Traits::HTMLAttributes
- Defined in:
- lib/govuk_design_system_formbuilder/elements/error_summary.rb
Instance Method Summary collapse
- #html ⇒ Object
-
#initialize(builder, object_name, title, link_base_errors_to:, order:, presenter:, **kwargs, &block) ⇒ ErrorSummary
constructor
A new instance of ErrorSummary.
Methods included from Traits::HTMLAttributes
Methods included from Traits::Error
Methods inherited from Base
Constructor Details
#initialize(builder, object_name, title, link_base_errors_to:, order:, presenter:, **kwargs, &block) ⇒ ErrorSummary
Returns a new instance of ErrorSummary.
7 8 9 10 11 12 13 14 15 |
# File 'lib/govuk_design_system_formbuilder/elements/error_summary.rb', line 7 def initialize(builder, object_name, title, link_base_errors_to:, order:, presenter:, **kwargs, &block) super(builder, object_name, nil, &block) @title = title @link_base_errors_to = link_base_errors_to @html_attributes = kwargs @order = order @presenter = presenter end |
Instance Method Details
#html ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/govuk_design_system_formbuilder/elements/error_summary.rb', line 17 def html return unless object_has_errors? tag.div(**attributes(@html_attributes)) do tag.div(role: "alert") do safe_join([title, summary]) end end end |