shortcuts: Add hidden property for each shortcut

Display shortcuts only if hidden field is False.

Signed-off-by: Hemanth Kumar Veeranki <hemanthveeranki@gmail.com>
This commit is contained in:
Hemanth Kumar Veeranki 2017-03-24 21:03:00 +05:30 committed by Sunil Mohan Adapa
parent b4dd17b01c
commit 6e2f70063b
No known key found for this signature in database
GPG Key ID: 43EA1CFF0AA7C5F2
2 changed files with 11 additions and 1 deletions

View File

@ -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

View File

@ -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 %}
<div class="col-sm-3">
<ul class="nav nav-pills nav-stacked">
{% if selected_id == shortcut.id %}