]> source.dussan.org Git - archiva.git/commitdiff
correctly handle current groupId browsing when changing repositoryId.
authorOlivier Lamy <olamy@apache.org>
Sun, 29 Jul 2012 19:22:07 +0000 (19:22 +0000)
committerOlivier Lamy <olamy@apache.org>
Sun, 29 Jul 2012 19:22:07 +0000 (19:22 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1366909 13f79535-47bb-0310-9956-ffa450edef68

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/archiva/utils.js

index 435311f323f4c089687a1c6ebf32222df770d112..00219e70fe7390c9a0c5213377fbcd7b9cec69f6 100644 (file)
@@ -694,7 +694,13 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno
 
   changeBrowseRepository=function(){
     var selectedRepository=getSelectedBrowsingRepository();
-    window.sammyArchivaApplication.setLocation("#browse~"+selectedRepository);
+    // #browse~internal/org.apache.maven
+    var currentHash=window.location.hash;
+    var newLocation = "#browse~"+selectedRepository+currentHash.substringAfterFirst("/");
+    // do we have extra path after repository ?
+
+    $.log("changeBrowseRepository:"+newLocation);
+    window.sammyArchivaApplication.setLocation(newLocation);
   }
 
   getSelectedBrowsingRepository=function(){
index f9bc2687eedafbbcca7e581c084618c0f2301fa0..cbaeefd4f6a1fa1a9103bbef648e64abe3124a4a 100644 (file)
@@ -405,6 +405,18 @@ define("utils",["jquery","i18n","jquery.tmpl"], function() {
   String.prototype.substringAfterLast = function(str) {
     return this.substring(this.lastIndexOf(str)+1);
   }
+  /**
+   *
+   * @param str
+   * @return {String} if str not found return empty string
+   */
+  String.prototype.substringAfterFirst = function(str) {
+    var idx = this.indexOf(str);
+    if (idx<0){
+      return "";
+    }
+    return this.substring(idx);
+  }
 
   //-----------------------------------------
   // extends jquery tmpl to support var def