reuse selectors

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1399603 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-10-18 12:17:12 +00:00
parent 97d3d2f5b0
commit 677802e378
2 changed files with 32 additions and 33 deletions

View File

@ -507,7 +507,8 @@ function(jquery,ui,sammy,tmpl,i18n,jqueryCookie,bootstrap,archivaSearch,jqueryVa
var calculateUsedBy=function(groupId,artifactId,version){ var calculateUsedBy=function(groupId,artifactId,version){
var dependeesContentDiv=$("#main-content" ).find("#artifact-details-used-by-content" ); var dependeesContentDiv=$("#main-content" ).find("#artifact-details-used-by-content" );
//if( $.trim(dependeesContentDiv.html()).length<1){ var dependeesTable=dependeesContentDiv.find("#artifact-usedby-table");
dependeesContentDiv.append(mediumSpinnerImg()); dependeesContentDiv.append(mediumSpinnerImg());
var dependeesUrl="restServices/archivaServices/browseService/dependees/"+encodeURIComponent(groupId); var dependeesUrl="restServices/archivaServices/browseService/dependees/"+encodeURIComponent(groupId);
dependeesUrl+="/"+encodeURIComponent(artifactId); dependeesUrl+="/"+encodeURIComponent(artifactId);
@ -521,7 +522,6 @@ function(jquery,ui,sammy,tmpl,i18n,jqueryCookie,bootstrap,archivaSearch,jqueryVa
dataType: 'json', dataType: 'json',
success: function(data) { success: function(data) {
var artifacts=mapArtifacts(data); var artifacts=mapArtifacts(data);
//dependeesContentDiv.html($("#dependees_tmpl").tmpl({artifacts: artifacts}));
var gridViewModel = new ko.simpleGrid.viewModel({ var gridViewModel = new ko.simpleGrid.viewModel({
data: artifacts, data: artifacts,
columns: [], columns: [],
@ -531,7 +531,7 @@ function(jquery,ui,sammy,tmpl,i18n,jqueryCookie,bootstrap,archivaSearch,jqueryVa
} }
}); });
$.log("artifacts:"+artifacts.length); $.log("artifacts:"+artifacts.length);
dependeesContentDiv.find("#artifact-usedby-table").attr("data-bind", dependeesTable.attr("data-bind",
"simpleGrid: gridViewModel,simpleGridTemplate:'dependees_tmpl',pageLinksId:'usedbyPagination',data:'artifacts'"); "simpleGrid: gridViewModel,simpleGridTemplate:'dependees_tmpl',pageLinksId:'usedbyPagination',data:'artifacts'");
ko.applyBindings({artifacts:artifacts,gridViewModel:gridViewModel},dependeesContentDiv.get(0)); ko.applyBindings({artifacts:artifacts,gridViewModel:gridViewModel},dependeesContentDiv.get(0));
}, },
@ -539,7 +539,7 @@ function(jquery,ui,sammy,tmpl,i18n,jqueryCookie,bootstrap,archivaSearch,jqueryVa
removeMediumSpinnerImg(("#artifact-details-used-by-content")); removeMediumSpinnerImg(("#artifact-details-used-by-content"));
} }
}); });
//}
}; };
this.get('#artifact-used-by/:groupId/:artifactId/:version',function(context){ this.get('#artifact-used-by/:groupId/:artifactId/:version',function(context){

View File

@ -775,7 +775,6 @@
</script> </script>
<script id="dependees_tmpl" type="text/html"> <script id="dependees_tmpl" type="text/html">
fooo
<ul> <ul>
{{each(i, artifact) itemsOnCurrentPage()}} {{each(i, artifact) itemsOnCurrentPage()}}