From f52099600d1e07067da9de423d8390d17b4404a2 Mon Sep 17 00:00:00 2001 From: sunhao Date: Fri, 15 Mar 2024 09:56:44 +0800 Subject: [PATCH] * file: bug #47006, optimize UI of image uploader. --- module/file/js/uploadimages.ui.js | 2 +- module/file/ui/uploadimages.html.php | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/module/file/js/uploadimages.ui.js b/module/file/js/uploadimages.ui.js index 39cb056ddb..8ba906b61d 100644 --- a/module/file/js/uploadimages.ui.js +++ b/module/file/js/uploadimages.ui.js @@ -63,7 +63,7 @@ window.uploadImages = function(selector, options, $uploadBtn) if(!files.length) { - zui.Modal.alert(options.uploadEmpty); + if(!$uploadBtn.hasClass('disabled')) zui.Modal.alert(options.errorUploadEmpty); return; } diff --git a/module/file/ui/uploadimages.html.php b/module/file/ui/uploadimages.html.php index e83fa99d44..02e2f681e9 100644 --- a/module/file/ui/uploadimages.html.php +++ b/module/file/ui/uploadimages.html.php @@ -29,14 +29,16 @@ imageSelector set::_id($selectorID), set::className('surface'), set::name('uploader'), - set::tip(false) + set::tip(false), + set::onChange(jsCallback('event')->do('$(event.target).closest(".modal-dialog").find(".btn-upload").toggleClass("disabled", !event.target.files.length)')), ); toolbar ( btn ( - setClass('primary uploadBtn'), + setClass('primary btn-upload'), + set::disabled(true), on::click()->call('uploadImages', "#$selectorID", $uploadOptions, jsRaw('$this')), $lang->file->beginUpload, span(setClass('as-progress'))