mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-20 10:34:30 +00:00
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:
parent
b4dd17b01c
commit
6e2f70063b
@ -46,6 +46,7 @@ def add_shortcut(shortcut_id, label, login_required=False,
|
|||||||
'login_required': login_required,
|
'login_required': login_required,
|
||||||
'details': details,
|
'details': details,
|
||||||
'configure_url': configure_url,
|
'configure_url': configure_url,
|
||||||
|
'hidden': False
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -65,3 +66,12 @@ def remove_shortcut(shortcut_id):
|
|||||||
shortcuts = {shortcut_id: shortcut
|
shortcuts = {shortcut_id: shortcut
|
||||||
for shortcut_id, shortcut in shortcuts.items()
|
for shortcut_id, shortcut in shortcuts.items()
|
||||||
if not match(shortcut)}
|
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
|
||||||
|
|||||||
@ -27,7 +27,7 @@
|
|||||||
{% if shortcuts %}
|
{% if shortcuts %}
|
||||||
|
|
||||||
{% for shortcut in 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">
|
<div class="col-sm-3">
|
||||||
<ul class="nav nav-pills nav-stacked">
|
<ul class="nav nav-pills nav-stacked">
|
||||||
{% if selected_id == shortcut.id %}
|
{% if selected_id == shortcut.id %}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user