diff --git a/plinth/frontpage.py b/plinth/frontpage.py index 2a658162f..633133095 100644 --- a/plinth/frontpage.py +++ b/plinth/frontpage.py @@ -19,33 +19,38 @@ Manage application shortcuts on front page. """ -shortcuts = [] +shortcuts = {} def get_shortcuts(): """Return menu items in sorted order according to current locale.""" - return sorted(shortcuts, key=lambda x: x['label']) + return sorted(shortcuts.values(), key=lambda item: item['label']) -def add_shortcut(app, label, url, icon, details=None): +def add_shortcut(id, label, url, icon, details=None): """Add shortcut to front page.""" - shortcuts.append({ - 'app': app, + shortcuts[id] = { + 'id': id, 'label': label, 'url': url, 'icon': icon, 'details': details, - }) + } -def remove_shortcut(app): +def remove_shortcut(id): """ Remove shortcut from front page. - If app ends with *, remove all shortcuts with that prefix. + If id ends with *, remove all shortcuts with that prefix. """ - match = lambda x: x['app'] == app - if app[-1] == '*': - match = lambda x: x['app'].startswith(app[:-1]) + def match(item): + if id[-1] == '*': + return item['id'].startswith(id[:-1]) - shortcuts[:] = [shortcut for shortcut in shortcuts if not match(shortcut)] + return item['id'] == id + + global shortcuts + shortcuts = {id: shortcut + for id, shortcut in shortcuts.items() + if not match(shortcut)} diff --git a/plinth/templates/index.html b/plinth/templates/index.html index f511e407a..06cc31b5e 100644 --- a/plinth/templates/index.html +++ b/plinth/templates/index.html @@ -23,39 +23,37 @@ {% block content %}
{% blocktrans trimmed %} - {{ box_name }}, a Debian pure blend, is a 100% free software self-hosting web server to deploy social applications on small machines. It provides online communication tools respecting your privacy and data ownership. - {% endblocktrans %}
{% blocktrans trimmed %} - More info about {{ box_name }} is available on the project homepage and wiki. - {% endblocktrans %}
{% blocktrans trimmed %} - This portal is a part of Plinth, the {{ box_name }} web interface. Plinth is free software, distributed under the GNU Affero General Public License, Version 3 or later. - {% endblocktrans %}
diff --git a/plinth/views.py b/plinth/views.py index f79c3f88d..2ad68c8ba 100644 --- a/plinth/views.py +++ b/plinth/views.py @@ -46,7 +46,7 @@ def index(request): return TemplateResponse(request, 'index.html', {'title': _('FreedomBox'), 'shortcuts': shortcuts, - 'selected_app': selection, + 'selected_id': selection, 'details': details, 'details_label': details_label})