]> source.dussan.org Git - archiva.git/commitdiff
cleanup and simplify browse js model
authorOlivier Lamy <olamy@apache.org>
Fri, 17 Feb 2012 11:53:51 +0000 (11:53 +0000)
committerOlivier Lamy <olamy@apache.org>
Fri, 17 Feb 2012 11:53:51 +0000 (11:53 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1245415 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js

index 6f640f2bddcd6468a0c94530a64763d0b12ee4e1..38679168263961cc7fd29c14385fcc6883c81251 100644 (file)
  */
 $(function() {
 
-  BrowseTopViewModel=function(browseIdEntries){
+  BrowseViewModel=function(browseIdEntries,parentGroupdId){
     this.browseIdEntries=browseIdEntries;
+    this.parentGroupdId=parentGroupdId;
     displayGroupId=function(groupId){
       displayGroupDetail(groupId,"..");
     }
 
   }
 
-  BrowseGroupsViewModel=function(browseIdEntries,parentGroupdId){
-    var self = this;
-    this.browseIdEntries=browseIdEntries;
-    this.parentGroupdId=parentGroupdId;
-    displayGroupId=function(groupId){
-      displayGroupDetail(groupId,self.parentGroupdId);
-    }
-  }
+
 
   displayBrowse=function(){
     clearUserMessages();
@@ -46,9 +40,9 @@ $(function() {
         success: function(data) {
           var browseIdEntries = mapBrowseIdEntries(data);
           $.log("size:"+browseIdEntries.length);
-          var browseTopViewModel = new BrowseTopViewModel(browseIdEntries);
+          var browseViewModel = new BrowseViewModel(browseIdEntries);
 
-          ko.applyBindings(browseTopViewModel,mainContent.get(0));
+          ko.applyBindings(browseViewModel,mainContent.get(0));
         }
     });
   }
@@ -66,10 +60,9 @@ $(function() {
           dataType: 'json',
           success: function(data) {
             var browseIdEntries = mapBrowseIdEntries(data);
-            //browseResult.html($("#browse-groups-div-tmpl" ).tmpl());
-            var browseGroupsViewModel = new BrowseGroupsViewModel(browseIdEntries,parentGroupdId);
+            var browseViewModel = new BrowseViewModel(browseIdEntries,parentGroupdId);
 
-            ko.applyBindings(browseGroupsViewModel,mainContent.get(0));
+            ko.applyBindings(browseViewModel,mainContent.get(0));
           }
        });
       }