mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-21 07:55:00 +00:00
frontpage: Rearrange parameters for add_shortcut
Rename id to shortcut_id.
This commit is contained in:
parent
c57d0284a6
commit
f8dfd49f0f
@ -7,6 +7,9 @@ All notable changes to this project will be documented in this file.
|
||||
and exit. It can be followed by "essential" or "optional" to only
|
||||
list those modules.
|
||||
|
||||
### Changed
|
||||
- frontpage: Show app logos instead of generic icons.
|
||||
|
||||
## [0.12.0] - 2016-12-08
|
||||
### Added
|
||||
- Added screenshots to Readme.
|
||||
|
||||
@ -27,18 +27,19 @@ def get_shortcuts():
|
||||
return sorted(shortcuts.values(), key=lambda item: item['label'])
|
||||
|
||||
|
||||
def add_shortcut(id, label, details=None, configure_url=None,
|
||||
login_required=False, icon=None, url=None,):
|
||||
def add_shortcut(shortcut_id, label, login_required=False,
|
||||
icon=None, url=None,
|
||||
details=None, configure_url=None):
|
||||
"""Add shortcut to front page."""
|
||||
|
||||
if not url:
|
||||
url = '?selected={id}'.format(id=id)
|
||||
url = '?selected={id}'.format(id=shortcut_id)
|
||||
|
||||
if not icon:
|
||||
icon = id
|
||||
icon = shortcut_id
|
||||
|
||||
shortcuts[id] = {
|
||||
'id': id,
|
||||
shortcuts[shortcut_id] = {
|
||||
'id': shortcut_id,
|
||||
'label': label,
|
||||
'url': url,
|
||||
'icon': icon,
|
||||
@ -48,19 +49,19 @@ def add_shortcut(id, label, details=None, configure_url=None,
|
||||
}
|
||||
|
||||
|
||||
def remove_shortcut(id):
|
||||
def remove_shortcut(shortcut_id):
|
||||
"""
|
||||
Remove shortcut from front page.
|
||||
|
||||
If id ends with *, remove all shortcuts with that prefix.
|
||||
If shortcut_id ends with *, remove all shortcuts with that prefix.
|
||||
"""
|
||||
def match(item):
|
||||
if id[-1] == '*':
|
||||
return item['id'].startswith(id[:-1])
|
||||
if shortcut_id[-1] == '*':
|
||||
return item['id'].startswith(shortcut_id[:-1])
|
||||
|
||||
return item['id'] == id
|
||||
return item['id'] == shortcut_id
|
||||
|
||||
global shortcuts
|
||||
shortcuts = {id: shortcut
|
||||
for id, shortcut in shortcuts.items()
|
||||
shortcuts = {shortcut_id: shortcut
|
||||
for shortcut_id, shortcut in shortcuts.items()
|
||||
if not match(shortcut)}
|
||||
|
||||
@ -90,7 +90,8 @@ def setup(helper, old_version=None):
|
||||
|
||||
def add_shortcut():
|
||||
frontpage.add_shortcut('minetest', title, url=None,
|
||||
description, reverse_lazy('minetest:index'),
|
||||
details=description,
|
||||
configure_url=reverse_lazy('minetest:index'),
|
||||
login_required=False)
|
||||
|
||||
|
||||
|
||||
@ -90,7 +90,8 @@ def setup(helper, old_version=None):
|
||||
|
||||
def add_shortcut():
|
||||
frontpage.add_shortcut('mumble', title,
|
||||
description, reverse_lazy('mumble:index'),
|
||||
details=description,
|
||||
configure_url=reverse_lazy('mumble:index'),
|
||||
login_required=False)
|
||||
|
||||
|
||||
|
||||
@ -95,7 +95,8 @@ def setup(helper, old_version=None):
|
||||
|
||||
def add_shortcut():
|
||||
frontpage.add_shortcut('privoxy', title,
|
||||
description, reverse_lazy('privoxy:index'),
|
||||
details=description,
|
||||
configure_url=reverse_lazy('privoxy:index'),
|
||||
login_required=True)
|
||||
|
||||
|
||||
|
||||
@ -96,7 +96,8 @@ def setup(helper, old_version=None):
|
||||
|
||||
def add_shortcut():
|
||||
frontpage.add_shortcut('quassel', title,
|
||||
description, reverse_lazy('quassel:index'),
|
||||
details=description,
|
||||
configure_url=reverse_lazy('quassel:index'),
|
||||
login_required=True)
|
||||
|
||||
|
||||
|
||||
@ -88,7 +88,8 @@ def setup(helper, old_version=None):
|
||||
|
||||
def add_shortcut():
|
||||
frontpage.add_shortcut('radicale', title,
|
||||
description, reverse_lazy('radicale:index'),
|
||||
details=description,
|
||||
configure_url=reverse_lazy('radicale:index'),
|
||||
login_required=True)
|
||||
|
||||
|
||||
|
||||
@ -102,7 +102,8 @@ def setup(helper, old_version=None):
|
||||
|
||||
def add_shortcut():
|
||||
frontpage.add_shortcut('repro', title,
|
||||
description, reverse_lazy('repro:index'),
|
||||
details=description,
|
||||
configure_url=reverse_lazy('repro:index'),
|
||||
login_required=True)
|
||||
|
||||
|
||||
|
||||
@ -77,7 +77,7 @@ def setup(helper, old_version=None):
|
||||
|
||||
|
||||
def add_shortcut():
|
||||
frontpage.add_shortcut('shaarli', title, '/shaarli',
|
||||
frontpage.add_shortcut('shaarli', title, url='/shaarli',
|
||||
login_required=True)
|
||||
|
||||
|
||||
|
||||
@ -99,10 +99,11 @@ def setup(helper, old_version=None):
|
||||
|
||||
def add_shortcut():
|
||||
frontpage.add_shortcut('jsxc', _('Chat Client \n (jsxc)'),
|
||||
reverse_lazy('xmpp:jsxc'),
|
||||
url=reverse_lazy('xmpp:jsxc'),
|
||||
login_required=True)
|
||||
frontpage.add_shortcut('xmpp', title,
|
||||
description, reverse_lazy('xmpp:index'),
|
||||
details=description,
|
||||
configure_url=reverse_lazy('xmpp:index'),
|
||||
login_required=True)
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user