aboutsummaryrefslogtreecommitdiffstats
path: root/www/js/views/save_offline.js
diff options
context:
space:
mode:
Diffstat (limited to 'www/js/views/save_offline.js')
-rw-r--r--www/js/views/save_offline.js32
1 files changed, 32 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..d00170c
--- /dev/null
+++ b/www/js/views/save_offline.js
@@ -0,0 +1,32 @@
+(function (FMS, Backbone, _, $) {
+ _.extend( FMS, {
+ SaveOfflineView: FMS.FMSView.extend({
+ template: 'save_offline',
+ id: 'save_offline',
+
+ events: {
+ 'pagehide': 'destroy',
+ 'pagebeforeshow': 'beforeDisplay',
+ 'pageshow': 'afterDisplay',
+ 'vclick #save_report': 'saveReport',
+ 'vclick #discard': 'discardReport'
+ },
+
+ saveReport: function() {
+ FMS.clearCurrentDraft();
+ this.navigate('reports');
+ },
+
+ discardReport: function() {
+ var reset = FMS.removeDraft(FMS.currentDraft.id, true);
+ var that = this;
+ reset.done( function() { that.onDraftRemove(); } );
+ reset.fail( function() { that.onDraftRemove(); } );
+ },
+
+ onDraftRemove: function() {
+ this.navigate( 'around', 'left' );
+ }
+ })
+ });
+})(FMS, Backbone, _, $);