handle browsing via sammy so history works

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1359837 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-07-10 18:55:06 +00:00
parent 497c858bdc
commit f7f824b1b2
2 changed files with 11 additions and 9 deletions

View File

@ -65,12 +65,6 @@ function() {
return;
}
var browse = $.urlParam('browse');
if (browse){
displayBrowseGroupId(browse);
return;
}
var artifact= $.urlParam("artifact");
var repositoryId = $.urlParam("repositoryId");
// format groupId:artifactId org.apache.maven.plugins:maven-jar-plugin
@ -262,15 +256,23 @@ function() {
this.activeMenuId = ko.observable();
window.sammyArchivaApplication = Sammy(function () {
this.get('#browse/:groupId',function(context){
var groupId = this.params['groupId'];
if (groupId){
displayBrowseGroupId(groupId);
} else {
displayBrowse(true);
}
});
this.get('#:folder', function () {
self.activeMenuId(this.params.folder);
ko.utils.arrayFirst(self.artifactMenuItems.concat(self.usersMenuItems, self.administrationMenuItems), function(p) {
if ( p.href == "#"+self.activeMenuId()) {
p.func();
p.func();
}
});
});
});
this.get('', function () { this.app.runRoute('get', '#Search') });
} );
sammyArchivaApplication.run();

View File

@ -29,7 +29,7 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno
this.parentBrowseViewModel=parentBrowseViewModel;
this.groupId=groupId;
displayGroupId=function(groupId){
displayGroupDetail(groupId,self);
window.sammyArchivaApplication.setLocation("#browse/"+groupId);
}
displayParentGroupId=function(){
$.log("called displayParentGroupId groupId:"+self.parentBrowseViewModel.groupId);