From b74dfd15132f058f48048e47f82ec2c90d91dd7c Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Mon, 19 Nov 2012 15:34:38 +0000 Subject: [PATCH] reuse selector if possible git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1411249 13f79535-47bb-0310-9956-ffa450edef68 --- .../main/webapp/js/archiva/proxy-connectors-rules.js | 11 ++++++----- .../src/main/webapp/js/archiva/repository-groups.js | 5 +++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/proxy-connectors-rules.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/proxy-connectors-rules.js index 6d2cb0179..5ce7afb10 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/proxy-connectors-rules.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/proxy-connectors-rules.js @@ -189,7 +189,6 @@ define("archiva.proxy-connectors-rules",["jquery","i18n","jquery.tmpl","bootstra this.availableProxyConnectors.id="availableProxyConnectors"; this.update=update; - $.each(this.proxyConnectorRulesViewModel.proxyConnectors(), function(idx, value) { //$.log(idx + ': ' + value.sourceRepoId() +":"+value.targetRepoId()); var available=true; @@ -230,10 +229,11 @@ define("archiva.proxy-connectors-rules",["jquery","i18n","jquery.tmpl","bootstra self.proxyConnectorRule.proxyConnectors.remove(proxyConnectorToRemove); self.availableProxyConnectors.push(proxyConnectorToRemove); $.log("size after:"+self.proxyConnectorRule.proxyConnectors().length); - $("#main-content" ).find("#proxy-connectors-rules-available-proxy-connectors" ).find("[data-source-repoId="+sourceRepoId+"][data-target-repoId="+targetRepoId+"]" ).on("click", function(){ + var mainContent=$("#main-content"); + mainContent.find("#proxy-connectors-rules-available-proxy-connectors" ).find("[data-source-repoId="+sourceRepoId+"][data-target-repoId="+targetRepoId+"]" ).on("click", function(){ self.removeAvailable(proxyConnectorRulesViewModel,$(this).attr("data-source-repoId"),$(this).attr("data-target-repoId")); }); - $("#main-content" ).find("#proxy-connectors-rules-edit-order-div" ).find("[data-source-repoId="+sourceRepoId+"][data-target-repoId="+targetRepoId+"]" ).off("click"); + mainContent.find("#proxy-connectors-rules-edit-order-div" ).find("[data-source-repoId="+sourceRepoId+"][data-target-repoId="+targetRepoId+"]" ).off("click"); } this.activateRemoveChoosen=function(proxyConnectorRulesViewModel){ @@ -257,10 +257,11 @@ define("archiva.proxy-connectors-rules",["jquery","i18n","jquery.tmpl","bootstra self.proxyConnectorRule.proxyConnectors.push(proxyConnectorToAdd); self.availableProxyConnectors.remove(proxyConnectorToAdd); $.log("size after:"+self.availableProxyConnectors().length); - $("#main-content" ).find("#proxy-connectors-rules-edit-order-div" ).find("[data-source-repoId="+sourceRepoId+"][data-target-repoId="+targetRepoId+"]" ).on("click", function(){ + var mainContent=$("#main-content"); + mainContent.find("#proxy-connectors-rules-edit-order-div" ).find("[data-source-repoId="+sourceRepoId+"][data-target-repoId="+targetRepoId+"]" ).on("click", function(){ self.removeChoosen(proxyConnectorRulesViewModel,$(this).attr("data-source-repoId"),$(this).attr("data-target-repoId")); }); - $("#main-content" ).find("#proxy-connectors-rules-available-proxy-connectors" ).find("[data-source-repoId="+sourceRepoId+"][data-target-repoId="+targetRepoId+"]" ).off("click"); + mainContent.find("#proxy-connectors-rules-available-proxy-connectors" ).find("[data-source-repoId="+sourceRepoId+"][data-target-repoId="+targetRepoId+"]" ).off("click"); } this.activateRemoveAvailable=function(proxyConnectorRulesViewModel){ diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/repository-groups.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/repository-groups.js index 3a23be42e..0f07f35eb 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/repository-groups.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/repository-groups.js @@ -61,8 +61,9 @@ function(jquery,i18n,jqueryTmpl,bootstrap,jqueryValidate,jqueryUi,ko) { } self.repositoryGroup.repositories(repositories); self.repositoryGroup.modified(true); - $("#main-content").find("#repository-groups-edit-available-repositories").find(".icon-plus-sign" ).off("click"); - $("#main-content").find("#repository-groups-edit-order-div").find(".icon-minus-sign" ).off("click"); + var mainContent=$("#main-content"); + mainContent.find("#repository-groups-edit-available-repositories").find(".icon-plus-sign" ).off("click"); + mainContent.find("#repository-groups-edit-order-div").find(".icon-minus-sign" ).off("click"); self.renderSortableAvailables(self.repositoryGroupsViewModel); self.renderSortableChoosed(self.repositoryGroupsViewModel); } -- 2.39.5