🙅 Disable image upload save btn when uploading (#805)

closes TryGhost/#8724

Adds a `isUploading` action that disables the `save` button for `upload-image` component until the upload process is finished.
This commit is contained in:
Aileen Nowak 2017-07-31 13:44:26 +04:00 committed by Kevin Ansfield
parent c489f4474b
commit 7eca803d00
2 changed files with 12 additions and 1 deletions

View File

@ -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');
}
}
});

View File

@ -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 @@
<div class="modal-footer">
<button {{action "closeModal"}} class="gh-btn"><span>Cancel</span></button>
{{gh-task-button task=uploadImage class="gh-btn gh-btn-blue right gh-btn-icon" data-test-modal-accept-button=true}}
{{#if _isUploading}}
<button class="gh-btn gh-btn-blue right gh-btn-icon disabled"><span>Save</span></button>
{{else}}
{{gh-task-button task=uploadImage class="gh-btn gh-btn-blue right gh-btn-icon" data-test-modal-accept-button=true}}
{{/if}}
</div>