Sha256: bc65e6869637286cdafd22baa68b1e5f0f2bf62a6bced6ff94846de74030c40d
Contents?: true
Size: 926 Bytes
Versions: 5
Compression:
Stored size: 926 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-control"], disabled: disabled? || readonly?, data: { enable_select2: true }) end end end end end Trestle::Form::Builder.register(:collection_select, Trestle::Form::Fields::CollectionSelect)
Version data entries
5 entries across 5 versions & 1 rubygems