Sha256: dd9da946929f097af025c004e1b9c4b864f745e4689ba224718bc976ce25b03c
Contents?: true
Size: 1.29 KB
Versions: 4
Compression:
Stored size: 1.29 KB
Contents
<% callback_details_id = "#{Time.now.to_i}#{(rand * 1000).ceil}" %> <div class="callback-details" id="callback-details-<%= callback_details_id %>"> <script type="text/javascript"> (function(){ // Do not continue if Paloma.js is not found. if (window['Paloma'] === undefined && window['console'] !== undefined){ console.warn("Paloma.js not found. Require it in your application.js."); return true; } var id = "callback-details-<%= callback_details_id %>", callbacks = []; // Remove any callback details if any $('.callback-details[id!=" + id + "]').remove(); // Convert callbacks to javascript variable <% callbacks.each do |callback| %> callbacks.push({ controller: '<%= callback[:controller] %>', action: '<%= callback[:action] %>', params: eval($('<div/>').html("(<%= callback[:params].to_json %>)").text()) }); <% end %> // Run Callbacks $(document).ready(function(){ for (var i = 0, len = callbacks.length; i < len; i++){ var callback = callbacks[i]; Paloma.execute(callback.controller, callback.action, callback.params); } }); })(); </script> </div>
Version data entries
4 entries across 4 versions & 1 rubygems