]> source.dussan.org Git - archiva.git/commitdiff
browsing download artifacts content is now navigable
authorOlivier Lamy <olamy@apache.org>
Tue, 28 Aug 2012 09:08:01 +0000 (09:08 +0000)
committerOlivier Lamy <olamy@apache.org>
Tue, 28 Aug 2012 09:08:01 +0000 (09:08 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1378030 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 b55de7d8dcdd5893c95b2e049d3fd396af80a285..16e18e79c2763109c3708db19c8c852d555bf41a 100644 (file)
@@ -393,6 +393,32 @@ function(jquery,ui,sammy,tmpl) {
         });
 
 
+        this.get('#artifact-details-download-content/: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;
+
+          checkArtifactDetailContent(groupId,artifactId,version,null,"artifact-details-download-content-a","artifact-details-download-content",
+                                     function(groupId,artifactId,version,artifactVersionDetailViewModel){
+                                       displayArtifactDownloadContent(artifactVersionDetailViewModel);
+                                     });
+
+        });
+
+        this.get('#artifact-details-download-content~: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;
+          checkArtifactDetailContent(groupId,artifactId,version,repositoryId,"artifact-details-download-content-a","artifact-details-download-content",
+                                     function(groupId,artifactId,version,artifactVersionDetailViewModel){
+                                       displayArtifactDownloadContent(artifactVersionDetailViewModel);
+                                     });
+        });
+
 
         this.get('#artifact-dependency-tree/:groupId/:artifactId/:version',function(context){
 
index 880b12a893565dec4462fce6cc30a4264ecc2136..cc19e38d7a807259cc73c2e1d4ca01531a4b4cec 100644 (file)
@@ -329,19 +329,16 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno
                 }
 
                 if ($(e.target).attr("href")=="#artifact-details-download-content") {
-                  mainContent.find("#artifact-details-download-content" ).html(smallSpinnerImg());
-                  var artifactDownloadInfosUrl = "restServices/archivaServices/browseService/artifactDownloadInfos/"+encodeURIComponent(self.groupId);
-                  artifactDownloadInfosUrl+="/"+encodeURIComponent(self.artifactId)+"/"+encodeURIComponent(self.version);
-                  artifactDownloadInfosUrl+="?repositoryId="+encodeURIComponent(getSelectedBrowsingRepository());
-                  $.get(artifactDownloadInfosUrl,function(data){
-                    var artifactDetailsDownloadViewModel = new ArtifactDetailsDownloadViewModel(mapArtifacts(data),self);
-                    mainContent.find("#artifact-details-download-content" ).attr("data-bind",'template:{name:"artifact-details-download-content_tmpl"}');
-                    ko.applyBindings(artifactDetailsDownloadViewModel,mainContent.find("#artifact-details-download-content" ).get(0));
-                  });
+                  var location ="#artifact-details-download-content";
+                  if (self.repositoryId){
+                    location+="~"+self.repositoryId;
+                  }
+                  location+="/"+self.groupId+"/"+self.artifactId+"/"+self.version;
+
+                  window.sammyArchivaApplication.setLocation(location);
                   return;
                 }
                 if ($(e.target).attr("href")=="#artifact-details-files-content") {
-                  //displayArtifactFilesContent(self);
                   var location ="#artifact-details-files-content";
                   if (self.repositoryId){
                     location+="~"+self.repositoryId;
@@ -520,11 +517,25 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno
 
   }
 
-  displayArtifactFilesContent=function(self){
+  displayArtifactDownloadContent=function(artifactVersionDetailViewModel){
+    var mainContent=$("#main-content");
+    mainContent.find("#artifact-details-download-content" ).html(smallSpinnerImg());
+    var artifactDownloadInfosUrl = "restServices/archivaServices/browseService/artifactDownloadInfos/"+encodeURIComponent(artifactVersionDetailViewModel.groupId);
+    artifactDownloadInfosUrl+="/"+encodeURIComponent(artifactVersionDetailViewModel.artifactId)+"/"+encodeURIComponent(artifactVersionDetailViewModel.version);
+    artifactDownloadInfosUrl+="?repositoryId="+encodeURIComponent(getSelectedBrowsingRepository());
+    $.get(artifactDownloadInfosUrl,function(data){
+      var artifactDetailsDownloadViewModel = new ArtifactDetailsDownloadViewModel(mapArtifacts(data),artifactVersionDetailViewModel);
+      mainContent.find("#artifact-details-download-content" ).attr("data-bind",'template:{name:"artifact-details-download-content_tmpl"}');
+      ko.applyBindings(artifactDetailsDownloadViewModel,mainContent.find("#artifact-details-download-content" ).get(0));
+    });
+    return;
+  }
+
+  displayArtifactFilesContent=function(artifactVersionDetailViewModel){
     var mainContent = $("#main-content");
     mainContent.find("#artifact-details-files-content" ).html(smallSpinnerImg());
-    var artifactDownloadInfosUrl = "restServices/archivaServices/browseService/artifactDownloadInfos/"+encodeURIComponent(self.groupId);
-    artifactDownloadInfosUrl+="/"+encodeURIComponent(self.artifactId)+"/"+encodeURIComponent(self.version);
+    var artifactDownloadInfosUrl = "restServices/archivaServices/browseService/artifactDownloadInfos/"+encodeURIComponent(artifactVersionDetailViewModel.groupId);
+    artifactDownloadInfosUrl+="/"+encodeURIComponent(artifactVersionDetailViewModel.artifactId)+"/"+encodeURIComponent(artifactVersionDetailViewModel.version);
     artifactDownloadInfosUrl+="?repositoryId="+encodeURIComponent(getSelectedBrowsingRepository());
 
     $.get(artifactDownloadInfosUrl,function(data){
@@ -542,8 +553,8 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno
         $.log("click:" + idValue + " -> " + classifier + ":" + type + ":" + version);
         if (type=="pom"){
           $.log("show pom");
-          var pomContentUrl = "restServices/archivaServices/browseService/artifactContentText/"+encodeURIComponent(self.groupId);
-          pomContentUrl+="/"+encodeURIComponent(self.artifactId)+"/"+encodeURIComponent(version);
+          var pomContentUrl = "restServices/archivaServices/browseService/artifactContentText/"+encodeURIComponent(artifactVersionDetailViewModel.groupId);
+          pomContentUrl+="/"+encodeURIComponent(artifactVersionDetailViewModel.artifactId)+"/"+encodeURIComponent(version);
           pomContentUrl+="?repositoryId="+encodeURIComponent(getSelectedBrowsingRepository());
           pomContentUrl+="&t=pom";
           mainContent.find("#artifact-content-text" ).html(smallSpinnerImg());
@@ -559,8 +570,8 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno
           });
           return;
         }
-        var entriesUrl = "restServices/archivaServices/browseService/artifactContentEntries/"+encodeURIComponent(self.groupId);
-        entriesUrl+="/"+encodeURIComponent(self.artifactId)+"/"+encodeURIComponent(version);
+        var entriesUrl = "restServices/archivaServices/browseService/artifactContentEntries/"+encodeURIComponent(artifactVersionDetailViewModel.groupId);
+        entriesUrl+="/"+encodeURIComponent(artifactVersionDetailViewModel.artifactId)+"/"+encodeURIComponent(version);
         entriesUrl+="?repositoryId="+encodeURIComponent(getSelectedBrowsingRepository());
         if(classifier){
           entriesUrl+="&c="+encodeURIComponent(classifier);
@@ -570,8 +581,8 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno
           root: ""
                  },function(file) {
             $.log("file:"+file.substringBeforeLast("/")+',classifier:'+classifier);
-            var fileContentUrl = "restServices/archivaServices/browseService/artifactContentText/"+encodeURIComponent(self.groupId);
-            fileContentUrl+="/"+encodeURIComponent(self.artifactId)+"/"+encodeURIComponent(version);
+            var fileContentUrl = "restServices/archivaServices/browseService/artifactContentText/"+encodeURIComponent(artifactVersionDetailViewModel.groupId);
+            fileContentUrl+="/"+encodeURIComponent(artifactVersionDetailViewModel.artifactId)+"/"+encodeURIComponent(version);
             fileContentUrl+="?repositoryId="+encodeURIComponent(getSelectedBrowsingRepository());
             if(type){
               fileContentUrl+="&t="+encodeURIComponent(type);