]> source.dussan.org Git - archiva.git/commitdiff
optimize a bit navigation in artifact detail tabs when not recalculating when content...
authorOlivier Lamy <olamy@apache.org>
Thu, 9 Aug 2012 21:13:00 +0000 (21:13 +0000)
committerOlivier Lamy <olamy@apache.org>
Thu, 9 Aug 2012 21:13:00 +0000 (21:13 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1371488 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js

index a6dbf99a9588a2c191aebc53604c587102766556..e9f4be3168d6eb294dea5d2f8616f8db42f04085 100644 (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");
         });
 
 
index 4fde6daee1d4de0440f9f319e3648f5d6cf1a40a..f1b6b1be588be0c0e76fa384fb52e95a9cd793b0 100644 (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());