Class: Ckeditor::TextArea

Inherits:
Object
  • Object
show all
Includes:
ActionView::Helpers::FormTagHelper, ActionView::Helpers::JavaScriptHelper, ActionView::Helpers::TagHelper
Defined in:
lib/ckeditor/text_area.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(template, options) ⇒ TextArea

Returns a new instance of TextArea.



13
14
15
16
17
18
# File 'lib/ckeditor/text_area.rb', line 13

def initialize(template, options)
  @template = template
  @options = options.stringify_keys
  @ck_options = (@options.delete('ckeditor') || {}).stringify_keys
  @ck_options['customConfig'] ||= Ckeditor.js_config_url if Ckeditor.cdn_enabled?
end

Instance Attribute Details

#ck_optionsObject (readonly)

Returns the value of attribute ck_options.



11
12
13
# File 'lib/ckeditor/text_area.rb', line 11

def ck_options
  @ck_options
end

#optionsObject (readonly)

Returns the value of attribute options.



11
12
13
# File 'lib/ckeditor/text_area.rb', line 11

def options
  @options
end

#templateObject (readonly)

Returns the value of attribute template.



11
12
13
# File 'lib/ckeditor/text_area.rb', line 11

def template
  @template
end

Instance Method Details

#render_instance_tag(object_name, method) ⇒ Object



20
21
22
23
24
25
# File 'lib/ckeditor/text_area.rb', line 20

def render_instance_tag(object_name, method)
  tag = build_tag(object_name, method)
  tag.send(:add_default_name_and_id, options) if options['id'].blank?

  render tag.respond_to?(:to_text_area_tag) ? tag.to_text_area_tag(options) : tag.render
end

#render_tag(name, content) ⇒ Object



27
28
29
30
31
# File 'lib/ckeditor/text_area.rb', line 27

def render_tag(name, content)
  options['id'] = sanitize_to_id(options['id'] || name)

  render text_area_tag(name, content, options)
end