diff options
-rw-r--r-- | www/js/views/around.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/www/js/views/around.js b/www/js/views/around.js index 81acaf6..4d0389c 100644 --- a/www/js/views/around.js +++ b/www/js/views/around.js @@ -210,11 +210,25 @@ if ( this.model.isPartial() ) { FMS.clearCurrentDraft(); } else { + // it's not partial but we've created a draft anyway so + // delete it + if ( this.model.id ) { + var del = FMS.removeDraft( this.model.id, true ); + var that = this; + del.done( function() { that.decrementDraftCount(); } ); + } this.model.set('lat', null); this.model.set('lon', null); } }, + decrementDraftCount: function() { + var counter = $('#view-my-reports .draft_count'); + var count = counter.text(); + count--; + counter.text(count); + }, + onClickReposition: function(e) { e.preventDefault(); var lonlat = this.getCrossHairPosition(); |