diff options
author | Struan Donald <struan@exo.org.uk> | 2013-08-07 11:41:01 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2013-08-07 11:41:01 +0100 |
commit | df66eb0291e7478c7df9603a28e966fa40f68738 (patch) | |
tree | 729139c07dc9fa0164dde3edf475968b7f2561fd | |
parent | d418a7de38becda6d892ca62f30792a4416b2218 (diff) |
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
-rw-r--r-- | src/js/app.js | 4 | ||||
-rw-r--r-- | src/js/views/photo.js | 2 |
2 files changed, 3 insertions, 3 deletions
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'); |