UX: Disabled lightbox expand button when loading image meta.

This commit is contained in:
Guo Xiang Tan 2019-02-21 22:30:01 +08:00
parent c5e952839a
commit 1dee71d760
2 changed files with 6 additions and 1 deletions

View File

@ -6,6 +6,7 @@ import { popupAjaxError } from "discourse/lib/ajax-error";
export default Ember.Component.extend(UploadMixin, {
classNames: ["image-uploader"],
loadingLightbox: false,
init() {
this._super(...arguments);
@ -71,6 +72,8 @@ export default Ember.Component.extend(UploadMixin, {
if (this.get("imageFilename")) {
this._openLightbox();
} else {
this.set("loadingLightbox", true);
ajax(`/uploads/lookup-metadata`, {
type: "POST",
data: { url: this.get("imageUrl") }
@ -84,6 +87,7 @@ export default Ember.Component.extend(UploadMixin, {
});
this._openLightbox();
this.set("loadingLightbox", false);
})
.catch(popupAjaxError);
}

View File

@ -13,7 +13,8 @@
{{d-button icon="discourse-expand"
title='expand'
class="btn image-uploader-lightbox-btn no-text"
action=(action "toggleLightbox")}}
action=(action "toggleLightbox")
disabled=loadingLightbox}}
{{/if}}
<span class="btn {{unless uploading 'hidden'}}">{{i18n 'upload_selector.uploading'}} {{uploadProgress}}%</span>