support naviguation when browsing artifact, route: '#artifact/:groupId/:artifactId'

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1370413 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-08-07 18:13:18 +00:00
parent e0ddc83e6c
commit 71f820dedf
2 changed files with 63 additions and 31 deletions

View File

@ -204,6 +204,15 @@ function() {
goToBrowseArtifactDetail(groupId,artifactId);//,null,null); goToBrowseArtifactDetail(groupId,artifactId);//,null,null);
return; return;
});
this.get('#artifact~:repositoryId/:groupId/:artifactId',function(context){
var groupId= this.params.groupId;
var artifactId= this.params.artifactId;
var repositoryId = this.params.repositoryId;
$.log("get #artifact:"+groupId+":"+artifactId);
goToBrowseArtifactDetail(groupId,artifactId,repositoryId);//,null,null);
return;
}); });
this.get('#artifact/:groupId/:artifactId/:version',function(context){ this.get('#artifact/:groupId/:artifactId/:version',function(context){

View File

@ -154,6 +154,16 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno
artifactVersionDetailViewModel.display(); artifactVersionDetailViewModel.display();
} }
displayGroupId=function(groupId){
var selectedRepo=getSelectedBrowsingRepository();
var location ="#browse";
if (selectedRepo){
location+="~"+selectedRepo;
}
location+="/"+groupId;
window.sammyArchivaApplication.setLocation(location);
}
} }
displayArtifactVersionDetailViewModel=function(groupId,artifactId,version){ displayArtifactVersionDetailViewModel=function(groupId,artifactId,version){
@ -598,10 +608,10 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno
artifactVersionDetailViewModel.display(); artifactVersionDetailViewModel.display();
} }
goToBrowseArtifactDetail=function(groupId, artifactId){ goToBrowseArtifactDetail=function(groupId, artifactId,repositoryId){
$.log("goToBrowseArtifactDetail:"+groupId+":"+artifactId); $.log("goToBrowseArtifactDetail:"+groupId+":"+artifactId);
displayBrowseGroupId(groupId,null,null); //displayBrowseGroupId(groupId,null,null);
displayArtifactDetail(groupId,artifactId,null,null); displayArtifactDetail(groupId,artifactId,null,null,repositoryId);
} }
/** /**
@ -636,10 +646,22 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno
* @param parentBrowseViewModel * @param parentBrowseViewModel
* @param restUrl * @param restUrl
*/ */
displayArtifactDetail=function(groupId,artifactId,parentBrowseViewModel,restUrl){ displayArtifactDetail=function(groupId,artifactId,parentBrowseViewModel,restUrl,repositoryId){
$.log("displayArtifactDetail:"+groupId+":"+artifactId); $.log("displayArtifactDetail:"+groupId+":"+artifactId);
var artifactDetailViewModel=new ArtifactDetailViewModel(groupId,artifactId); var artifactDetailViewModel=new ArtifactDetailViewModel(groupId,artifactId);
var mainContent = $("#main-content"); var mainContent = $("#main-content");
mainContent.html($("#browse-tmpl" ).tmpl());
userRepositoriesCall(
function(data){
if(repositoryId){
mainContent.find("#selected_repository" ).html($("#selected_repository_tmpl" ).tmpl({repositories:data,selected:repositoryId}));
} else {
mainContent.find("#selected_repository" ).html($("#selected_repository_tmpl" ).tmpl({repositories:data,selected:''}));
}
mainContent.find("#browse_artifact_detail" ).hide(); mainContent.find("#browse_artifact_detail" ).hide();
mainContent.find("#browse_result").hide(); mainContent.find("#browse_result").hide();
mainContent.find("#main_browse_result_content").hide("slide", {}, 300,function(){ mainContent.find("#main_browse_result_content").hide("slide", {}, 300,function(){
@ -666,12 +688,14 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno
artifactDetailViewModel.versions=mapVersionsList(data); artifactDetailViewModel.versions=mapVersionsList(data);
ko.applyBindings(artifactDetailViewModel,mainContent.find("#browse_artifact").get(0)); ko.applyBindings(artifactDetailViewModel,mainContent.find("#browse_artifact").get(0));
ko.applyBindings(artifactDetailViewModel,mainContent.find("#browse_breadcrumb").get(0)); ko.applyBindings(artifactDetailViewModel,mainContent.find("#browse_breadcrumb").get(0));
}
});
}
});
});
}
});
}
});
}); });
} }
browseRoot=function(){ browseRoot=function(){
@ -847,7 +871,6 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno
} }
location+="/"+ui.item.name; location+="/"+ui.item.name;
window.sammyArchivaApplication.setLocation(location); window.sammyArchivaApplication.setLocation(location);
//displayBrowseGroupIdFromAutoComplete(ui.item.name);
} }
return false; return false;
} }