Created
February 16, 2012 16:02
-
-
Save rafamvc/1846006 to your computer and use it in GitHub Desktop.
Revisions
-
rafamvc revised this gist
Mar 27, 2012 . 2 changed files with 4 additions and 4 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ // "<controller_name>.js", and you import it after the init.js on your application.js // Replace the <controller_name> with the actual name MY_APP.<controller_name> = { init: function() { // Your shared code for the whole controller goes here }, @@ -12,4 +12,4 @@ RELASPHERE.<controller_name> = { edit: function() { // Your code for the edit page goes here } } 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 charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ // "<controller_name>.js", and you import it after the init.js on your application.js // Replace the <controller_name> with the actual name MY_APP.<controller_name> = { init: function() { // Your shared code for the whole controller goes here }, @@ -12,4 +12,4 @@ RELASPHERE.<controller_name> = { edit: function() { // Your code for the edit page goes here } } -
Rafael Cardoso renamed this gist
Feb 16, 2012 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
Rafael Cardoso revised this gist
Feb 16, 2012 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ Where you see RELASPHERE you should use MY_APP on the controller_name.js. Somehow github doesnt let me edit that file because of the name. -
Rafael Cardoso renamed this gist
Feb 16, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ // "<controller_name>.js", and you import it after the init.js on your application.js // Replace the <controller_name> with the actual name RELASPHERE.<controller_name> = { init: function() { // Your shared code for the whole controller goes here }, -
Rafael Cardoso revised this gist
Feb 16, 2012 . No changes.There are no files selected for viewing
-
Rafael Cardoso revised this gist
Feb 16, 2012 . 1 changed file with 15 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ // On the page specific file: // "<controller_name>.js", and you import it after the init.js on your application.js // Replace the <controller_name> with the actual name RELASPHERE.<controller_name> = { init: function() { // Your shared code for the whole controller goes here }, index: function() { // Your code for the index page goes here }, edit: function() { // Your code for the edit page goes here } } -
Rafael Cardoso renamed this gist
Feb 16, 2012 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
Rafael Cardoso revised this gist
Feb 16, 2012 . No changes.There are no files selected for viewing
-
Rafael Cardoso revised this gist
Feb 16, 2012 . No changes.There are no files selected for viewing
-
Rafael Cardoso revised this gist
Feb 16, 2012 . 1 changed file with 15 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ // On the page specific file: // "<controller_name>.js", and you import it after the init.js on your application.js // Replace the <controller_name> with the actual name MY_APP.<controller_name> = { init: function() { // Your shared code for the whole controller goes here }, index: function() { // Your code for the index page goes here }, edit: function() { // Your code for the edit page goes here } } -
Rafael Cardoso revised this gist
Feb 16, 2012 . 3 changed files with 19 additions and 18 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ // On the page specific file: // "<controller_name>.js", and you import it after the init.js on your application.js // Replace the <controller_name> with the actual name RELASPHERE.<controller_name> = { init: function() { // Your shared code for the whole controller goes here }, index: function() { // Your code for the index page goes here }, edit: function() { // Your code for the edit page goes here } } 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,4 @@ <html> <body data-controller="<%= controller_name %>" data-action="<%= action_name %>" class='<%= controller_name %>'> </body> </html> 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 charactersOriginal file line number Diff line number Diff line change @@ -24,21 +24,3 @@ UTIL = { }; $( document ).ready( UTIL.init ); -
Rafael Cardoso revised this gist
Feb 16, 2012 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,5 @@ // This global variable will hold all your page specific functions // I know that global vars suck, but I think this is a good and safe exception MY_APP = { }; -
Rafael Cardoso revised this gist
Feb 16, 2012 . 1 changed file with 21 additions and 10 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,15 +1,9 @@ MY_APP = { }; UTIL = { exec: function( controller, action ) { var ns = MY_APP, action = ( action === undefined ) ? "init" : action; if ( controller !== "" && ns[controller] && typeof ns[controller][action] == "function" ) { @@ -22,10 +16,27 @@ UTIL = { controller = body.getAttribute( "data-controller" ), action = body.getAttribute( "data-action" ); UTIL.exec( controller ); UTIL.exec( controller, action ); } }; $( document ).ready( UTIL.init ); // On the page specific file: // "<controller_name>.js", and you import it after the init.js on your application.js // Replace the <controller_name> with the actual name RELASPHERE.<controller_name> = { init: function() { // Your shared code for the whole controller goes here }, index: function() { // Your code for the index page goes here }, edit: function() { // Your code for the edit page goes here } } -
Rafael Cardoso created this gist
Feb 16, 2012 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,31 @@ RELASPHERE = { common: { init: function() { // application-wide code depress_menu_button(); } } }; UTIL = { exec: function( controller, action ) { var ns = RELASPHERE, action = ( action === undefined ) ? "init" : action; if ( controller !== "" && ns[controller] && typeof ns[controller][action] == "function" ) { ns[controller][action](); } }, init: function() { var body = document.body, controller = body.getAttribute( "data-controller" ), action = body.getAttribute( "data-action" ); UTIL.exec( "common" ); UTIL.exec( controller ); UTIL.exec( controller, action ); } }; $( document ).ready( UTIL.init );