aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2013-06-07 15:18:44 +0100
committerStruan Donald <struan@exo.org.uk>2013-06-07 15:33:49 +0100
commita95deb9f34a79efbe1a682b11d2a2146b82c40b5 (patch)
tree9f00391683ff65d9268aae411091e9038eeabe30
parentb2ce0c4a328de1919b948683170baac7565a4a9e (diff)
More explicable behaviour when you click cancel on the map screen
If the report only has location details then just throw them away, otherwise leave the report as a draft and then create a new draft
-rw-r--r--www/js/models/draft.js13
-rw-r--r--www/js/views/around.js8
2 files changed, 19 insertions, 2 deletions
diff --git a/www/js/models/draft.js b/www/js/models/draft.js
index b033f21..97a92ff 100644
--- a/www/js/models/draft.js
+++ b/www/js/models/draft.js
@@ -28,6 +28,19 @@
return desc;
},
+ isPartial: function() {
+ if (
+ this.get('title') ||
+ this.get('details') ||
+ this.get('category') ||
+ this.get('file')
+ ) {
+ return true;
+ }
+
+ return false;
+ },
+
createdDate: function() {
return moment.utc( this.get('created') ).format( 'H:mm Do MMM' );
}
diff --git a/www/js/views/around.js b/www/js/views/around.js
index d1075f6..39d58e5 100644
--- a/www/js/views/around.js
+++ b/www/js/views/around.js
@@ -165,8 +165,12 @@
$('#view-my-reports').show();
$('#login-options').show();
$('#mark-here').show();
- this.model.set('lat', null);
- this.model.set('lon', null);
+ if ( this.model.isPartial() ) {
+ FMS.clearCurrentDraft();
+ } else {
+ this.model.set('lat', null);
+ this.model.set('lon', null);
+ }
fixmystreet.markers.setVisibility(true);
fixmystreet.select_feature.activate();
},