[MRM-1573] breadcrumbs in repository browsing.

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1245788 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-02-17 22:50:24 +00:00
parent 6d0d073824
commit f113456cc5
2 changed files with 22 additions and 5 deletions

View File

@ -41,9 +41,22 @@ $(function() {
browseRoot(); 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){ displayGroupDetail=function(groupId,parentBrowseViewModel,restUrl){
var mainContent = $("#main-content"); var mainContent = $("#main-content");

View File

@ -42,11 +42,13 @@
<ul> <ul>
<!-- if null we are on root level --> <!-- if null we are on root level -->
{{if $root.parentBrowseViewModel}} {{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}} {{/if}}
{{each(i,browseResultEntry) browseResultEntries}} {{each(i,browseResultEntry) browseResultEntries}}
<li class="browse-list"> <li class="browse-list" data-bind="click:function(){displayGroupId(browseResultEntry.name)}">
<a href="#" data-bind="click:function(){displayGroupId(browseResultEntry.name)}"> <a href="#">
&nbsp;${browseResultEntry.name} (project: ${browseResultEntry.project}) &nbsp;${browseResultEntry.name} (project: ${browseResultEntry.project})
</a> </a>
</li> </li>
@ -58,6 +60,8 @@
<script id="browse-breadcrumb-tmpl" type="text/html"> <script id="browse-breadcrumb-tmpl" type="text/html">
<ul class="breadcrumb"> <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="#" 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> </ul>
</script> </script>