]> source.dussan.org Git - archiva.git/commitdiff
history navigation when seeing artifact dependencies
authorOlivier Lamy <olamy@apache.org>
Thu, 9 Aug 2012 21:12:11 +0000 (21:12 +0000)
committerOlivier Lamy <olamy@apache.org>
Thu, 9 Aug 2012 21:12:11 +0000 (21:12 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1371485 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
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/search.html

index 1cfb929a16f14c389c0f4087791e416296f92fdb..d429e96f6038e632396d633cb673faebac9ea34a 100644 (file)
@@ -243,7 +243,6 @@ function() {
           $.log("get #artifact:"+groupId+":"+artifactId);
           goToBrowseArtifactDetail(groupId,artifactId,repositoryId);//,null,null);
           return;
-
         });
         this.get('#artifact/:groupId/:artifactId/:version',function(context){
 
@@ -252,7 +251,6 @@ function() {
           var artifactId= this.params.artifactId;
           var version= this.params.version;
           generalDisplayArtifactDetailsVersionView(groupId,artifactId,version,repositoryId);
-
         });
         this.get('#artifact~:repositoryId/:groupId/:artifactId/:version',function(context){
 
@@ -261,8 +259,28 @@ function() {
           var artifactId= this.params.artifactId;
           var version= this.params.version;
           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){
           var groupId = this.params.groupId;
           if (groupId){
index 7606ddb60d342c3fa409bbe03cdc4f67a7d9bd64..7874b1322b6c2aedb3e18809eacb4ac6da0c69a0 100644 (file)
@@ -219,9 +219,10 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno
       return entries;
     }
 
-    this.display=function(){
+    this.display=function(afterCallbackFn){
       mainContent.find("#browse_breadcrumb").hide("slide", {}, 300,function(){
         mainContent.find("#browse_artifact").hide("slide", {}, 300,function(){
+
           mainContent.find("#browse_artifact_detail").show();
           mainContent.find("#browse_artifact_detail").html(mediumSpinnerImg());
           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("#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") {
                   var treeContentDiv=mainContent.find("#artifact-details-dependency-tree-content" );
                   if( $.trim(treeContentDiv.html()).length<1){
@@ -328,7 +339,11 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno
                   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.save'));
 
-
-
     }
 
     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");
     mainContent.html($("#browse-tmpl" ).tmpl());
     mainContent.find("#browse_result" ).hide();
@@ -1494,7 +1507,7 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno
       function(data) {
         mainContent.find("#selected_repository" ).html($("#selected_repository_tmpl" ).tmpl({repositories:data,selected:repositoryId}));
         var artifactVersionDetailViewModel=new ArtifactVersionDetailViewModel(groupId,artifactId,version,repositoryId);
-        artifactVersionDetailViewModel.display();
+        artifactVersionDetailViewModel.display(afterCallbackFn);
       }
     );
 
index 0b9183f53be79e230d9de304b37916b9fdf972c4..cdf46e64666822e76049d88caa47150b72bde2f9 100644 (file)
         <a data-toggle="tab" href="#artifact-details-info-content">${$.i18n.prop('artifact.detail.tab.header.info')}</a>
       </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>
-        <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>
         <a data-toggle="tab" href="#artifact-details-files-content">${$.i18n.prop('artifact.detail.tab.header.file.content')}</a>