Created
March 28, 2011 04:28
-
-
Save robertsosinski/890005 to your computer and use it in GitHub Desktop.
Specify controller and action for jQuery load event.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| !!! | |
| %html | |
| %head | |
| %body{:class => params[:controller], :id => params[:action]} | |
| = yield |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function($) { | |
| $.start('lists#index', function() { | |
| console.log('lists controller - index action'); | |
| }); | |
| })(jQuery); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function($) { | |
| $.start = function(selector, callback) { | |
| var output = $(function() { | |
| if ($('body.'+selector).length) { | |
| callback(); | |
| } | |
| }); | |
| return output; | |
| }; | |
| })(jQuery); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function($) { | |
| $.start('lists', function() { | |
| console.log('lists controller'); | |
| }); | |
| })(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment