module ActiveScaffold::Bridges::TinyMce::Helpers::FormColumnHelpers

Public Instance Methods

active_scaffold_input_text_editor(column, options) click to toggle source
# File lib/active_scaffold/bridges/tiny_mce/helpers.rb, line 15
def active_scaffold_input_text_editor(column, options)
  options[:class] = "#{options[:class]} mceEditor #{column.options[:class]}".strip
                          
                          settings = { :theme => 'simple' }.merge(column.options[:tinymce] || {})
                          settings = settings.to_s.gsub(%r:(.+?)\=\>/, '\1:')
                          settings = "tinyMCE.settings = #{settings};"

  html = []
  html << send(override_input(:textarea), column, options)
  html << javascript_tag(settings + "tinyMCE.execCommand('mceAddControl', false, '#{options[:id]}');") if request.xhr? || params[:iframe]
  html.join "\n"
end
onsubmit_with_tiny_mce() click to toggle source
# File lib/active_scaffold/bridges/tiny_mce/helpers.rb, line 28
def onsubmit_with_tiny_mce
  if ActiveScaffold.js_framework == :jquery
    submit_js = 'tinyMCE.triggerSave();$(\textarea.mceEditor\).each(function(index, elem) { tinyMCE.execCommand(\mceRemoveControl\, false, $(elem).attr(\id\)); });'
  else
    submit_js = 'tinyMCE.triggerSave();this.select(\textarea.mceEditor\).each(function(elem) { tinyMCE.execCommand(\mceRemoveControl\, false, elem.id); });'
  end
  [onsubmit_without_tiny_mce, submit_js].compact.join ';'
end

Public Class Methods

included(base) click to toggle source
# File lib/active_scaffold/bridges/tiny_mce/helpers.rb, line 11
def self.included(base)
  base.alias_method_chain :onsubmit, :tiny_mce
end