[MRM-1766] Clicking the ".." when browsing should take you up one level in the group chain and not "Home"

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1546895 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2013-12-02 04:46:05 +00:00
parent 60b382e36e
commit 69f81f309d
2 changed files with 10 additions and 6 deletions

View File

@ -25,6 +25,7 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","select2","knockout","kno
//-----------------------------------------
BrowseViewModel=function(browseResultEntries,parentBrowseViewModel,groupId,repositoryId,feedsUrl){
$.log("BrowseViewModel:"+repositoryId);
var self=this;
this.browseResultEntries=browseResultEntries;
this.parentBrowseViewModel=parentBrowseViewModel;
@ -41,9 +42,12 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","select2","knockout","kno
}
displayParentGroupId=function(){
$.log("called displayParentGroupId groupId:"+self.parentBrowseViewModel.groupId);
// if null parent is root level
if (self.parentBrowseViewModel.groupId){
displayGroupDetail(self.parentBrowseViewModel.groupId,self.parentBrowseViewModel);
if (self.parentBrowseViewModel.groupId && self.parentBrowseViewModel.groupId.indexOf(".")>=1){
// remove last part of the groupId
window.sammyArchivaApplication.setLocation("#browse/"+groupId.substringBeforeLast('.'));
//displayGroupDetail(self.parentBrowseViewModel.groupId,self.parentBrowseViewModel);
} else {
browseRoot();
}
@ -1203,7 +1207,7 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","select2","knockout","kno
var mainContent = $("#main-content");
mainContent.html($("#browse-tmpl" ).tmpl());
mainContent.find("#browse_result").html(mediumSpinnerImg());
var parentBrowseViewModel=new BrowseViewModel(null,null,null,repositoryId);
var parentBrowseViewModel=new BrowseViewModel(null,null,groupId,repositoryId);
var url="restServices/archivaServices/browseService/browseGroupId/"+encodeURIComponent(groupId);
var feedsUrl=applicationUrl?applicationUrl:window.location.toString().substringBeforeLast("/").substringBeforeLast("/");
if (repositoryId){
@ -1532,7 +1536,7 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","select2","knockout","kno
clearUserMessages();
var mainContent = $("#main-content");
mainContent.find("#browse_result").html(mediumSpinnerImg());
var parentBrowseViewModel=new BrowseViewModel(null,null,null);
var parentBrowseViewModel=new BrowseViewModel(null,null,groupId);
displayGroupDetail(groupId,parentBrowseViewModel,null);
}

View File

@ -45,8 +45,8 @@
<!-- if null we are on root level -->
{{if $root.parentBrowseViewModel}}
<li class="browse-list" data-bind="click:function(){displayParentGroupId()}">
<a href="#">..</a>
<li class="browse-list">
<a data-bind="click:function(){displayParentGroupId()}" href="#">.. foo</a>
</li>
{{/if}}
{{each(i,browseResultEntry) browseResultEntries}}