correctly handle current groupId browsing when changing repositoryId.

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1366909 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-07-29 19:22:07 +00:00
parent 0985ccf02a
commit 01e276a590
2 changed files with 19 additions and 1 deletions

View 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(){

View 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