]> source.dussan.org Git - archiva.git/commitdiff
[MRM-1573] breadcrumbs in repository browsing.
authorOlivier Lamy <olamy@apache.org>
Fri, 17 Feb 2012 22:50:24 +0000 (22:50 +0000)
committerOlivier Lamy <olamy@apache.org>
Fri, 17 Feb 2012 22:50:24 +0000 (22:50 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1245788 13f79535-47bb-0310-9956-ffa450edef68

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

index 76439836050b99e9876e7637a3af9e9f400b7ee6..1ff45a25e0db349cf86be3adec9048cac2ca417b 100644 (file)
@@ -41,9 +41,22 @@ $(function() {
         browseRoot();
       }
     }
-  }
 
+    breadCrumbEntries=function(){
+      var curBrowseViewModel=self;
+      var entries=[];
+      do{
+        entries.push(curBrowseViewModel.groupId);
+        curBrowseViewModel=curBrowseViewModel.parentBrowseViewModel;
+        if (!curBrowseViewModel) return entries.reverse();
+      }while(curBrowseViewModel.parentBrowseViewModel)
+      return entries.reverse();
+    }
+  }
 
+  findParentGroupId=function(browseViewModel){
+    return browseViewModel.groupId;
+  }
 
   displayGroupDetail=function(groupId,parentBrowseViewModel,restUrl){
     var mainContent = $("#main-content");
index 7d8e4dfb87c83aefb64160e49a10d462de1b64b4..ac32be8d111945dea1eb93e2da6197f27de45e35 100644 (file)
     <ul>
       <!-- if null we are on root level -->
       {{if $root.parentBrowseViewModel}}
-        <li class="browse-list"><a href="#" data-bind="click:function(){displayParentGroupId()}">..</a></li>
+        <li class="browse-list" data-bind="click:function(){displayParentGroupId()}">
+          <a href="#">..</a>
+        </li>
       {{/if}}
       {{each(i,browseResultEntry) browseResultEntries}}
-        <li class="browse-list">
-          <a href="#" data-bind="click:function(){displayGroupId(browseResultEntry.name)}">
+        <li class="browse-list" data-bind="click:function(){displayGroupId(browseResultEntry.name)}">
+          <a href="#">
             &nbsp;${browseResultEntry.name} (project: ${browseResultEntry.project})
           </a>
         </li>
@@ -58,6 +60,8 @@
 <script id="browse-breadcrumb-tmpl" type="text/html">
   <ul class="breadcrumb">
     <li><a href="#" data-bind="click: function(){ browseRoot()}"><i class="icon-home"/>&nbsp;</a>&nbsp;<span class="divider">/</span></li>
-    <li><a href="#">org</a>&nbsp;<span class="divider">/</span></li>
+    {{each(i,breadCrumbEntry) breadCrumbEntries}}
+      <li><a href="#">${breadCrumbEntry}</a>&nbsp;<span class="divider">/</span></li>
+    {{/each}}
   </ul>
 </script>
\ No newline at end of file