class Trestle::Form::Fields::CollectionSelect
Attributes
collection[R]
html_options[R]
text_method[R]
value_method[R]
Public Class Methods
new(builder, template, name, collection, value_method, text_method, options={}, html_options={})
click to toggle source
Calls superclass method
Trestle::Form::Field::new
# File lib/trestle/form/fields/collection_select.rb, line 7 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
Public Instance Methods
default_html_options()
click to toggle source
# File lib/trestle/form/fields/collection_select.rb, line 18 def default_html_options Trestle::Options.new(class: ["form-control"], disabled: disabled? || readonly?, data: { enable_select2: true }) end
field()
click to toggle source
# File lib/trestle/form/fields/collection_select.rb, line 14 def field builder.raw_collection_select(name, collection, value_method, text_method, options, html_options) end