Sha256: 020f4d20bc14f54190ae3702d6a6a93ffc726b64d4bf25efb85d79ce21e72736
Contents?: true
Size: 744 Bytes
Versions: 17
Compression:
Stored size: 744 Bytes
Contents
module GOVUKDesignSystemFormBuilder module Containers class FormGroup < Base def initialize(builder, object_name, attribute_name, classes: nil, **kwargs) super(builder, object_name, attribute_name) @classes = classes @html_attributes = kwargs end def html(&block) tag.div(class: classes, **@html_attributes, &block) end private def classes [form_group_class, error_class, custom_classes].flatten.compact end def form_group_class %(#{brand}-form-group) end def error_class %(#{brand}-form-group--error) if has_errors? end def custom_classes Array.wrap(@classes) end end end end
Version data entries
17 entries across 17 versions & 1 rubygems