}
});
-/**
- * @see WCF.Action.Delete
- */
-WCF.ACP.Category.Delete = WCF.Action.Delete.extend({
- /**
- * @see WCF.Action.Delete.triggerEffect()
- */
- triggerEffect: function(objectIDs) {
- for (var $index in this._containers) {
- var $container = $('#' + this._containers[$index]);
- if (WCF.inArray($container.find('.jsDeleteButton').data('objectID'), objectIDs)) {
- // move child categories up
- if ($container.has('ol').has('li')) {
- if ($container.is(':only-child')) {
- $container.parent().replaceWith($container.find('> ol'));
- }
- else {
- $container.replaceWith($container.find('> ol > li'));
- }
- }
- else {
- $container.wcfBlindOut('up', function() { $container.remove(); });
- }
- }
- }
- }
-});
-
/**
* Provides the search dropdown for ACP
*
{if $collapsibleObjectTypeID}
new WCF.ACP.Category.Collapsible('wcf\\data\\category\\CategoryAction', {@$collapsibleObjectTypeID});
{/if}
-
+
{if $objectType->getProcessor()->canDeleteCategory()}
- new WCF.ACP.Category.Delete('wcf\\data\\category\\CategoryAction', $('.jsCategory'));
+ new WCF.Action.NestedDelete('wcf\\data\\category\\CategoryAction', '.jsCategory');
{/if}
{if $objectType->getProcessor()->canEditCategory()}
new WCF.Action.Toggle('wcf\\data\\category\\CategoryAction', '.jsCategory', '> .sortableNodeLabel > .buttons > .jsToggleButton');
}
});
+/**
+ * Basic implementation for deletion of nested elements.
+ *
+ * The implementation requires the nested elements to be grouped as numbered lists
+ * (ol lists). The child elements of the deleted elements are moved to the parent
+ * element of the deleted element.
+ *
+ * @see WCF.Action.Delete
+ */
+WCF.Action.NestedDelete = WCF.Action.Delete.extend({
+ /**
+ * @see WCF.Action.Delete.triggerEffect()
+ */
+ triggerEffect: function(objectIDs) {
+ for (var $index in this._containers) {
+ var $container = $('#' + this._containers[$index]);
+ if (WCF.inArray($container.find(this._buttonSelector).data('objectID'), objectIDs)) {
+ // move child categories up
+ if ($container.has('ol').has('li')) {
+ if ($container.is(':only-child')) {
+ $container.parent().replaceWith($container.find('> ol'));
+ }
+ else {
+ $container.replaceWith($container.find('> ol > li'));
+ }
+ }
+ else {
+ $container.wcfBlindOut('up', function() { $(this).remove(); });
+ }
+ }
+ }
+ }
+});
+
/**
* Basic implementation for AJAXProxy-based toggle actions.
*