From 076e8a3f1703c3b6856197fea1722f436fa22596 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Thu, 15 Mar 2012 19:48:14 +0100 Subject: [PATCH] Added option to disable sorting for specific elements Fixes #522 --- wcfsetup/install/files/js/WCF.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/wcfsetup/install/files/js/WCF.js b/wcfsetup/install/files/js/WCF.js index f3d1164c01..5fa4f6ada0 100644 --- a/wcfsetup/install/files/js/WCF.js +++ b/wcfsetup/install/files/js/WCF.js @@ -4250,6 +4250,12 @@ WCF.Sortable.List.prototype = { */ _notification: null, + /** + * list of options + * @var object + */ + _options: { }, + /** * proxy object * @var WCF.Action.Proxy @@ -4267,8 +4273,9 @@ WCF.Sortable.List.prototype = { * * @param string containerID * @param string className + * @param object options */ - init: function(containerID, className) { + init: function(containerID, className, options) { this._containerID = $.wcfEscapeID(containerID); this._container = $('#' + this._containerID); this._className = className; @@ -4278,19 +4285,20 @@ WCF.Sortable.List.prototype = { this._structure = { }; // init sortable - $('#' + this._containerID + ' > .wcf-sortableList').wcfNestedSortable({ + this._options = $.extend(true, { axis: 'y', connectWith: '#' + this._containerID * ' .wcf-sortableList', disableNesting: 'wcf-sortableNoNesting', errorClass: 'wcf-sortableInvalidTarget', forcePlaceholderSize: true, helper: 'clone', - items: 'li', + items: 'li:not(.wcf-sortableNoSorting)', opacity: .6, placeholder: 'wcf-badgeYellow', tolerance: 'pointer', toleranceElement: '> span' - }); + }, options || { }); + $('#' + this._containerID + ' > .wcf-sortableList').wcfNestedSortable(this._options); this._container.find('.wcf-formSubmit > button[data-type="submit"]').click($.proxy(this._submit, this)); this._container.find('.wcf-formSubmit > button[data-type="reset"]').click($.proxy(this._reset, this)); @@ -4305,7 +4313,7 @@ WCF.Sortable.List.prototype = { var $list = $(list); var $parentID = $list.data('objectID'); - $list.children('li').each($.proxy(function(index, listItem) { + $list.children(this._options.items).each($.proxy(function(index, listItem) { var $objectID = $(listItem).data('objectID'); if (!this._structure[$parentID]) { -- 2.20.1