]> source.dussan.org Git - archiva.git/commitdiff
[MRM-1766] Clicking the ".." when browsing should take you up one level in the group...
authorOlivier Lamy <olamy@apache.org>
Mon, 2 Dec 2013 04:46:05 +0000 (04:46 +0000)
committerOlivier Lamy <olamy@apache.org>
Mon, 2 Dec 2013 04:46:05 +0000 (04:46 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1546895 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/archiva/search.js
archiva-modules/archiva-web/archiva-webapp/src/main/webapp/js/templates/archiva/search.html

index 1ac595b07d15ead73a172130ee53c0f5e5e2f9df..da01206d9127ae2a85dc0c7ee83b8565fa5e0c19 100644 (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);
   }
 
index 6c48a3e291380bac0108d060b6e7dd12c5458790..db22cc012b09a46d5a64e0ffb800195fc4efe676 100644 (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}}