Module: ActiveScaffold::Bridges::TinyMce::Helpers::FormColumnHelpers
- Defined in:
- lib/active_scaffold/bridges/tiny_mce/helpers.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#active_scaffold_input_text_editor(column, options) ⇒ Object
(also: #active_scaffold_input_tinymce)
The two column options that can be set specifically for the text_editor input is :tinymce, which overrides single values in the tinymce config.
- #onsubmit_with_tiny_mce ⇒ Object
Class Method Details
.included(base) ⇒ Object
11 12 13 |
# File 'lib/active_scaffold/bridges/tiny_mce/helpers.rb', line 11 def self.included(base) base.alias_method_chain :onsubmit, :tiny_mce end |
Instance Method Details
#active_scaffold_input_text_editor(column, options) ⇒ Object Also known as: active_scaffold_input_tinymce
The two column options that can be set specifically for the text_editor input is :tinymce, which overrides single values in the tinymce config. E.g. column.options = ‘other’ will change the theme but not the plugins, toolbars etc. The other one is :tinymce_config, which selects the config to use from tinymce.yml. See the tinymce-rails gem documentation for usage.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/active_scaffold/bridges/tiny_mce/helpers.rb', line 21 def active_scaffold_input_text_editor(column, ) [:class] = "#{[:class]} mceEditor #{column.[:class]}".strip settings = tinymce_configuration(column.[:tinymce_config] || :default).. reject{|k,v| k =='selector'}. merge(column.[:tinymce] || {}) settings = settings.to_json settings = "tinyMCE.settings = #{settings};" html = [] html << send(override_input(:textarea), column, ) html << javascript_tag(settings + "tinyMCE.execCommand('mceAddEditor', false, '#{[:id]}');") if request.xhr? || params[:iframe] html.join "\n" end |
#onsubmit_with_tiny_mce ⇒ Object
36 37 38 39 40 41 42 43 44 |
# File 'lib/active_scaffold/bridges/tiny_mce/helpers.rb', line 36 def onsubmit_with_tiny_mce case ActiveScaffold.js_framework when :jquery submit_js = 'tinyMCE.triggerSave();jQuery(\'textarea.mceEditor\').each(function(index, elem) { tinyMCE.execCommand(\'mceRemoveEditor\', false, jQuery(elem).attr(\'id\')); });' when :prototype submit_js = 'tinyMCE.triggerSave();this.select(\'textarea.mceEditor\').each(function(elem) { tinyMCE.execCommand(\'mceRemoveEditor\', false, elem.id); });' end [onsubmit_without_tiny_mce, submit_js].compact.join ';' end |