From cede0aec83d96266206a0c50841710c93008c36f Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Thu, 10 May 2012 19:17:55 +0200 Subject: [PATCH] Added WCF.EditableItemList (this time for real!) --- wcfsetup/install/files/js/WCF.js | 164 ++++++++++++++++++++++++++++++- 1 file changed, 160 insertions(+), 4 deletions(-) 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) { + $('