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() { $(function() {
//-----------------------------------------
// browse part
//-----------------------------------------
BrowseViewModel=function(browseResultEntries,parentGroupdId){ BrowseViewModel=function(browseResultEntries,parentGroupdId){
var self=this;
this.browseResultEntries=browseResultEntries; this.browseResultEntries=browseResultEntries;
this.parentGroupdId=parentGroupdId; this.parentGroupdId=parentGroupdId;
displayGroupId=function(groupId){ 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){ displayGroupDetail=function(groupId,parentGroupdId){
var mainContent = $("#main-content"); var mainContent = $("#main-content");
var browseResult=mainContent.find("#browse_result"); 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(){ function(){
browseResult.html(mediumSpinnerImg()); browseResult.html(mediumSpinnerImg());
browseResult.show(); browseBreadCrumb.html(smallSpinnerImg());
mainContent.find("#main_browse_result_content" ).show();
var url = "restServices/archivaServices/browseService/browseGroupId/"+encodeURIComponent(groupId); var url = "restServices/archivaServices/browseService/browseGroupId/"+encodeURIComponent(groupId);
$.ajax(url, { $.ajax(url, {
type: "GET", 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){ mapbrowseResultEntries=function(data){
@ -88,4 +93,13 @@ $(function() {
this.name=name; this.name=name;
this.project=project; this.project=project;
} }
//-----------------------------------------
// search part
//-----------------------------------------
displaySearch=function(){
$("#main-content" ).html("coming soon :-)");
}
}); });

View File

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