Sha256: fd175d87ac15d74232c1dc3c0d47cd62d1751994a7c4bfc8d191132cf993318f
Contents?: true
Size: 925 Bytes
Versions: 4
Compression:
Stored size: 925 Bytes
Contents
module Trestle class Form module Fields class CollectionSelect < Field attr_reader :collection, :value_method, :text_method, :html_options def initialize(builder, template, name, collection, value_method, text_method, options={}, html_options={}) super(builder, template, name, options) @collection, @value_method, @text_method = collection, value_method, text_method @html_options = default_html_options.merge(html_options) end def field builder.raw_collection_select(name, collection, value_method, text_method, options, html_options) end def default_html_options Trestle::Options.new(class: ["form-select"], disabled: disabled? || readonly?, data: { controller: "select" }) end end end end end Trestle::Form::Builder.register(:collection_select, Trestle::Form::Fields::CollectionSelect)
Version data entries
4 entries across 4 versions & 1 rubygems