]> source.dussan.org Git - archiva.git/commitdiff
reuse selector if possible
authorOlivier Lamy <olamy@apache.org>
Mon, 19 Nov 2012 15:34:38 +0000 (15:34 +0000)
committerOlivier Lamy <olamy@apache.org>
Mon, 19 Nov 2012 15:34:38 +0000 (15:34 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1411249 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/proxy-connectors-rules.js
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/repository-groups.js

index 6d2cb01792ae5d42b5d77b70cceecda705b5f7a8..5ce7afb10f173f900b30c2062d8b44acaf5c70e7 100644 (file)
@@ -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){
index 3a23be42ef7bd39176c8368df507faa32eef5ede..0f07f35eb97b49f2ee6f2190d8783682d6b75a14 100644 (file)
@@ -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);
     }