Class: Inputs::EffectiveSelect::Input

Inherits:
Effective::FormInput show all
Defined in:
app/models/inputs/effective_select/input.rb

Instance Method Summary collapse

Methods inherited from Effective::FormInput

#field_name, #initialize, #value

Constructor Details

This class inherits a constructor from Effective::FormInput

Instance Method Details

#default_input_classes ⇒ Object



10
11
12
# File 'app/models/inputs/effective_select/input.rb', line 10

def default_input_classes
  [:effective_select]
end

#default_input_js_options ⇒ Object



6
7
8
# File 'app/models/inputs/effective_select/input.rb', line 6

def default_input_js_options
  {:theme => 'bootstrap', :minimumResultsForSearch => 6, :tokenSeparators => [',', ' '], :width => 'style'}
end

#options ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'app/models/inputs/effective_select/input.rb', line 18

def options
  super do |options|
    options[:multiple] = true if options[:tags]

    # If multiple...
    options['data-input-js-options'][:allowClear] = (!options[:multiple])
    options[:include_blank] = false if options[:multiple]
  end
end

#to_html ⇒ Object



14
15
16
# File 'app/models/inputs/effective_select/input.rb', line 14

def to_html
  collection_select(@object_name, @method, options.delete(:collection), options.delete(:label_method), options.delete(:value_method), options.merge({:selected => value}), options)
end