From 46fc9d4965d88c57aa4973bb45cedb45eca0e227 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Magnus=20K=C3=BChn?= Date: Wed, 2 Jan 2013 19:32:06 +0100 Subject: [PATCH] Fixed WCF.Action.Toggle and implemented changes --- wcfsetup/install/files/acp/templates/categoryList.tpl | 2 +- wcfsetup/install/files/acp/templates/cronjobList.tpl | 2 +- .../install/files/acp/templates/languageServerList.tpl | 2 +- .../install/files/acp/templates/pageMenuItemList.tpl | 2 +- wcfsetup/install/files/acp/templates/styleList.tpl | 2 +- .../install/files/acp/templates/updateServerList.tpl | 2 +- wcfsetup/install/files/js/WCF.js | 9 +++++---- 7 files changed, 11 insertions(+), 10 deletions(-) diff --git a/wcfsetup/install/files/acp/templates/categoryList.tpl b/wcfsetup/install/files/acp/templates/categoryList.tpl index 31266922c6..3f0b04f072 100644 --- a/wcfsetup/install/files/acp/templates/categoryList.tpl +++ b/wcfsetup/install/files/acp/templates/categoryList.tpl @@ -12,7 +12,7 @@ new WCF.ACP.Category.Delete('wcf\\data\\category\\CategoryAction', $('.jsCategory')); {/if} {if $objectType->getProcessor()->canEditCategory()} - new WCF.Action.Toggle('wcf\\data\\category\\CategoryAction', $('.jsCategory'), '> .buttons > .jsToggleButton'); + new WCF.Action.Toggle('wcf\\data\\category\\CategoryAction', '.jsCategory', '> .buttons > .jsToggleButton'); {if $categoryNodeList|count > 1} var sortableNodes = $('.sortableNode'); diff --git a/wcfsetup/install/files/acp/templates/cronjobList.tpl b/wcfsetup/install/files/acp/templates/cronjobList.tpl index 31e88f1081..a7379d2ecd 100644 --- a/wcfsetup/install/files/acp/templates/cronjobList.tpl +++ b/wcfsetup/install/files/acp/templates/cronjobList.tpl @@ -11,7 +11,7 @@ //getSession()->getPermission('admin.language.canEditServer')} - new WCF.Action.Toggle('wcf\\data\\language\\server\\LanguageServerAction', $('.jsLanguageServerRow')); + new WCF.Action.Toggle('wcf\\data\\language\\server\\LanguageServerAction', '.jsLanguageServerRow'); {/if} }); //]]> diff --git a/wcfsetup/install/files/acp/templates/pageMenuItemList.tpl b/wcfsetup/install/files/acp/templates/pageMenuItemList.tpl index 229691c21d..f6e76fa41a 100644 --- a/wcfsetup/install/files/acp/templates/pageMenuItemList.tpl +++ b/wcfsetup/install/files/acp/templates/pageMenuItemList.tpl @@ -10,7 +10,7 @@ // // diff --git a/wcfsetup/install/files/acp/templates/updateServerList.tpl b/wcfsetup/install/files/acp/templates/updateServerList.tpl index a1c13113ee..44128666b2 100644 --- a/wcfsetup/install/files/acp/templates/updateServerList.tpl +++ b/wcfsetup/install/files/acp/templates/updateServerList.tpl @@ -4,7 +4,7 @@ // diff --git a/wcfsetup/install/files/js/WCF.js b/wcfsetup/install/files/js/WCF.js index dbf722053d..5f9b75c8f1 100755 --- a/wcfsetup/install/files/js/WCF.js +++ b/wcfsetup/install/files/js/WCF.js @@ -1860,7 +1860,7 @@ WCF.Action.Toggle = Class.extend({ this._containerSelector = containerSelector; this._className = className; if (toggleButtonSelector) { - this.toggleButtonSelector = toggleButtonSelector; + this._toggleButtonSelector = toggleButtonSelector; } // initialize proxy @@ -1870,7 +1870,8 @@ WCF.Action.Toggle = Class.extend({ this.proxy = new WCF.Action.Proxy(options); // bind event listener - WCF.DOMNodeInsertedHandler.addCallback('WCF.Action.Delete' + this._className.hashCode(), $.proxy(this._initElements, this)); + this._initElements(); + WCF.DOMNodeInsertedHandler.addCallback('WCF.Action.Toggle' + this._className.hashCode(), $.proxy(this._initElements, this)); }, /** @@ -1883,7 +1884,7 @@ WCF.Action.Toggle = Class.extend({ if (!WCF.inArray($containerID, this._containers)) { this._containers.push($containerID); - $container.find('.jsDeleteButton').click($.proxy(this._click, this)); + $container.find(this._toggleButtonSelector).click($.proxy(this._click, this)); } }, this)); }, @@ -1923,7 +1924,7 @@ WCF.Action.Toggle = Class.extend({ triggerEffect: function(objectIDs) { for (var $index in this._containers) { var $container = $('#' + this._containers[$index]); - var $toggleButton = $container.find(this.toggleButtonSelector); + var $toggleButton = $container.find(this. _toggleButtonSelector); if (WCF.inArray($toggleButton.data('objectID'), objectIDs)) { $container.wcfHighlight(); this._toggleButton($container, $toggleButton); -- 2.20.1