From 69f81f309d896db6e627e23ce4f0d91f0f90fd7d Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Mon, 2 Dec 2013 04:46:05 +0000 Subject: [PATCH] [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 --- .../src/main/webapp/js/archiva/search.js | 12 ++++++++---- .../src/main/webapp/js/templates/archiva/search.html | 4 ++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/search.js b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/search.js index 1ac595b07..da01206d9 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/search.js +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/search.js @@ -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); } diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/templates/archiva/search.html b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/templates/archiva/search.html index 6c48a3e29..db22cc012 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/templates/archiva/search.html +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/templates/archiva/search.html @@ -45,8 +45,8 @@ {{if $root.parentBrowseViewModel}} -
  • - .. +
  • + .. foo
  • {{/if}} {{each(i,browseResultEntry) browseResultEntries}} -- 2.39.5