add a proper renderer for the filters

This commit is contained in:
Damien Churchill 2009-03-20 00:11:14 +00:00
parent 7fb9af5c3d
commit cb1beab159
2 changed files with 28 additions and 8 deletions

View File

@ -33,14 +33,14 @@ input {
background-repeat: no-repeat;
}
#labels .all { background-image: url('/icons/16/all.png'); }
#labels .active { background-image: url('/icons/16/active.png'); }
.x-deluge-all { background-image: url('/icons/16/all.png'); }
.x-deluge-active { background-image: url('/icons/16/active.png'); }
.x-deluge-downloading, .x-deluge-peer { background-image: url('/icons/16/downloading.png'); }
.x-deluge-seeding, .deluge-torrents .seeding, .x-deluge-seed { background-image: url('/icons/16/seeding.png'); }
#labels .queued, .deluge-torrents .queued { background-image: url('/icons/16/queued.png'); }
#labels .paused, .deluge-torrents .paused { background-image: url('/icons/16/inactive.png'); }
#labels .error, .deluge-torrents .error { background-image: url('/icons/16/alert.png'); }
#labels .checking, .deluge-torrents .checking { background-image: url('/icons/16/checking.png'); }
.x-deluge-queued, .deluge-torrents .queued { background-image: url('/icons/16/queued.png'); }
.x-deluge-paused, .deluge-torrents .paused { background-image: url('/icons/16/inactive.png'); }
.x-deluge-error, .deluge-torrents .error { background-image: url('/icons/16/alert.png'); }
.x-deluge-checking, .deluge-torrents .checking { background-image: url('/icons/16/checking.png'); }
/* Torrent Details */
@ -148,3 +148,10 @@ input {
background: transparent;
color: White;
}
.x-deluge-filter {
background-repeat: no-repeat;
padding-left: 20px;
height: 25px;
}

View File

@ -341,6 +341,17 @@ Deluge.SideBar = {
},
renderer: function(value, p, r) {
var lname = value.toLowerCase();
lname = lname.replace('.', '_');
var image = '';
if (r.store.id == 'tracker_host') {
image = String.format('url(/tracker/{0})', value);
}
return String.format('<span class="x-deluge-filter x-deluge-{2}" style="background-image: {3};">{0} ({1})</span>', value, r.data['count'], lname, image);
},
update: function(filters) {
$each(filters, function(states, filter) {
if (this.panels.has(filter)) {
@ -353,8 +364,10 @@ Deluge.SideBar = {
createFilter: function(filter, states) {
var store = new Ext.data.SimpleStore({
id: filter,
fields: [
{name: 'filter'}
{name: 'filter'},
{name: 'count'}
]
});
@ -372,7 +385,7 @@ Deluge.SideBar = {
store: store,
title: title,
columns: [
{id: 'filter', sortable: false, renderer: Deluge.Formatters.plain, dataIndex: 'filter'}
{id: 'filter', sortable: false, renderer: this.renderer, dataIndex: 'filter'}
],
stripeRows: false,
hideHeaders: true,