magnify browsing :-)

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1245678 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-02-17 17:40:09 +00:00
parent fa2a45d627
commit 89c03a9933
2 changed files with 56 additions and 38 deletions

View File

@ -18,42 +18,31 @@
*/
$(function() {
//-----------------------------------------
// browse part
//-----------------------------------------
BrowseViewModel=function(browseResultEntries,parentGroupdId){
var self=this;
this.browseResultEntries=browseResultEntries;
this.parentGroupdId=parentGroupdId;
displayGroupId=function(groupId){
displayGroupDetail(groupId,"..");
displayGroupDetail(groupId,self.parentGroupdId);
}
}
displayBrowse=function(){
clearUserMessages();
var mainContent = $("#main-content");
mainContent.html($("#browse-tmpl" ).tmpl());
mainContent.find("#browse_result").html(mediumSpinnerImg());
$.ajax("restServices/archivaServices/browseService/rootGroups", {
type: "GET",
dataType: 'json',
success: function(data) {
var browseResultEntries = mapbrowseResultEntries(data);
$.log("size:"+browseResultEntries.length);
var browseViewModel = new BrowseViewModel(browseResultEntries);
ko.applyBindings(browseViewModel,mainContent.get(0));
}
});
}
displayGroupDetail=function(groupId,parentGroupdId){
var mainContent = $("#main-content");
var browseResult=mainContent.find("#browse_result");
browseResult.hide( "slide", {}, 500,
var browseBreadCrumb=mainContent.find("#browse_breadcrumb");
mainContent.find("#main_browse_result_content").hide( "slide", {}, 300,
function(){
browseResult.html(mediumSpinnerImg());
browseResult.show();
browseBreadCrumb.html(smallSpinnerImg());
mainContent.find("#main_browse_result_content" ).show();
var url = "restServices/archivaServices/browseService/browseGroupId/"+encodeURIComponent(groupId);
$.ajax(url, {
type: "GET",
@ -70,8 +59,24 @@ $(function() {
}
displaySearch=function(){
$("#main-content" ).html("coming soon :-)");
/**
* call from menu entry to display root level
*/
displayBrowse=function(){
clearUserMessages();
var mainContent = $("#main-content");
mainContent.html($("#browse-tmpl" ).tmpl());
mainContent.find("#browse_result").html(mediumSpinnerImg());
$.ajax("restServices/archivaServices/browseService/rootGroups", {
type: "GET",
dataType: 'json',
success: function(data) {
var browseResultEntries = mapbrowseResultEntries(data);
$.log("size:"+browseResultEntries.length);
var browseViewModel = new BrowseViewModel(browseResultEntries,"..");
ko.applyBindings(browseViewModel,mainContent.get(0));
}
});
}
mapbrowseResultEntries=function(data){
@ -88,4 +93,13 @@ $(function() {
this.name=name;
this.project=project;
}
//-----------------------------------------
// search part
//-----------------------------------------
displaySearch=function(){
$("#main-content" ).html("coming soon :-)");
}
});

View File

@ -23,14 +23,11 @@
<h2>${$.i18n.prop('browse.repository')}</h2>
</div>
</div>
<div id="browse_breadcrumb">
<ul class="breadcrumb">
<li><a href="#"><i class="icon-home"/>&nbsp;</a>&nbsp;<span class="divider">/</span></li>
<li><a href="#">org</a>&nbsp;<span class="divider">/</span></li>
</ul>
<div id="main_browse_result">
<div id="main_browse_result_content" class="well">
<div id="browse_breadcrumb" data-bind='template:{name:"browse-breadcrumb-tmpl"}'></div>
<div id="browse_result" class="well" data-bind='template:{name:"browse-groups-tmpl"}'></div>
</div>
<div id="browse_result" class="well" data-bind='template:{name:"browse-groups-tmpl"}'>
</div>
</script>
@ -54,3 +51,10 @@
</ul>
</div>
</script>
<script id="browse-breadcrumb-tmpl" type="text/html">
<ul class="breadcrumb">
<li><a href="#"><i class="icon-home"/>&nbsp;</a>&nbsp;<span class="divider">/</span></li>
<li><a href="#">org</a>&nbsp;<span class="divider">/</span></li>
</ul>
</script>