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,17 +18,50 @@
*/
$(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);
}
}
displayGroupDetail=function(groupId,parentGroupdId){
var mainContent = $("#main-content");
var browseResult=mainContent.find("#browse_result");
var browseBreadCrumb=mainContent.find("#browse_breadcrumb");
mainContent.find("#main_browse_result_content").hide( "slide", {}, 300,
function(){
browseResult.html(mediumSpinnerImg());
browseBreadCrumb.html(smallSpinnerImg());
mainContent.find("#main_browse_result_content" ).show();
var url = "restServices/archivaServices/browseService/browseGroupId/"+encodeURIComponent(groupId);
$.ajax(url, {
type: "GET",
dataType: 'json',
success: function(data) {
var browseResultEntries = mapbrowseResultEntries(data);
var browseViewModel = new BrowseViewModel(browseResultEntries,parentGroupdId);
ko.applyBindings(browseViewModel,mainContent.get(0));
}
});
}
);
}
/**
* call from menu entry to display root level
*/
displayBrowse=function(){
clearUserMessages();
var mainContent = $("#main-content");
@ -40,40 +73,12 @@ $(function() {
success: function(data) {
var browseResultEntries = mapbrowseResultEntries(data);
$.log("size:"+browseResultEntries.length);
var browseViewModel = new BrowseViewModel(browseResultEntries);
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,
function(){
browseResult.html(mediumSpinnerImg());
browseResult.show();
var url = "restServices/archivaServices/browseService/browseGroupId/"+encodeURIComponent(groupId);
$.ajax(url, {
type: "GET",
dataType: 'json',
success: function(data) {
var browseResultEntries = mapbrowseResultEntries(data);
var browseViewModel = new BrowseViewModel(browseResultEntries,parentGroupdId);
ko.applyBindings(browseViewModel,mainContent.get(0));
}
});
}
);
}
displaySearch=function(){
$("#main-content" ).html("coming soon :-)");
}
mapbrowseResultEntries=function(data){
if (data.browseResult && data.browseResult.browseResultEntries) {
return $.isArray(data.browseResult.browseResultEntries) ?
@ -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>
<div id="browse_result" class="well" data-bind='template:{name:"browse-groups-tmpl"}'>
<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>
</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>