Skip to content

Commit

Permalink
Clear images in gh-uploader when navigating between items
Browse files Browse the repository at this point in the history
closes #6198
- clear img src in gh-uploader when navigating to item with image
- always reset uploader component when new image is not empty
  • Loading branch information
kevinkucharczyk committed Jan 16, 2016
1 parent 9fda1dc commit 41a18c9
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions core/client/app/components/gh-uploader.js
Expand Up @@ -36,13 +36,14 @@ export default Component.extend({
this.$()[0].uploaderUi.reset();
}

// re-init if we receive a new image but the uploader is blank
// re-init if we receive a new image
// - handles back button navigating from blank image to populated image
// - handles navigating between populated images

if (!isEmpty(newValue) && this.$()) {
if (this.$('.js-upload-target').attr('src') === '') {
this.$()[0].uploaderUi.reset();
this.$()[0].uploaderUi.initWithImage();
}
this.$('.js-upload-target').attr('src', '');
this.$()[0].uploaderUi.reset();
this.$()[0].uploaderUi.initWithImage();
}
},

Expand Down

0 comments on commit 41a18c9

Please sign in to comment.