webui:sidebar config for trackers and hide_zero
This commit is contained in:
parent
cba021a19e
commit
d7aed2778d
|
@ -89,6 +89,12 @@ class Password(forms.Form):
|
||||||
utils.end_session()
|
utils.end_session()
|
||||||
#raise forms.ValidationError(_("Password changed,please login again"))
|
#raise forms.ValidationError(_("Password changed,please login again"))
|
||||||
|
|
||||||
|
class Sidebar(config_forms.WebCfgForm):
|
||||||
|
title = _("Sidebar")
|
||||||
|
sidebar_show_zero = forms.CheckBox(_("Show zero hits"))
|
||||||
|
sidebar_show_trackers = forms.CheckBox(_("Show trackers"))
|
||||||
|
|
||||||
config_page.register('webui','template', Template)
|
config_page.register('webui','template', Template)
|
||||||
config_page.register('webui','server',Server)
|
config_page.register('webui','server',Server)
|
||||||
config_page.register('webui','password',Password)
|
config_page.register('webui','password',Password)
|
||||||
|
config_page.register('webui','sidebar',Sidebar)
|
||||||
|
|
|
@ -98,21 +98,24 @@ class index:
|
||||||
newvars['filter_value'] = vars.filter_value
|
newvars['filter_value'] = vars.filter_value
|
||||||
vars.update(newvars)
|
vars.update(newvars)
|
||||||
|
|
||||||
|
|
||||||
else: #has arguments:set cookies from arguments.
|
else: #has arguments:set cookies from arguments.
|
||||||
for key in ["sort", "order", "filter_cat","filter_value"]:
|
for key in ["sort", "order", "filter_cat","filter_value"]:
|
||||||
value = getattr(vars, key) or ""
|
value = getattr(vars, key) or ""
|
||||||
setcookie(key, value)
|
setcookie(key, value)
|
||||||
|
|
||||||
#organize-filters
|
#Filters
|
||||||
label_filters = {}
|
|
||||||
|
|
||||||
filter_dict = {}
|
filter_dict = {}
|
||||||
if vars.filter_cat and vars.filter_value and vars.filter_value <> "All":
|
if vars.filter_cat and vars.filter_value and vars.filter_value <> "All":
|
||||||
filter_dict = {vars.filter_cat:vars.filter_value}
|
filter_dict = {vars.filter_cat:vars.filter_value}
|
||||||
|
|
||||||
torrents = proxy.get_torrents_status(filter_dict, TORRENT_KEYS)
|
torrents = proxy.get_torrents_status(filter_dict, TORRENT_KEYS)
|
||||||
label_filters = proxy.get_filter_tree()
|
|
||||||
|
#sidebar-config:
|
||||||
|
hide_cat = []
|
||||||
|
if not config["sidebar_show_trackers"]:
|
||||||
|
hide_cat = ["tracker_host"]
|
||||||
|
|
||||||
|
label_filters = proxy.get_filter_tree(config["sidebar_show_zero"], hide_cat)
|
||||||
|
|
||||||
torrent_list = utils.get_enhanced_torrent_list(torrents)
|
torrent_list = utils.get_enhanced_torrent_list(torrents)
|
||||||
|
|
||||||
|
|
|
@ -61,5 +61,7 @@ CONFIG_DEFAULTS = {
|
||||||
"daemon":"http://localhost:58846",
|
"daemon":"http://localhost:58846",
|
||||||
"base":"",
|
"base":"",
|
||||||
"disallow":{},
|
"disallow":{},
|
||||||
"sessions":[]
|
"sessions":[],
|
||||||
|
"sidebar_show_zero":False,
|
||||||
|
"sidebar_show_trackers":False
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue