Class: ColorpickerInput

Inherits:
SimpleForm::Inputs::StringInput
  • Object
show all
Defined in:
lib/bootstrap_colorpicker_rails/simple_form/colorpicker_input.rb

Instance Method Summary collapse

Instance Method Details

#input(wrapper_options) ⇒ Object



2
3
4
5
6
7
8
9
# File 'lib/bootstrap_colorpicker_rails/simple_form/colorpicker_input.rb', line 2

def input(wrapper_options)
  idf = "#{lookup_model_names.join("_")}_#{reflection_or_attribute_name}"
  script = template.(:script, type: 'text/javascript') do
    "$('input[id=#{idf}]').colorpicker();".html_safe
  end

  super + script
end

#input_typeObject



11
12
13
# File 'lib/bootstrap_colorpicker_rails/simple_form/colorpicker_input.rb', line 11

def input_type
  :string
end