From: Alexander Ebert Date: Sun, 25 May 2014 11:17:36 +0000 (+0200) Subject: Fixed "Insert All" button being always visible X-Git-Tag: 2.1.0_Alpha_1~711^2~17 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=8fb2874e6902a124a16d7535d2afb80b51deb5d7;p=GitHub%2FWoltLab%2FWCF.git Fixed "Insert All" button being always visible --- 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(); },