Author: damoxc

Revision: 4886

Log:
        add a basic implementation of the sidebar

Diff:
Modified: trunk/deluge/ui/web/js/deluge-bars.js
===================================================================
--- trunk/deluge/ui/web/js/deluge-bars.js       2009-03-19 22:40:26 UTC (rev 
4885)
+++ trunk/deluge/ui/web/js/deluge-bars.js       2009-03-19 23:00:07 UTC (rev 
4886)
@@ -330,6 +330,7 @@
 });
 
 Deluge.SideBar = {
+       panels: new Hash(),
        
        onRender: function(bar) {
                this.Bar = bar;
@@ -341,7 +342,54 @@
        },
        
        update: function(filters) {
+               $each(filters, function(states, filter) {
+                       if (this.panels.has(filter)) {
+                               
+                       } else {
+                               this.createFilter(filter, states);
+                       }
+               }, this);
+       },
+       
+       createFilter: function(filter, states) {
+               var store = new Ext.data.SimpleStore({
+                       fields: [
+                               {name: 'filter'}
+                       ]
+               });
                
+               var title = filter.replace('_', ' ');
+               var parts = title.split(' ');
+        title = '';
+        parts.each(function(part) {
+            firstLetter = part.substring(0, 1);
+            firstLetter = firstLetter.toUpperCase();
+            part = firstLetter + part.substring(1);
+            title += part + ' ';
+        });
+               
+               var panel = new Ext.grid.GridPanel({
+                       store: store,
+                       title: title,
+                       columns: [
+                               {id: 'filter', sortable: false, renderer: 
Deluge.Formatters.plain, dataIndex: 'filter'}
+                       ],      
+                       stripeRows: false,
+                       hideHeaders: true,
+                       autoExpandColumn: 'filter',
+                       deferredRender: false,
+                       autoScroll: true,
+                       margins: '5 5 5 5'
+               });
+               store.loadData(states);
+               this.Bar.add(panel);
+               this.Bar.doLayout();
+               
+               this.panels[filter] = panel;
+       },
+       
+       updateFilter: function(filter, states) {
+               
        }
 };
 



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"deluge-commit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/deluge-commit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to