Sha256: e8e4570757131453fa71114d3ecdafff6c22778d2ae7763b6f0a99d7970f23db
Contents?: true
Size: 1.71 KB
Versions: 9
Compression:
Stored size: 1.71 KB
Contents
module GOVUKDesignSystemFormBuilder module Elements class CollectionSelect < Base include Traits::Error include Traits::Label include Traits::Hint include Traits::Supplemental include Traits::HTMLAttributes include Traits::Select def initialize(builder, object_name, attribute_name, collection, value_method:, text_method:, hint:, label:, caption:, form_group:, options: {}, **kwargs, &block) super(builder, object_name, attribute_name, &block) @collection = collection @value_method = value_method @text_method = text_method @options = options @label = label @caption = caption @hint = hint @form_group = form_group @html_attributes = kwargs # FIXME remove this soon, worth informing people who miss the release notes that the # args have changed though. if :html_options.in?(kwargs.keys) warn("GOVUKDesignSystemFormBuilder: html_options has been deprecated, use keyword arguments instead") end end def html Containers::FormGroup.new(*bound, **@form_group).html do safe_join([label_element, supplemental_content, hint_element, error_element, collection_select]) end end private def options { id: field_id(link_errors: true), class: classes, aria: { describedby: described_by(hint_id, error_id, supplemental_id) } } end def collection_select @builder.collection_select(@attribute_name, @collection, @value_method, @text_method, @options, **attributes(@html_attributes)) end end end end
Version data entries
9 entries across 9 versions & 1 rubygems