diff options
author | Struan Donald <struan@exo.org.uk> | 2013-04-18 11:50:52 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2013-04-18 11:57:55 +0100 |
commit | a78194a0aa6fab68e82dc035f2f95281a653265f (patch) | |
tree | 6d6f57174b2919ac0031bf1f2363d921e8730cd1 /www/js/views/save_offline.js | |
parent | 4927e38eb8f108d4e910e691f593bca4992fb28f (diff) |
display a save for later page if between starting the report and
submitting it we have gone offline
Diffstat (limited to 'www/js/views/save_offline.js')
-rw-r--r-- | www/js/views/save_offline.js | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/www/js/views/save_offline.js b/www/js/views/save_offline.js new file mode 100644 index 0000000..69cd7fc --- /dev/null +++ b/www/js/views/save_offline.js @@ -0,0 +1,29 @@ +(function (FMS, Backbone, _, $) { + _.extend( FMS, { + SaveOfflineView: FMS.FMSView.extend({ + template: 'save_offline', + id: 'save_offline', + + events: { + 'pagehide': 'destroy', + 'pageshow': 'afterDisplay', + 'click #save_report': 'saveReport', + 'click #discard': 'discardReport' + }, + + saveReport: function() { + this.navigate('reports'); + }, + + discardReport: function() { + var reset = FMS.removeDraft(FMS.currentDraft.id, true); + var that = this; + reset.done( function() { that.onDraftRemove(); } ); + }, + + onDraftRemove: function() { + this.navigate( 'around', 'left' ); + } + }) + }); +})(FMS, Backbone, _, $); |