From 7eca803d00110573a20480c5965a7de15e3d90d8 Mon Sep 17 00:00:00 2001 From: Aileen Nowak Date: Mon, 31 Jul 2017 13:44:26 +0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=99=85=20=20Disable=20image=20upload=20sa?= =?UTF-8?q?ve=20btn=20when=20uploading=20(#805)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit closes TryGhost/#8724 Adds a `isUploading` action that disables the `save` button for `upload-image` component until the upload process is finished. --- ghost/admin/app/components/modals/upload-image.js | 5 +++++ .../app/templates/components/modals/upload-image.hbs | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ghost/admin/app/components/modals/upload-image.js b/ghost/admin/app/components/modals/upload-image.js index b396c12207..d3fb2ba0c0 100644 --- a/ghost/admin/app/components/modals/upload-image.js +++ b/ghost/admin/app/components/modals/upload-image.js @@ -10,6 +10,7 @@ export default ModalComponent.extend({ url: '', newUrl: '', + _isUploading: false, config: injectService(), notifications: injectService(), @@ -97,6 +98,10 @@ export default ModalComponent.extend({ confirm() { this.get('uploadImage').perform(); + }, + + isUploading() { + this.toggleProperty('_isUploading'); } } }); diff --git a/ghost/admin/app/templates/components/modals/upload-image.hbs b/ghost/admin/app/templates/components/modals/upload-image.hbs index 876eb5a8be..b753f1514d 100644 --- a/ghost/admin/app/templates/components/modals/upload-image.hbs +++ b/ghost/admin/app/templates/components/modals/upload-image.hbs @@ -12,6 +12,8 @@ image=newUrl saveButton=false update=(action 'fileUploaded') + uploadStarted=(action 'isUploading') + uploadFinished=(action 'isUploading') accept=model.accept extensions=model.extensions uploadUrl=model.uploadUrl @@ -21,5 +23,9 @@