From 3be005aa70e6473f6099d5dfaf3dded5c43aa45c Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Fri, 17 Feb 2012 11:53:51 +0000 Subject: [PATCH] cleanup and simplify browse js model git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1245415 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/main/webapp/js/archiva/search.js | 21 +++++++------------ 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js index 6f640f2bd..386791682 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js @@ -18,22 +18,16 @@ */ $(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)); } }); } -- 2.39.5