Module: deluge
Branch: master
Commit: 47509ee7050ad27cdefa215d166cbba03634d220

Author: Damien Churchill <[email protected]>
Date:   Tue Mar 30 19:25:50 2010 +0100

fix up the FilterPanel and the css class for the selected item

---

 deluge/ui/web/css/deluge.css               |    4 +-
 deluge/ui/web/js/deluge-all/FilterPanel.js |   39 +++++++++++----------------
 2 files changed, 18 insertions(+), 25 deletions(-)

diff --git a/deluge/ui/web/css/deluge.css b/deluge/ui/web/css/deluge.css
index c4be6b4..9d3b606 100644
--- a/deluge/ui/web/css/deluge.css
+++ b/deluge/ui/web/css/deluge.css
@@ -236,8 +236,8 @@ dl.singleline dd {
        line-height: 16px;
 }
 
-#sidebar .x-grid3-row-selected td {
-       font-weight: Bold;
+#sidebar .x-list-selected em {
+       font-weight: bold;
 }
 
 /* MessageBox icon styles */
diff --git a/deluge/ui/web/js/deluge-all/FilterPanel.js 
b/deluge/ui/web/js/deluge-all/FilterPanel.js
index 3868566..8e1d06b 100644
--- a/deluge/ui/web/js/deluge-all/FilterPanel.js
+++ b/deluge/ui/web/js/deluge-all/FilterPanel.js
@@ -53,9 +53,9 @@ Deluge.FilterPanel = Ext.extend(Ext.Panel, {
                this.setTitle(_(title));
 
                if (this.filterType == 'tracker_host') {
-                       var tpl = '<div class="x-deluge-filter" 
background-image: url(' + deluge.config.base + 
'tracker/{filter});">{filter}</div>';
+                       var tpl = '<div class="x-deluge-filter" 
style="background-image: url(' + deluge.config.base + 
'tracker/{filter});">{filter} ({count})</div>';
                } else {
-                       var tpl = '<div class="x-deluge-filter 
x-deluge-{filter:cssClassEscape}">{filter}</div>';
+                       var tpl = '<div class="x-deluge-filter 
x-deluge-{filter:lowercase}">{filter} ({count})</div>';
                }
 
                this.list = this.add({
@@ -71,33 +71,22 @@ Deluge.FilterPanel = Ext.extend(Ext.Panel, {
                                id: 'filter',
                                sortable: false,
                                tpl: tpl,
-                               renderer: function(v, p, r) {
-                                       var lc = v.toLowerCase().replace('.', 
'_'),
-                                               icon = '';
-
-                                       if (r.store.id == 'tracker_host' && v 
!= 'Error') {
-                                               icon = 
String.format('url({0}tracker/{1}', deluge.config.base, v);
-                                       }
-
-                                       var filter = '<div 
class="x-deluge-filter';
-                                       var arg = '';
-                                       if (icon) {
-                                               filter += '" 
style="background-image: {2};">';
-                                               arg = icon;
-                                       } else if (lc) {
-                                               filter += ' x-deluge-{2}">';
-                                               arg = lc;
-                                       } else {
-                                               filter += '">';
-                                       }
-                                       return String.format(filter + '{0} 
({1})</div>', value, r.data['count'], arg);
-                               },
                                dataIndex: 'filter'
                        }]
                });
                this.relayEvents(this.list, ['selectionchange']);
+               this.list.afterMethod('bindStore', this.doBindStore, this);
+       },
+
+       // private
+       doBindStore: function() {
+               this.list.select(0);
        },
 
+       /**
+        * Return the currently selected filter
+        * @returns {String} the current filter
+        */
        getFilter: function() {
                if (!this.list.getSelectionCount()) return;
 
@@ -106,6 +95,10 @@ Deluge.FilterPanel = Ext.extend(Ext.Panel, {
                return filter.id;
        },
 
+       /**
+        * Return the Store for the ListView of the FilterPanel
+        * @returns {Ext.data.Store} the ListView store
+        */
        getStore: function() {
                return this.list.getStore();
        }

-- 
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