mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-27 10:44:33 +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
|
and exit. It can be followed by "essential" or "optional" to only
|
||||||
list those modules.
|
list those modules.
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- frontpage: Show app logos instead of generic icons.
|
||||||
|
|
||||||
## [0.12.0] - 2016-12-08
|
## [0.12.0] - 2016-12-08
|
||||||
### Added
|
### Added
|
||||||
- Added screenshots to Readme.
|
- Added screenshots to Readme.
|
||||||
|
|||||||
@ -27,18 +27,19 @@ def get_shortcuts():
|
|||||||
return sorted(shortcuts.values(), key=lambda item: item['label'])
|
return sorted(shortcuts.values(), key=lambda item: item['label'])
|
||||||
|
|
||||||
|
|
||||||
def add_shortcut(id, label, details=None, configure_url=None,
|
def add_shortcut(shortcut_id, label, login_required=False,
|
||||||
login_required=False, icon=None, url=None,):
|
icon=None, url=None,
|
||||||
|
details=None, configure_url=None):
|
||||||
"""Add shortcut to front page."""
|
"""Add shortcut to front page."""
|
||||||
|
|
||||||
if not url:
|
if not url:
|
||||||
url = '?selected={id}'.format(id=id)
|
url = '?selected={id}'.format(id=shortcut_id)
|
||||||
|
|
||||||
if not icon:
|
if not icon:
|
||||||
icon = id
|
icon = shortcut_id
|
||||||
|
|
||||||
shortcuts[id] = {
|
shortcuts[shortcut_id] = {
|
||||||
'id': id,
|
'id': shortcut_id,
|
||||||
'label': label,
|
'label': label,
|
||||||
'url': url,
|
'url': url,
|
||||||
'icon': icon,
|
'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.
|
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):
|
def match(item):
|
||||||
if id[-1] == '*':
|
if shortcut_id[-1] == '*':
|
||||||
return item['id'].startswith(id[:-1])
|
return item['id'].startswith(shortcut_id[:-1])
|
||||||
|
|
||||||
return item['id'] == id
|
return item['id'] == shortcut_id
|
||||||
|
|
||||||
global shortcuts
|
global shortcuts
|
||||||
shortcuts = {id: shortcut
|
shortcuts = {shortcut_id: shortcut
|
||||||
for id, shortcut in shortcuts.items()
|
for shortcut_id, shortcut in shortcuts.items()
|
||||||
if not match(shortcut)}
|
if not match(shortcut)}
|
||||||
|
|||||||
@ -90,7 +90,8 @@ def setup(helper, old_version=None):
|
|||||||
|
|
||||||
def add_shortcut():
|
def add_shortcut():
|
||||||
frontpage.add_shortcut('minetest', title, url=None,
|
frontpage.add_shortcut('minetest', title, url=None,
|
||||||
description, reverse_lazy('minetest:index'),
|
details=description,
|
||||||
|
configure_url=reverse_lazy('minetest:index'),
|
||||||
login_required=False)
|
login_required=False)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -90,7 +90,8 @@ def setup(helper, old_version=None):
|
|||||||
|
|
||||||
def add_shortcut():
|
def add_shortcut():
|
||||||
frontpage.add_shortcut('mumble', title,
|
frontpage.add_shortcut('mumble', title,
|
||||||
description, reverse_lazy('mumble:index'),
|
details=description,
|
||||||
|
configure_url=reverse_lazy('mumble:index'),
|
||||||
login_required=False)
|
login_required=False)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -95,7 +95,8 @@ def setup(helper, old_version=None):
|
|||||||
|
|
||||||
def add_shortcut():
|
def add_shortcut():
|
||||||
frontpage.add_shortcut('privoxy', title,
|
frontpage.add_shortcut('privoxy', title,
|
||||||
description, reverse_lazy('privoxy:index'),
|
details=description,
|
||||||
|
configure_url=reverse_lazy('privoxy:index'),
|
||||||
login_required=True)
|
login_required=True)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -96,7 +96,8 @@ def setup(helper, old_version=None):
|
|||||||
|
|
||||||
def add_shortcut():
|
def add_shortcut():
|
||||||
frontpage.add_shortcut('quassel', title,
|
frontpage.add_shortcut('quassel', title,
|
||||||
description, reverse_lazy('quassel:index'),
|
details=description,
|
||||||
|
configure_url=reverse_lazy('quassel:index'),
|
||||||
login_required=True)
|
login_required=True)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -88,7 +88,8 @@ def setup(helper, old_version=None):
|
|||||||
|
|
||||||
def add_shortcut():
|
def add_shortcut():
|
||||||
frontpage.add_shortcut('radicale', title,
|
frontpage.add_shortcut('radicale', title,
|
||||||
description, reverse_lazy('radicale:index'),
|
details=description,
|
||||||
|
configure_url=reverse_lazy('radicale:index'),
|
||||||
login_required=True)
|
login_required=True)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -102,7 +102,8 @@ def setup(helper, old_version=None):
|
|||||||
|
|
||||||
def add_shortcut():
|
def add_shortcut():
|
||||||
frontpage.add_shortcut('repro', title,
|
frontpage.add_shortcut('repro', title,
|
||||||
description, reverse_lazy('repro:index'),
|
details=description,
|
||||||
|
configure_url=reverse_lazy('repro:index'),
|
||||||
login_required=True)
|
login_required=True)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -77,7 +77,7 @@ def setup(helper, old_version=None):
|
|||||||
|
|
||||||
|
|
||||||
def add_shortcut():
|
def add_shortcut():
|
||||||
frontpage.add_shortcut('shaarli', title, '/shaarli',
|
frontpage.add_shortcut('shaarli', title, url='/shaarli',
|
||||||
login_required=True)
|
login_required=True)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -99,10 +99,11 @@ def setup(helper, old_version=None):
|
|||||||
|
|
||||||
def add_shortcut():
|
def add_shortcut():
|
||||||
frontpage.add_shortcut('jsxc', _('Chat Client \n (jsxc)'),
|
frontpage.add_shortcut('jsxc', _('Chat Client \n (jsxc)'),
|
||||||
reverse_lazy('xmpp:jsxc'),
|
url=reverse_lazy('xmpp:jsxc'),
|
||||||
login_required=True)
|
login_required=True)
|
||||||
frontpage.add_shortcut('xmpp', title,
|
frontpage.add_shortcut('xmpp', title,
|
||||||
description, reverse_lazy('xmpp:index'),
|
details=description,
|
||||||
|
configure_url=reverse_lazy('xmpp:index'),
|
||||||
login_required=True)
|
login_required=True)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user