mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-07 00:48:41 +00:00
fix up the FilterPanel and the css class for the selected item
This commit is contained in:
parent
47a80526b3
commit
47509ee705
2 changed files with 18 additions and 25 deletions
|
@ -236,8 +236,8 @@ dl.singleline dd {
|
||||||
line-height: 16px;
|
line-height: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#sidebar .x-grid3-row-selected td {
|
#sidebar .x-list-selected em {
|
||||||
font-weight: Bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* MessageBox icon styles */
|
/* MessageBox icon styles */
|
||||||
|
|
|
@ -53,9 +53,9 @@ Deluge.FilterPanel = Ext.extend(Ext.Panel, {
|
||||||
this.setTitle(_(title));
|
this.setTitle(_(title));
|
||||||
|
|
||||||
if (this.filterType == 'tracker_host') {
|
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 {
|
} 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({
|
this.list = this.add({
|
||||||
|
@ -71,33 +71,22 @@ Deluge.FilterPanel = Ext.extend(Ext.Panel, {
|
||||||
id: 'filter',
|
id: 'filter',
|
||||||
sortable: false,
|
sortable: false,
|
||||||
tpl: tpl,
|
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'
|
dataIndex: 'filter'
|
||||||
}]
|
}]
|
||||||
});
|
});
|
||||||
this.relayEvents(this.list, ['selectionchange']);
|
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() {
|
getFilter: function() {
|
||||||
if (!this.list.getSelectionCount()) return;
|
if (!this.list.getSelectionCount()) return;
|
||||||
|
|
||||||
|
@ -106,6 +95,10 @@ Deluge.FilterPanel = Ext.extend(Ext.Panel, {
|
||||||
return filter.id;
|
return filter.id;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the Store for the ListView of the FilterPanel
|
||||||
|
* @returns {Ext.data.Store} the ListView store
|
||||||
|
*/
|
||||||
getStore: function() {
|
getStore: function() {
|
||||||
return this.list.getStore();
|
return this.list.getStore();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue