Class: ActionView::Helpers::InstanceTag
- Inherits:
-
Object
- Object
- ActionView::Helpers::InstanceTag
- Defined in:
- lib/wysihat-engine.rb
Overview
:nodoc:
Instance Method Summary collapse
Instance Method Details
#to_wysihat_editor_tag(options = {}) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/wysihat-engine.rb', line 12 def to_wysihat_editor_tag( = {}) = DEFAULT_TEXT_AREA_OPTIONS.merge(.stringify_keys) add_default_name_and_id() size = .delete("size") ["cols"], ["rows"] = size.split("x") if size && size.respond_to?(:split) if ['buttons'] == nil || ['buttons'] == :all = [:bold, :italic, :underline, :strikethrough, :justify_left, :justify_center, :justify_right, :insert_ordered_list, :insert_unordered_list, :undo, :redo, :link, :html, :image] else = ['buttons'] end javascript = "Event.observe(window, 'load', function() {" << "wysiHatify('#{tag_id}', ['#{.join('\', \'')}']);" << "});" content_tag(:script, javascript, :type => 'text/javascript') << content_tag(:textarea, html_escape(.delete('value') || value_before_type_cast(object)), .merge(:class => 'wysihat_editor')) end |