Sha256: ab2e273ab23102f997f25c9cd6d05db03254d0a16c1aa4e3dfe59b30a907648c
Contents?: true
Size: 860 Bytes
Versions: 3
Compression:
Stored size: 860 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"]) end end end end end Trestle::Form::Builder.register(:collection_select, Trestle::Form::Fields::CollectionSelect)
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
trestle-0.8.3 | lib/trestle/form/fields/collection_select.rb |
trestle-0.8.2 | lib/trestle/form/fields/collection_select.rb |
trestle-0.8.0 | lib/trestle/form/fields/collection_select.rb |