Module: TinyMCE::Base::ClassMethods
- Defined in:
- lib/tiny_mce/base.rb
Instance Method Summary collapse
-
#uses_tiny_mce(options = {}) ⇒ Object
The controller declaration to enable tiny_mce on certain actions.
Instance Method Details
#uses_tiny_mce(options = {}) ⇒ Object
The controller declaration to enable tiny_mce on certain actions. Takes options hash, raw_options string, and any normal params you can send to a before_filter (only, except etc)
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/tiny_mce/base.rb', line 13 def uses_tiny_mce( = {}) = .delete(:options) || {} = .delete(:raw_options) || '' # If the tiny_mce plugins includes the spellchecker, then form a spellchecking path, # add it to the tiny_mce_options, and include the SpellChecking module if ![:plugins].blank? && [:plugins].include?('spellchecker') .reverse_merge!(:spellchecker_rpc_url => "/" + self.controller_name + "/spellchecker") self.class_eval do include TinyMCE::SpellChecker end end # Set instance vars in the current class proc = Proc.new do |c| c.instance_variable_set(:@tiny_mce_options, ) c.instance_variable_set(:@raw_tiny_mce_options, ) c.instance_variable_set(:@uses_tiny_mce, true) end # Run the above proc before each page load this method is declared in before_filter(proc, ) end |