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,39 +507,39 @@ 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());
var dependeesUrl="restServices/archivaServices/browseService/dependees/"+encodeURIComponent(groupId); dependeesContentDiv.append(mediumSpinnerImg());
dependeesUrl+="/"+encodeURIComponent(artifactId); var dependeesUrl="restServices/archivaServices/browseService/dependees/"+encodeURIComponent(groupId);
dependeesUrl+="/"+encodeURIComponent(version); dependeesUrl+="/"+encodeURIComponent(artifactId);
var selectedRepo=getSelectedBrowsingRepository(); dependeesUrl+="/"+encodeURIComponent(version);
if (selectedRepo){ var selectedRepo=getSelectedBrowsingRepository();
dependeesUrl+="?repositoryId="+encodeURIComponent(selectedRepo); if (selectedRepo){
dependeesUrl+="?repositoryId="+encodeURIComponent(selectedRepo);
}
$.ajax(dependeesUrl, {
type: "GET",
dataType: 'json',
success: function(data) {
var artifacts=mapArtifacts(data);
var gridViewModel = new ko.simpleGrid.viewModel({
data: artifacts,
columns: [],
pageSize: 7,
gridUpdateCallBack: function(){
// no op
}
});
$.log("artifacts:"+artifacts.length);
dependeesTable.attr("data-bind",
"simpleGrid: gridViewModel,simpleGridTemplate:'dependees_tmpl',pageLinksId:'usedbyPagination',data:'artifacts'");
ko.applyBindings({artifacts:artifacts,gridViewModel:gridViewModel},dependeesContentDiv.get(0));
},
complete: function(){
removeMediumSpinnerImg(("#artifact-details-used-by-content"));
} }
$.ajax(dependeesUrl, { });
type: "GET",
dataType: 'json',
success: function(data) {
var artifacts=mapArtifacts(data);
//dependeesContentDiv.html($("#dependees_tmpl").tmpl({artifacts: artifacts}));
var gridViewModel = new ko.simpleGrid.viewModel({
data: artifacts,
columns: [],
pageSize: 7,
gridUpdateCallBack: function(){
// no op
}
});
$.log("artifacts:"+artifacts.length);
dependeesContentDiv.find("#artifact-usedby-table").attr("data-bind",
"simpleGrid: gridViewModel,simpleGridTemplate:'dependees_tmpl',pageLinksId:'usedbyPagination',data:'artifacts'");
ko.applyBindings({artifacts:artifacts,gridViewModel:gridViewModel},dependeesContentDiv.get(0));
},
complete: function(){
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()}}