summaryrefslogtreecommitdiff
path: root/animism-align/frontend/app/views/media/components/media.formGallery.js
diff options
context:
space:
mode:
Diffstat (limited to 'animism-align/frontend/app/views/media/components/media.formGallery.js')
-rw-r--r--animism-align/frontend/app/views/media/components/media.formGallery.js12
1 files changed, 11 insertions, 1 deletions
diff --git a/animism-align/frontend/app/views/media/components/media.formGallery.js b/animism-align/frontend/app/views/media/components/media.formGallery.js
index 25b715c..b2e0381 100644
--- a/animism-align/frontend/app/views/media/components/media.formGallery.js
+++ b/animism-align/frontend/app/views/media/components/media.formGallery.js
@@ -26,6 +26,7 @@ export default class MediaGalleryForm extends Component {
this.uploadSize = this.uploadSize.bind(this)
this.handleSaveItem = this.handleSaveItem.bind(this)
this.handleUploadGalleryThumbnail = this.handleUploadGalleryThumbnail.bind(this)
+ this.handleDestroyGalleryThumbnail = this.handleDestroyGalleryThumbnail.bind(this)
}
handleChange(e) {
@@ -53,7 +54,7 @@ export default class MediaGalleryForm extends Component {
handleUploadGalleryThumbnail(file) {
this.setState({ loading: true })
if (this.props.data.thumbnail) {
- actions.upload.destroy({ id: this.props.data.thumbnail.id })
+ this.handleDestroyGalleryThumbnail()
}
this.uploadThumbnail(file, 'thumbnail', THUMBNAIL_SIZE, THUMBNAIL_QUALITY)
.then(data => {
@@ -65,6 +66,14 @@ export default class MediaGalleryForm extends Component {
})
}
+ handleDestroyGalleryThumbnail(e) {
+ if (e) {
+ e.preventDefault()
+ e.stopPropagation()
+ }
+ actions.upload.destroy({ id: this.props.data.thumbnail.id })
+ }
+
uploadFullsize(files) {
const { data } = this.props
// first, upload all the fullsize files
@@ -283,6 +292,7 @@ export default class MediaGalleryForm extends Component {
<div className='label'>
<span>Thumbnail</span>
<img src={data.settings.thumbnail.url} />
+ <button onClick={this.handleDestroyGalleryThumbnail}>x</button>
</div>
}
</div>