class Trestle::Form::Fields::GroupedCollectionSelect
Attributes
collection[R]
group_label_method[R]
group_method[R]
html_options[R]
option_key_method[R]
option_value_method[R]
Public Class Methods
new(builder, template, name, collection, group_method, group_label_method, option_key_method, option_value_method, options={}, html_options={})
click to toggle source
Calls superclass method
Trestle::Form::Field::new
# File lib/trestle/form/fields/grouped_collection_select.rb, line 7 def initialize(builder, template, name, collection, group_method, group_label_method, option_key_method, option_value_method, options={}, html_options={}) super(builder, template, name, options) @collection, @group_method, @group_label_method, @option_key_method, @option_value_method = collection, group_method, group_label_method, option_key_method, option_value_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/grouped_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/grouped_collection_select.rb, line 14 def field builder.raw_grouped_collection_select(name, collection, group_method, group_label_method, option_key_method, option_value_method, options, html_options) end