Module: CCS::FrontendHelpers::GovUKFrontend::FormGroup
- Included in:
- CCS::FrontendHelpers::GovUKFrontend
- Defined in:
- lib/ccs/frontend_helpers/govuk_frontend/form_group.rb
Overview
GOV.UK FormGroup
This helper is used for generating the form group component from the Government Design Systems
Instance Method Summary collapse
-
#govuk_form_group(attribute, **options) {|displayed_error_message| ... } ⇒ ActiveSupport::SafeBuffer
Generates the HTML for the GOV.UK Warning text component.
Instance Method Details
#govuk_form_group(attribute, **options) {|displayed_error_message| ... } ⇒ ActiveSupport::SafeBuffer
Generates the HTML for the GOV.UK Warning text component
27 28 29 30 31 32 33 34 35 |
# File 'lib/ccs/frontend_helpers/govuk_frontend/form_group.rb', line 27 def govuk_form_group(attribute, **, &) = if [:model] [:model].errors[attribute].first else [:error_message] end Components::GovUK::FormGroup.new(context: self, attribute: attribute, error_message: , **).render(&) end |