Module: PluggableJs::Helpers::View

Includes:
Shared
Defined in:
lib/pluggable_js/helpers.rb

Instance Method Summary collapse

Methods included from Shared

#pluggable_js

Instance Method Details

#javascript_pluggable_tagObject



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/pluggable_js/helpers.rb', line 14

def javascript_pluggable_tag
  controller = params[:controller]
  action = define_pair_action

  javascript_tag(
    "(function() {
      var pluggableFunction = window['#{controller}##{action}'];
      if (typeof(pluggableFunction) === 'function') { pluggableFunction(#{@pluggable_js_data}); }
    }).call();"
  )
end