optimize a bit navigation in artifact detail tabs when not recalculating when content is available

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1371488 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-08-09 21:13:00 +00:00
parent 2856b95c76
commit a0903fa853
2 changed files with 26 additions and 12 deletions

View File

@ -244,13 +244,25 @@ function() {
goToBrowseArtifactDetail(groupId,artifactId,repositoryId);//,null,null);
return;
});
var checkArtifactDetailContent=function(groupId,artifactId,version,repositoryId,tabToActivate){
// no need to recalculate all stuff just activate the tab
if($("#browse_artifact_detail" ).html()!=null){
if( $.trim($("#browse_artifact_detail" ).html().length)>0){
$("#main-content #"+tabToActivate).tab('show')
return;
}
}
generalDisplayArtifactDetailsVersionView(groupId,artifactId,version,repositoryId,function(){$("#main-content #"+tabToActivate).tab('show')});
}
this.get('#artifact/: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);
checkArtifactDetailContent(groupId,artifactId,version,repositoryId,"artifact-details-info-content-a");
});
this.get('#artifact~:repositoryId/:groupId/:artifactId/:version',function(context){
@ -258,7 +270,7 @@ function() {
var groupId= this.params.groupId;
var artifactId= this.params.artifactId;
var version= this.params.version;
generalDisplayArtifactDetailsVersionView(groupId,artifactId,version,repositoryId);
checkArtifactDetailContent(groupId,artifactId,version,repositoryId,"artifact-details-info-content-a");
});
this.get('#artifact-dependencies/:groupId/:artifactId/:version',function(context){
@ -267,7 +279,8 @@ function() {
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')});
checkArtifactDetailContent(groupId,artifactId,version,repositoryId,"artifact-details-dependencies-content-a");
});
@ -277,8 +290,7 @@ function() {
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')});
checkArtifactDetailContent(groupId,artifactId,version,repositoryId,"artifact-details-dependencies-content-a");
});
@ -288,8 +300,7 @@ function() {
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-dependency-tree-content-a").tab('show')});
checkArtifactDetailContent(groupId,artifactId,version,repositoryId,"artifact-details-dependency-tree-content-a");
});
this.get('#artifact-dependency-tree~:repositoryId/:groupId/:artifactId/:version',function(context){
@ -298,8 +309,7 @@ function() {
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-dependency-tree-content-a").tab('show')});
checkArtifactDetailContent(groupId,artifactId,version,repositoryId,"artifact-details-dependency-tree-content-a");
});

View File

@ -193,8 +193,12 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno
this.repositoryId=repositoryId;
displayGroupId=function(groupId){
displayGroupDetail(groupId,null);
}
var location ="#browse";
if (self.repositoryId){
location+="~"+self.repositoryId;
}
location+="/"+groupId;
window.sammyArchivaApplication.setLocation(location); }
displayParent=function(){
var selectedRepo=getSelectedBrowsingRepository();
@ -302,7 +306,7 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno
return;
}
if ($(e.target).attr("href")=="#artifact-details-used-by-content") {
if ($(e.target).attr("data-target")=="#artifact-details-used-by-content") {
var dependeesContentDiv=mainContent.find("#artifact-details-used-by-content" );
if( $.trim(dependeesContentDiv.html()).length<1){
dependeesContentDiv.html(mediumSpinnerImg());