File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed
vendor/assets/javascripts/rails_script Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change 11module RailsScript
2- VERSION = '2.0.0 '
2+ VERSION = '2.0.1 '
33end
Original file line number Diff line number Diff line change @@ -3,11 +3,13 @@ window.App ||= {}
33window .Element ||= {}
44window .Utility ||= {}
55
6- $ (document ).on " turbolinks:load.rails_script" , ->
6+ # Initializer
7+ $ (document ).on " ready.rails_script page:load.rails_script turbolinks:load.rails_script" , ->
8+ controller = $ (' #rails-script' ).data (' controller' )
9+ action = $ (' #rails-script' ).data (' action' )
710 Utility .RailsVars = $ (' #rails-script' ).data (' vars' )
8- window .$this = new (App[" #{ $ (' #rails-script' ).data (' controller' )} " ] || App .Base )()
911
10- action = $ ( ' #rails-script ' ). data ( ' action ' )
12+ window . $this = new (App[controller] || App . Base )( )
1113
1214 if typeof $this .beforeAction == ' function'
1315 $this .beforeAction action
@@ -16,8 +18,9 @@ $(document).on "turbolinks:load.rails_script", ->
1618 if typeof $this .afterAction == ' function'
1719 $this .afterAction action
1820
21+ # Clear event handlers on navigation
1922RailsScript .setClearEventHandlers = ->
20- jQuery (document ).on ' turbolinks:before-visit' , ->
23+ jQuery (document ).on ' page:before-change turbolinks:before-visit' , ->
2124 for element in [window , document ]
2225 for event, handlers of (jQuery ._data (element, ' events' ) || {})
2326 for handler in handlers
You can’t perform that action at this time.
0 commit comments