From 6e2f70063bcb9310695e1b04da28bbd5a6f33898 Mon Sep 17 00:00:00 2001 From: Hemanth Kumar Veeranki Date: Fri, 24 Mar 2017 21:03:00 +0530 Subject: [PATCH] shortcuts: Add hidden property for each shortcut Display shortcuts only if hidden field is False. Signed-off-by: Hemanth Kumar Veeranki --- plinth/frontpage.py | 10 ++++++++++ plinth/templates/index.html | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/plinth/frontpage.py b/plinth/frontpage.py index 2999ee9d6..29fc06fa1 100644 --- a/plinth/frontpage.py +++ b/plinth/frontpage.py @@ -46,6 +46,7 @@ def add_shortcut(shortcut_id, label, login_required=False, 'login_required': login_required, 'details': details, 'configure_url': configure_url, + 'hidden': False } @@ -65,3 +66,12 @@ def remove_shortcut(shortcut_id): shortcuts = {shortcut_id: shortcut for shortcut_id, shortcut in shortcuts.items() if not match(shortcut)} + + +def hide_shortcut(shortcut_id): + """ + Makes the shortcut hidden + """ + global shortcuts + if shortcut_id in shortcuts.keys(): + shortcuts[shortcut_id]['hidden'] = True diff --git a/plinth/templates/index.html b/plinth/templates/index.html index 232fc7092..66b3cda2c 100644 --- a/plinth/templates/index.html +++ b/plinth/templates/index.html @@ -27,7 +27,7 @@ {% if shortcuts %} {% for shortcut in shortcuts %} - {% if user.is_authenticated or shortcut.login_required is False %} + {% if shortcut.hidden is False and user.is_authenticated or shortcut.login_required is False %}