history navigation when seeing artifact dependencies

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1371485 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-08-09 21:12:11 +00:00
parent 2284bc1635
commit 3b0eb2985c
3 changed files with 40 additions and 9 deletions

View File

@ -243,7 +243,6 @@ function() {
$.log("get #artifact:"+groupId+":"+artifactId); $.log("get #artifact:"+groupId+":"+artifactId);
goToBrowseArtifactDetail(groupId,artifactId,repositoryId);//,null,null); goToBrowseArtifactDetail(groupId,artifactId,repositoryId);//,null,null);
return; return;
}); });
this.get('#artifact/:groupId/:artifactId/:version',function(context){ this.get('#artifact/:groupId/:artifactId/:version',function(context){
@ -252,7 +251,6 @@ function() {
var artifactId= this.params.artifactId; var artifactId= this.params.artifactId;
var version= this.params.version; var version= this.params.version;
generalDisplayArtifactDetailsVersionView(groupId,artifactId,version,repositoryId); generalDisplayArtifactDetailsVersionView(groupId,artifactId,version,repositoryId);
}); });
this.get('#artifact~:repositoryId/:groupId/:artifactId/:version',function(context){ this.get('#artifact~:repositoryId/:groupId/:artifactId/:version',function(context){
@ -261,8 +259,28 @@ function() {
var artifactId= this.params.artifactId; var artifactId= this.params.artifactId;
var version= this.params.version; var version= this.params.version;
generalDisplayArtifactDetailsVersionView(groupId,artifactId,version,repositoryId); generalDisplayArtifactDetailsVersionView(groupId,artifactId,version,repositoryId);
});
this.get('#artifact-dependencies/:groupId/:artifactId/:version',function(context){
var repositoryId = this.params.repositoryId;
var groupId= this.params.groupId;
var artifactId= this.params.artifactId;
var version= this.params.version;
generalDisplayArtifactDetailsVersionView(groupId,artifactId,version,repositoryId,function(){$("#main-content #artifact-details-dependencies-content-a").tab('show')});
}); });
this.get('#artifact-dependencies~:repositoryId/:groupId/:artifactId/:version',function(context){
var repositoryId = this.params.repositoryId;
var groupId= this.params.groupId;
var artifactId= this.params.artifactId;
var version= this.params.version;
generalDisplayArtifactDetailsVersionView(groupId,artifactId,version,repositoryId,function(){$("#main-content #artifact-details-dependencies-content-a").tab('show')});
});
this.get('#browse/:groupId',function(context){ this.get('#browse/:groupId',function(context){
var groupId = this.params.groupId; var groupId = this.params.groupId;
if (groupId){ if (groupId){

View File

@ -219,9 +219,10 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno
return entries; return entries;
} }
this.display=function(){ this.display=function(afterCallbackFn){
mainContent.find("#browse_breadcrumb").hide("slide", {}, 300,function(){ mainContent.find("#browse_breadcrumb").hide("slide", {}, 300,function(){
mainContent.find("#browse_artifact").hide("slide", {}, 300,function(){ mainContent.find("#browse_artifact").hide("slide", {}, 300,function(){
mainContent.find("#browse_artifact_detail").show(); mainContent.find("#browse_artifact_detail").show();
mainContent.find("#browse_artifact_detail").html(mediumSpinnerImg()); mainContent.find("#browse_artifact_detail").html(mediumSpinnerImg());
mainContent.find("#browse_breadcrumb" ).show(); mainContent.find("#browse_breadcrumb" ).show();
@ -244,6 +245,16 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno
mainContent.find("#browse-autocomplete-divider" ).hide(); mainContent.find("#browse-autocomplete-divider" ).hide();
mainContent.find("#artifact-details-tabs").on('show', function (e) { mainContent.find("#artifact-details-tabs").on('show', function (e) {
if ($(e.target).attr("data-target")=="#artifact-details-dependencies-content") {
var location ="#artifact-dependencies";
if (self.repositoryId){
location+="~"+self.repositoryId;
}
location+="/"+self.groupId+"/"+self.artifactId+"/"+self.version;
window.sammyArchivaApplication.setLocation(location);
}
if ($(e.target).attr("href")=="#artifact-details-dependency-tree-content") { if ($(e.target).attr("href")=="#artifact-details-dependency-tree-content") {
var treeContentDiv=mainContent.find("#artifact-details-dependency-tree-content" ); var treeContentDiv=mainContent.find("#artifact-details-dependency-tree-content" );
if( $.trim(treeContentDiv.html()).length<1){ if( $.trim(treeContentDiv.html()).length<1){
@ -328,7 +339,11 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno
displayArtifactFilesContent(self); displayArtifactFilesContent(self);
} }
}); });
if(afterCallbackFn){
afterCallbackFn();
}
} }
}); });
}); });
@ -486,8 +501,6 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno
$.i18n.prop('artifact.delete.confirm.title'), $.i18n.prop('artifact.delete.confirm.title'),
$.i18n.prop('artifact.delete.confirm.save')); $.i18n.prop('artifact.delete.confirm.save'));
} }
this.deleteKarma = hasKarma('archiva-delete-artifact'); this.deleteKarma = hasKarma('archiva-delete-artifact');
@ -1481,7 +1494,7 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno
} }
} }
generalDisplayArtifactDetailsVersionView=function(groupId,artifactId,version,repositoryId){ generalDisplayArtifactDetailsVersionView=function(groupId,artifactId,version,repositoryId,afterCallbackFn){
var mainContent=$("#main-content"); var mainContent=$("#main-content");
mainContent.html($("#browse-tmpl" ).tmpl()); mainContent.html($("#browse-tmpl" ).tmpl());
mainContent.find("#browse_result" ).hide(); mainContent.find("#browse_result" ).hide();
@ -1494,7 +1507,7 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno
function(data) { function(data) {
mainContent.find("#selected_repository" ).html($("#selected_repository_tmpl" ).tmpl({repositories:data,selected:repositoryId})); mainContent.find("#selected_repository" ).html($("#selected_repository_tmpl" ).tmpl({repositories:data,selected:repositoryId}));
var artifactVersionDetailViewModel=new ArtifactVersionDetailViewModel(groupId,artifactId,version,repositoryId); var artifactVersionDetailViewModel=new ArtifactVersionDetailViewModel(groupId,artifactId,version,repositoryId);
artifactVersionDetailViewModel.display(); artifactVersionDetailViewModel.display(afterCallbackFn);
} }
); );

