archiva-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1245186 - in /archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva: search.js templates/search.html
Date Thu, 16 Feb 2012 21:27:22 GMT
Author: olamy
Date: Thu Feb 16 21:27:22 2012
New Revision: 1245186

URL: http://svn.apache.org/viewvc?rev=1245186&view=rev
Log:
group naviguation

Modified:
    archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js
    archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/search.html

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js?rev=1245186&r1=1245185&r2=1245186&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js
(original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js
Thu Feb 16 21:27:22 2012
@@ -29,18 +29,21 @@ $(function() {
           success: function(data) {
             var browseGroupIdEntryies = $.isArray(data.browseGroupIdResult.browseGroupIdEntries)
?
                 $.map(data.browseGroupIdResult.browseGroupIdEntries,function(item){
-                  $.log("name:"+item.name);
                   return new BrowseGroupIdEntry(item.name, item.project);
                 }): [data.browseGroupIdResult.browseGroupIdEntries];
-            $.log("size:"+browseGroupIdEntryies.length);
-            //var browseTopViewModel = new BrowseTopViewModel(groupdIds);
+            $("#main-content #browse_result").html($("#browse-groups-div-tmpl" ).tmpl());
+            var browseGroupsViewModel = new BrowseGroupsViewModel(browseGroupIdEntryies);
 
-            //ko.applyBindings(browseTopViewModel,mainContent.find("#browse_result" ).get(0));
+            ko.applyBindings(browseGroupsViewModel,$("#main-content #browse-groups-div" ).get(0));
           }
       });
     }
   }
 
+  BrowseGroupsViewModel=function(browseGroupIdEntryies){
+    this.browseGroupIdEntryies=browseGroupIdEntryies;
+  }
+
   displayBrowse=function(){
     var mainContent = $("#main-content");
     mainContent.html($("#browse-tmpl" ).tmpl());
@@ -49,9 +52,10 @@ $(function() {
         type: "GET",
         dataType: 'json',
         success: function(data) {
-          var groupdIds = $.map(data.groupIdList.groupIds,function(item){
-            return item;
-          });
+          var groupdIds =
+              $.isArray(data.groupIdList.groupIds)? $.map(data.groupIdList.groupIds,function(item){
+                return item;
+              }): [data.groupIdList.groupIds];
           $.log("size:"+groupdIds.length);
           var browseTopViewModel = new BrowseTopViewModel(groupdIds);
 

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/search.html
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/search.html?rev=1245186&r1=1245185&r2=1245186&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/search.html
(original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/search.html
Thu Feb 16 21:27:22 2012
@@ -38,4 +38,22 @@
       {{/each}}
     </ul>
   </div>
+</script>
+
+<script id="browse-groups-div-tmpl" type="text/html">
+  <div id="browse-groups-div" data-bind='template:{name:"browse-groups-tmpl"}'>
+
+  </div>
+</script>
+
+<script id="browse-groups-tmpl" type="text/html">
+  <div>
+    <ul>
+      {{each(i,browseGroupIdEntry) browseGroupIdEntryies}}
+        <li class="browse-list">
+          <a href="#">&nbsp;${browseGroupIdEntry.name}-project: ${browseGroupIdEntry.project}</a>
+        </li>
+      {{/each}}
+    </ul>
+  </div>
 </script>
\ No newline at end of file



Mime
View raw message