aboutsummaryrefslogtreecommitdiffstats
path: root/www/js
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2013-07-04 12:09:40 +0100
committerStruan Donald <struan@exo.org.uk>2013-07-04 12:09:40 +0100
commitdbc965121422b13da1f7f272e42c74ec5a5156d4 (patch)
tree96c8decfc36c87bd7c45be3a9b060ab9613d89fc /www/js
parent113da6d94974a0e74f22eee649664990a8c8f12e (diff)
when canceling a report, if it has no details at all we should delete it
from the list of drafts to stop the list filling up with empty reports
Diffstat (limited to 'www/js')
-rw-r--r--www/js/views/around.js14
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();