View File

@ -429,10 +429,10 @@
<a data-toggle="tab" href="#artifact-details-info-content">${$.i18n.prop('artifact.detail.tab.header.info')}</a> <a data-toggle="tab" href="#artifact-details-info-content">${$.i18n.prop('artifact.detail.tab.header.info')}</a>
</li> </li>
<li> <li>
<a data-toggle="tab" href="#artifact-details-dependencies-content">${$.i18n.prop('artifact.detail.tab.header.dependencies')}</a> <a data-toggle="tab" id="artifact-details-dependencies-content-a" data-target="#artifact-details-dependencies-content" href="#artifact-details-dependencies-content">${$.i18n.prop('artifact.detail.tab.header.dependencies')}</a>
</li> </li>
<li> <li>
<a data-toggle="tab" href="#artifact-details-dependency-tree-content">${$.i18n.prop('artifact.detail.tab.header.dependency.tree')}</a> <a data-toggle="tab" id="artifact-details-dependency-tree-content-a" data-target="#artifact-details-dependency-tree-content" href="#artifact-details-dependency-tree-content">${$.i18n.prop('artifact.detail.tab.header.dependency.tree')}</a>
</li> </li>
<li> <li>
<a data-toggle="tab" href="#artifact-details-files-content">${$.i18n.prop('artifact.detail.tab.header.file.content')}</a> <a data-toggle="tab" href="#artifact-details-files-content">${$.i18n.prop('artifact.detail.tab.header.file.content')}</a>