Class: Wysihtml5Input

Inherits:
SimpleForm::Inputs::TextInput
  • Object
show all
Defined in:
lib/bootstrap-wysihtml5-rails/simple_form/wysihtml5_input.rb

Instance Method Summary collapse

Instance Method Details

#input(wrapper_options) ⇒ Object



2
3
4
5
6
7
8
9
# File 'lib/bootstrap-wysihtml5-rails/simple_form/wysihtml5_input.rb', line 2

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

  super + script
end