reuse selector if possible

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1411249 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-11-19 15:34:38 +00:00
parent 1cfab8837f
commit b74dfd1513
2 changed files with 9 additions and 7 deletions

View 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){

View 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);
}