From df66eb0291e7478c7df9603a28e966fa40f68738 Mon Sep 17 00:00:00 2001 From: Struan Donald Date: Wed, 7 Aug 2013 11:41:01 +0100 Subject: Force saving of draft if removing a photo Becuase we don't save drafts that are only a location once you remove the photo from a report that only has a location and a photo that change isn't saved as it becomes a report with only a location hence add a force option so saveCurrentDrafts and use it when removing a photo. Fixes #86 --- src/js/app.js | 4 ++-- src/js/views/photo.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/js/app.js b/src/js/app.js index 69edd89..4709ea6 100644 --- a/src/js/app.js +++ b/src/js/app.js @@ -90,9 +90,9 @@ var tpl = { } }, - saveCurrentDraft: function() { + saveCurrentDraft: function(force) { FMS.router.pause(); - if ( FMS.currentDraft.isPartial() ) { + if ( force || FMS.currentDraft.isPartial() ) { FMS.allDrafts.add( FMS.currentDraft ); FMS.currentDraft.save(); localStorage.currentDraftID = FMS.currentDraft.id; diff --git a/src/js/views/photo.js b/src/js/views/photo.js index 1544254..2d03e1c 100644 --- a/src/js/views/photo.js +++ b/src/js/views/photo.js @@ -93,7 +93,7 @@ del.done( function() { that.model.set('file', ''); - FMS.saveCurrentDraft(); + FMS.saveCurrentDraft(true); $('#photo').attr('src', 'images/placeholder-photo.png').addClass('placeholder').removeClass('small'); $('#photo-next-btn .ui-btn-text').text('Skip'); -- cgit v1.2.3