From 8fb2874e6902a124a16d7535d2afb80b51deb5d7 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Sun, 25 May 2014 13:17:36 +0200 Subject: [PATCH] Fixed "Insert All" button being always visible --- wcfsetup/install/files/js/WCF.Attachment.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/wcfsetup/install/files/js/WCF.Attachment.js b/wcfsetup/install/files/js/WCF.Attachment.js index 0dc4e26521..5c4c5f68f6 100644 --- a/wcfsetup/install/files/js/WCF.Attachment.js +++ b/wcfsetup/install/files/js/WCF.Attachment.js @@ -64,8 +64,12 @@ WCF.Attachment.Upload = WCF.Upload.extend({ this._makeSortable(); - this._insertAllButton = $('

' + WCF.Language.get('wcf.attachment.insertAll') + '

').appendTo(this._buttonSelector); + this._insertAllButton = $('

' + WCF.Language.get('wcf.attachment.insertAll') + '

').hide().appendTo(this._buttonSelector); this._insertAllButton.click($.proxy(this._insertAll, this)); + + if (this._fileListSelector.children('li:not(.uploadFailed)').length) { + this._insertAllButton.show(); + } }, /** @@ -107,6 +111,10 @@ WCF.Attachment.Upload = WCF.Upload.extend({ if ($target.is('li.box48') && $target.parent().wcfIdentify() === this._fileListSelector.wcfIdentify()) { this._buttonSelector.next('small.innerError').remove(); } + + if (!this._fileListSelector.children('li:not(.uploadFailed)').length) { + this._insertAllButton.hide(); + } }, /** @@ -243,6 +251,13 @@ WCF.Attachment.Upload = WCF.Upload.extend({ this._makeSortable(); + if (this._fileListSelector.children('li:not(.uploadFailed)').length) { + this._insertAllButton.show(); + } + else { + this._insertAllButton.hide(); + } + WCF.DOMNodeInsertedHandler.execute(); }, -- 2.20.1