Module: ActiveScaffold::Bridges::Chosen::Helpers::FormColumnHelpers
- Defined in:
- lib/active_scaffold/bridges/chosen/helpers.rb
Instance Method Summary collapse
-
#active_scaffold_input_chosen(column, html_options, ui_options: column.options) ⇒ Object
requires RecordSelect plugin to be installed and configured.
Instance Method Details
#active_scaffold_input_chosen(column, html_options, ui_options: column.options) ⇒ Object
requires RecordSelect plugin to be installed and configured.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/active_scaffold/bridges/chosen/helpers.rb', line 16 def active_scaffold_input_chosen(column, , ui_options: column.) [:class] << ' chosen' if column.association&.collection? record = .delete(:object) , = (column, record) = {selected: .collect(&:id), include_blank: as_(:_select_), object: record} .update(multiple: true).update([:html_options] || {}) .update() active_scaffold_select_name_with_multiple html = if (optgroup = .delete(:optgroup)) select(:record, column.name, (column, , optgroup), , ) else collection_select(:record, column.name, , :id, [:label_method] || :to_label, , ) end if [:add_new] html = content_tag(:div, html, class: 'select-field') << active_scaffold_add_new(column, record, , ui_options: ) end html else active_scaffold_input_select(column, , ui_options: ) end end |