]> source.dussan.org Git - archiva.git/commitdiff
magnify browsing :-)
authorOlivier Lamy <olamy@apache.org>
Fri, 17 Feb 2012 17:40:09 +0000 (17:40 +0000)
committerOlivier Lamy <olamy@apache.org>
Fri, 17 Feb 2012 17:40:09 +0000 (17:40 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1245678 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 b77624b4c01d308636651d42958f502f7eb12c34..f64adada008d7568a1c5fb2a201a288423a78a1c 100644 (file)
  */
 $(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 :-)");
+  }
+
 });
\ No newline at end of file
index b78c99244549666c5ff8a98d6f6f9f7e8b63073b..deefe1da086190190cc1511875a5e710cac0b954 100644 (file)
       <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>
 
       {{/each}}
     </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>
\ No newline at end of file