Class: NewCkeditor::Editor
- Inherits:
-
Object
- Object
- NewCkeditor::Editor
- Includes:
- ActionView::Helpers::FormTagHelper, ActionView::Helpers::JavaScriptHelper, ActionView::Helpers::TagHelper
- Defined in:
- lib/new_ckeditor/editor.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#template ⇒ Object
readonly
Returns the value of attribute template.
Instance Method Summary collapse
-
#initialize(template, options) ⇒ Editor
constructor
A new instance of Editor.
- #render_instance_tag(object_name, method) ⇒ Object
- #render_tag(name, content) ⇒ Object
Constructor Details
#initialize(template, options) ⇒ Editor
Returns a new instance of Editor.
14 15 16 17 18 |
# File 'lib/new_ckeditor/editor.rb', line 14 def initialize(template, ) @template = template .delete(:required) # to avoid bug of validating empty textarea @options = .deep_stringify_keys! end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
12 13 14 |
# File 'lib/new_ckeditor/editor.rb', line 12 def @options end |
#template ⇒ Object (readonly)
Returns the value of attribute template.
12 13 14 |
# File 'lib/new_ckeditor/editor.rb', line 12 def template @template end |
Instance Method Details
#render_instance_tag(object_name, method) ⇒ Object
20 21 22 23 24 |
# File 'lib/new_ckeditor/editor.rb', line 20 def render_instance_tag(object_name, method) tag = build_instance_tag(object_name, method) tag.send(:add_default_name_and_id, ) if ['id'].blank? render(tag.respond_to?(:to_text_area_tag) ? tag.to_text_area_tag() : tag.render, ) end |
#render_tag(name, content) ⇒ Object
26 27 28 29 30 |
# File 'lib/new_ckeditor/editor.rb', line 26 def render_tag(name, content) ['id'] = sanitize_to_id(['id'] || name) tag = build_tag(name, content, ) render(tag, ) end |