From: Alexander Ebert Date: Tue, 8 Mar 2016 18:25:35 +0000 (+0100) Subject: Added user suggestions module X-Git-Tag: 3.0.0_Beta_1~2030^2~55 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=0aa633c93f593e6870e602fbd38c665f00d9a4f1;p=GitHub%2FWoltLab%2FWCF.git Added user suggestions module --- diff --git a/wcfsetup/install/files/acp/templates/userSearch.tpl b/wcfsetup/install/files/acp/templates/userSearch.tpl index 21a8ec33e1..3be1e92649 100644 --- a/wcfsetup/install/files/acp/templates/userSearch.tpl +++ b/wcfsetup/install/files/acp/templates/userSearch.tpl @@ -1,12 +1,9 @@ {include file='header' pageTitle='wcf.acp.user.search'}
diff --git a/wcfsetup/install/files/js/WCF.js b/wcfsetup/install/files/js/WCF.js index fcf4fb6a4d..d0a657f868 100755 --- a/wcfsetup/install/files/js/WCF.js +++ b/wcfsetup/install/files/js/WCF.js @@ -4932,6 +4932,7 @@ WCF.Search.Base = Class.extend({ * Provides quick search for users and user groups. * * @see WCF.Search.Base + * @deprecated 2.2 - please use `WoltLab/WCF/Ui/User/Search/Input` instead */ WCF.Search.User = WCF.Search.Base.extend({ /** diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Ui/User/Search/Input.js b/wcfsetup/install/files/js/WoltLab/WCF/Ui/User/Search/Input.js new file mode 100644 index 0000000000..867651a63e --- /dev/null +++ b/wcfsetup/install/files/js/WoltLab/WCF/Ui/User/Search/Input.js @@ -0,0 +1,51 @@ +/** + * Provides suggestions for users, optionally supporting groups. + * + * @author Alexander Ebert + * @copyright 2001-2016 WoltLab GmbH + * @license GNU Lesser General Public License + * @module WoltLab/WCF/Ui/User/Search/Input + * @see module:WoltLab/WCF/Ui/Search/Input + */ +define(['Core', 'WoltLab/WCF/Ui/Search/Input'], function(Core, UiSearchInput) { + "use strict"; + + /** + * @param {Element} element input element + * @param {Object=} options search options and settings + * @constructor + */ + function UiUserSearchInput(element, options) { this.init(element, options); } + Core.inherit(UiUserSearchInput, UiSearchInput, { + init: function(element, options) { + var includeUserGroups = (Core.isPlainObject(options) && options.includeUserGroups === true); + + options = Core.extend({ + ajax: { + className: 'wcf\\data\\user\\UserAction', + parameters: { + data: { + includeUserGroups: (includeUserGroups ? 1 : 0) + } + } + } + }, options); + + UiUserSearchInput._super.prototype.init.call(this, element, options); + }, + + _createListItem: function(item) { + var listItem = UiUserSearchInput._super.prototype._createListItem.call(this, item); + + var box = elCreate('div'); + box.className = 'box16'; + box.innerHTML = (item.type === 'group') ? '' : item.icon; + box.appendChild(listItem.children[0]); + listItem.appendChild(box); + + return listItem; + } + }); + + return UiUserSearchInput; +});