aboutsummaryrefslogtreecommitdiffstats
path: root/www/js/views
diff options
context:
space:
mode:
Diffstat (limited to 'www/js/views')
-rw-r--r--www/js/views/existing.js20
-rw-r--r--www/js/views/submit.js21
2 files changed, 13 insertions, 28 deletions
diff --git a/www/js/views/existing.js b/www/js/views/existing.js
index 1fc88c0..4abf857 100644
--- a/www/js/views/existing.js
+++ b/www/js/views/existing.js
@@ -17,21 +17,13 @@
},
discardReport: function() {
- var uri = FMS.currentDraft.get('file');
- FMS.allDrafts.remove(FMS.currentDraft);
- FMS.currentDraft.destroy();
- localStorage.currentDraftID = null;
- FMS.currentDraft = new FMS.Draft();
-
- if ( uri ) {
- var del = FMS.files.deleteURI( uri );
-
- var that = this;
- del.done( function() { that.navigate( 'around' ); } );
+ var reset = FMS.removeDraft(FMS.currentDraft.id, true);
+ var that = this;
+ reset.done( function() { that.onDraftRemove(); } );
+ },
- } else {
- this.navigate( 'around', 'left' );
- }
+ onDraftRemove: function() {
+ this.navigate( 'around', 'left' );
}
})
});
diff --git a/www/js/views/submit.js b/www/js/views/submit.js
index d94a03f..27b21f7 100644
--- a/www/js/views/submit.js
+++ b/www/js/views/submit.js
@@ -47,23 +47,16 @@
if ( FMS.currentUser ) {
FMS.currentUser.save();
}
- var id = FMS.currentDraft.id;
- var uri = FMS.currentDraft.get('file');
- FMS.allDrafts.remove(FMS.currentDraft);
- FMS.currentDraft.destroy();
+ var reset = FMS.removeDraft( FMS,currentDraftID, true);
+ var that = this;
+ reset.done( function() { that.onRemoveDraft(); } );
+ },
+
+ onRemoveDraft: function() {
FMS.currentDraft = new FMS.Draft();
localStorage.currentDraftID = null;
FMS.createdReport = this.report;
-
- if ( uri ) {
- var del = FMS.files.deleteURI( uri );
-
- var that = this;
- del.done( function() { that.navigate( 'sent' ); } );
-
- } else {
- this.navigate( 'sent', 'left' );
- }
+ this.navigate( 'sent', 'left' );
},
onReportError: function(model, err, options) {