lib/generators/rails_script/install/templates/base.js.coffee in rails_script-0.7.0 vs lib/generators/rails_script/install/templates/base.js.coffee in rails_script-1.0.0
- old
+ new
@@ -1,5 +1,12 @@
window.<%= RailsScript.app_namespace %> ||= {}
+window.Element ||= {}
+window.Utility ||= {}
+
+$(document).on "turbolinks:load.rails_script", ->
+ Utility.RailsVars = $('#rails-script').data('vars')
+ window.$this = new (<%= RailsScript.app_namespace %>["#{$('#rails-script').data('controller')}"] || <%= RailsScript.app_namespace %>.Base)()
+
class <%= RailsScript.app_namespace %>.Base
constructor: ->
if (window.jQuery) then @setClearEventHandlers() # clearing application event handlers only possible with jQuery
return this