From: Matthias Schmidt Date: Tue, 29 Aug 2017 14:43:42 +0000 (+0200) Subject: Upload media to selected category on media list page in ACP X-Git-Tag: 3.1.0_Alpha_2~8^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=1a50c4a3d6b23a52fa1d72a32f76ddd26fab05e1;p=GitHub%2FWoltLab%2FWCF.git Upload media to selected category on media list page in ACP See #2191 --- diff --git a/wcfsetup/install/files/acp/templates/mediaList.tpl b/wcfsetup/install/files/acp/templates/mediaList.tpl index b5c1a00ecf..570749b799 100644 --- a/wcfsetup/install/files/acp/templates/mediaList.tpl +++ b/wcfsetup/install/files/acp/templates/mediaList.tpl @@ -6,6 +6,9 @@ require(['Language', 'WoltLabSuite/Core/Controller/Media/List'], function (Language, ControllerMediaList) { Language.add('wcf.media.delete.confirmMessage', '{lang __literal=true}wcf.media.delete.confirmMessage{/lang}') ControllerMediaList.init({ + {if $categoryID} + categoryId: {@$categoryID}, + {/if} hasMarkedItems: {if $hasMarkedItems}true{else}false{/if} }); }); diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Controller/Media/List.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Controller/Media/List.js index cbf5a0aea5..f425bc7c6d 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Controller/Media/List.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Controller/Media/List.js @@ -42,6 +42,7 @@ define([ init: function(options) { options = options || {}; new MediaListUpload('uploadButton', 'mediaListTableBody', { + categoryId: options.categoryId, multiple: true }); diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Media/List/Upload.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Media/List/Upload.js index 79412dbe69..eb48dd6a2a 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Media/List/Upload.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Media/List/Upload.js @@ -50,6 +50,19 @@ define( var icon = elCreate('span'); icon.classList = 'icon icon16 fa-upload'; DomUtil.prepend(icon, elBySel('span', this._button)); + }, + + /** + * @see WoltLabSuite/Core/Upload#_getParameters + */ + _getParameters: function() { + if (this._options.categoryId) { + return Core.extend(MediaListUpload._super.prototype._getParameters.call(this), { + categoryID: this._options.categoryId + }); + } + + return MediaListUpload._super.prototype._getParameters.call(this); } });