]> source.dussan.org Git - archiva.git/commitdiff
use navigation when browsing with autocomplete
authorOlivier Lamy <olamy@apache.org>
Tue, 7 Aug 2012 18:13:05 +0000 (18:13 +0000)
committerOlivier Lamy <olamy@apache.org>
Tue, 7 Aug 2012 18:13:05 +0000 (18:13 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1370412 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 01cf81717d1b50c555ecb72341bb5a83961da82b..fa72b4b27cd7545962a6f35ba7b36a12ca58aa9f 100644 (file)
@@ -205,18 +205,14 @@ function() {
           return;
 
         });
-        this.get('#artifact:repositoryId/:groupId/:artifactId/:version',function(context){
+        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);
 
-          if(!version){
-            displayBrowseArtifactDetail(splitted[0],splitted[1]);//,null,null);
-          } else {
-            generalDisplayArtifactDetailsVersionView(groupId,artifactId,version,repositoryId);
-          }
         });
         this.get('#browse/:groupId',function(context){
           var groupId = this.params.groupId;
index 00219e70fe7390c9a0c5213377fbcd7b9cec69f6..be9d585cacf2c69819dc5e81dfdc412703a79c88 100644 (file)
@@ -598,6 +598,37 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno
     artifactVersionDetailViewModel.display();
   }
 
+  goToBrowseArtifactDetail=function(groupId, artifactId){
+    $.log("goToBrowseArtifactDetail:"+groupId+":"+artifactId);
+    displayBrowseGroupId(groupId,null,null);
+    displayArtifactDetail(groupId,artifactId,null,null);
+  }
+
+  /**
+   *
+   */
+  displayBrowseGroupId=function(groupId,repositoryId,artifactId){
+    clearUserMessages();
+    $.log("displayBrowseGroupId:"+groupId+":"+repositoryId);
+    userRepositoriesCall(
+        function(data){
+          var mainContent = $("#main-content");
+          mainContent.html($("#browse-tmpl" ).tmpl());
+          mainContent.find("#browse_result").html(mediumSpinnerImg());
+          var parentBrowseViewModel=new BrowseViewModel(null,null,null,repositoryId);
+          var url="restServices/archivaServices/browseService/browseGroupId/"+encodeURIComponent(groupId);
+          if (repositoryId){
+            url+="?repositoryId="+repositoryId;
+            mainContent.find("#selected_repository" ).html($("#selected_repository_tmpl" ).tmpl({repositories:data,selected:repositoryId}));
+          }else{
+            mainContent.find("#selected_repository" ).html($("#selected_repository_tmpl" ).tmpl({repositories:data,selected:""}));
+          }
+          displayGroupDetail(groupId,parentBrowseViewModel,url,repositoryId);
+        }
+    );
+
+  }
+
   /**
    *
    * @param groupId
@@ -606,6 +637,7 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno
    * @param restUrl
    */
   displayArtifactDetail=function(groupId,artifactId,parentBrowseViewModel,restUrl){
+    $.log("displayArtifactDetail:"+groupId+":"+artifactId);
     var artifactDetailViewModel=new ArtifactDetailViewModel(groupId,artifactId);
     var mainContent = $("#main-content");
     mainContent.find("#browse_artifact_detail" ).hide();
@@ -808,7 +840,14 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno
           var artifactId=values[values.length-1];
           displayArtifactDetail(groupId,artifactId,self);
         } else {
-          displayBrowseGroupIdFromAutoComplete(ui.item.name);
+          var selectedRepo=getSelectedBrowsingRepository();
+          var location ="#browse";
+          if (selectedRepo){
+            location+="~"+selectedRepo;
+          }
+          location+="/"+ui.item.name;
+          window.sammyArchivaApplication.setLocation(location);
+          //displayBrowseGroupIdFromAutoComplete(ui.item.name);
         }
         return false;
       }
@@ -832,43 +871,11 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno
     displayGroupDetail(groupId,parentBrowseViewModel,null);
   }
 
-  /**
-   * called if browser url contains queryParam browse=groupId
-   * @param groupId
-   */
-  displayBrowseGroupId=function(groupId,repositoryId){
-    clearUserMessages();
-    $.log("displayBrowseGroupId:"+groupId+":"+repositoryId);
-    userRepositoriesCall(
-        function(data){
-          var mainContent = $("#main-content");
-          mainContent.html($("#browse-tmpl" ).tmpl());
-          mainContent.find("#browse_result").html(mediumSpinnerImg());
-          var parentBrowseViewModel=new BrowseViewModel(null,null,null,repositoryId);
-          var url="restServices/archivaServices/browseService/browseGroupId/"+encodeURIComponent(groupId);
-          if (repositoryId){
-            url+="?repositoryId="+repositoryId;
-            mainContent.find("#selected_repository" ).html($("#selected_repository_tmpl" ).tmpl({repositories:data,selected:repositoryId}));
-          }else{
-            mainContent.find("#selected_repository" ).html($("#selected_repository_tmpl" ).tmpl({repositories:data,selected:""}));
-          }
-          displayGroupDetail(groupId,parentBrowseViewModel,url,repositoryId);
-        }
-    );
-
-  }
-
   displayBrowseArtifactDetail=function(groupId, artifactId){
     $.log("displayBrowseArtifactDetail");
     window.sammyArchivaApplication.setLocation("#artifact/"+groupId+"/"+artifactId);
   }
 
-  goToBrowseArtifactDetail=function(groupId, artifactId){
-    $.log("displayBrowseArtifactDetail");
-    displayBrowseGroupId(groupId);
-    displayArtifactDetail(groupId,artifactId,null,null);
-  }
-
   mapBrowseResultEntries=function(data){
     $.log("mapBrowseResultEntries");
     if (data.browseResultEntries) {