Created
May 6, 2011 21:54
-
-
Save nickh/959869 to your computer and use it in GitHub Desktop.
Autosave when moving between pages
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
| diff --git a/app/views/messages/wizard.html.haml b/app/views/messages/wizard.html.haml | |
| index f138222..1393a77 100644 | |
| --- a/app/views/messages/wizard.html.haml | |
| +++ b/app/views/messages/wizard.html.haml | |
| @@ -27,7 +27,6 @@ | |
| =link_to t('message.wizard.action.cancel'), '#' | |
| =link_to t('message.wizard.action.back'), '#/back', :class => 'button back' | |
| =link_to t('message.wizard.action.next'), '#/next', :class => 'button next' | |
| - = f.submit 'save (TODO:removethis)' | |
| .templates | |
| -# TODO 3: If there's any more backbone stuff, this should be moved to | |
| diff --git a/public/javascripts/app/controllers/messages.js b/public/javascripts/app/controllers/messages.js | |
| index 018a1c1..bfc8366 100644 | |
| --- a/public/javascripts/app/controllers/messages.js | |
| +++ b/public/javascripts/app/controllers/messages.js | |
| @@ -17,6 +17,13 @@ var make_route_handler = function( page_name ) { | |
| return function( message_id ) { | |
| this.loadMessage( message_id, _(function() { | |
| console.debug( "VR.Controllers.Messages#" + page_name ); | |
| + | |
| + /* Save the model when moving from one page to another (vs. showing the | |
| + * first page when the workflow is initialized) | |
| + */ | |
| + if ( this.view.currentPage ) { | |
| + this.model.save(); | |
| + } | |
| this.show(page_name, index); | |
| }).bind(this)); | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment