Module: ActiveScaffold::TinyMceBridge::ViewHelpers

Defined in:
lib/active_scaffold/bridges/tiny_mce/lib/tiny_mce_bridge.rb

Instance Method Summary collapse

Instance Method Details

#active_scaffold_includes(*args) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/active_scaffold/bridges/tiny_mce/lib/tiny_mce_bridge.rb', line 4

def active_scaffold_includes(*args)
  if ActiveScaffold.js_framework == :jquery
    tiny_mce_js = javascript_tag(%|
var action_link_close = ActiveScaffold.ActionLink.Abstract.prototype.close;
ActiveScaffold.ActionLink.Abstract.prototype.close = function() {
  $(this.adapter).find('textarea.mceEditor').each(function(index, elem) {
    tinyMCE.execCommand('mceRemoveControl', false, $(elem).attr('id'));
  });
  action_link_close.apply(this);
};
    |) if using_tiny_mce?
  else
    tiny_mce_js = javascript_tag(%|
var action_link_close = ActiveScaffold.ActionLink.Abstract.prototype.close;
ActiveScaffold.ActionLink.Abstract.prototype.close = function() {
  this.adapter.select('textarea.mceEditor').each(function(elem) {
    tinyMCE.execCommand('mceRemoveControl', false, elem.id);
  });
  action_link_close.apply(this);
};
    |) if using_tiny_mce?
  end
  super(*args) + (include_tiny_mce_if_needed || '') + (tiny_mce_js || '')
end