From: Alexander Ebert Date: Thu, 10 May 2012 17:17:55 +0000 (+0200) Subject: Added WCF.EditableItemList (this time for real!) X-Git-Tag: 2.0.0_Beta_1~1116 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=cede0aec83d96266206a0c50841710c93008c36f;p=GitHub%2FWoltLab%2FWCF.git Added WCF.EditableItemList (this time for real!) --- diff --git a/wcfsetup/install/files/js/WCF.js b/wcfsetup/install/files/js/WCF.js index a0a83d0772..1a7c96ea63 100644 --- a/wcfsetup/install/files/js/WCF.js +++ b/wcfsetup/install/files/js/WCF.js @@ -5454,12 +5454,73 @@ WCF.Popover = Class.extend({ } }); +/** + * Provides an extensible item list with built-in search. + * + * @param string itemListSelector + * @param string searchInputSelector + */ WCF.EditableItemList = Class.extend({ + /** + * allows custom input not recognized by search to be added + * @var boolean + */ + _allowCustomInput: false, + + /** + * action class name + * @var string + */ + _className: '', + + /** + * internal data storage + * @var mixed + */ _data: { }, + + /** + * form container + * @var jQuery + */ + _form: null, + + /** + * item list container + * @var jQuery + */ _itemList: null, + + /** + * current object id + * @var integer + */ + _objectID: 0, + + /** + * object type id + * @var integer + */ + _objectTypeID: 0, + + /** + * search controller + * @var WCF.Search.Base + */ _search: null, + + /** + * search input element + * @var jQuery + */ _searchInput: null, + /** + * Creates a new WCF.EditableItemList object. + * + * @param string itemListSelector + * @param string searchInputSelector + */ init: function(itemListSelector, searchInputSelector) { this._itemList = $(itemListSelector); this._searchInput = $(searchInputSelector); @@ -5469,8 +5530,38 @@ WCF.EditableItemList = Class.extend({ return; } + this._objectID = this._getObjectID(); + this._objectTypeID = this._getObjectTypeID(); + // bind item listener this._itemList.find('.jsEditableItem').click($.proxy(this._click, this)); + + // create item list + if (!this._itemList.children('ul').length) { + $('