mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
🙅 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:
parent
c489f4474b
commit
7eca803d00
2 changed files with 12 additions and 1 deletions
|
@ -10,6 +10,7 @@ export default ModalComponent.extend({
|
||||||
|
|
||||||
url: '',
|
url: '',
|
||||||
newUrl: '',
|
newUrl: '',
|
||||||
|
_isUploading: false,
|
||||||
|
|
||||||
config: injectService(),
|
config: injectService(),
|
||||||
notifications: injectService(),
|
notifications: injectService(),
|
||||||
|
@ -97,6 +98,10 @@ export default ModalComponent.extend({
|
||||||
|
|
||||||
confirm() {
|
confirm() {
|
||||||
this.get('uploadImage').perform();
|
this.get('uploadImage').perform();
|
||||||
|
},
|
||||||
|
|
||||||
|
isUploading() {
|
||||||
|
this.toggleProperty('_isUploading');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
image=newUrl
|
image=newUrl
|
||||||
saveButton=false
|
saveButton=false
|
||||||
update=(action 'fileUploaded')
|
update=(action 'fileUploaded')
|
||||||
|
uploadStarted=(action 'isUploading')
|
||||||
|
uploadFinished=(action 'isUploading')
|
||||||
accept=model.accept
|
accept=model.accept
|
||||||
extensions=model.extensions
|
extensions=model.extensions
|
||||||
uploadUrl=model.uploadUrl
|
uploadUrl=model.uploadUrl
|
||||||
|
@ -21,5 +23,9 @@
|
||||||
|
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button {{action "closeModal"}} class="gh-btn"><span>Cancel</span></button>
|
<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>
|
</div>
|
||||||
|
|
Loading…
Add table
Reference in a new issue