mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-21 07:55:00 +00:00
frontpage: Fix issues with hidden property
- Fix incorrect use of compound boolean expression in if statement. 'a and b or c' is treated as '((a and b) or c)'. - Allow unhiding a shortcut. - Raise exception when shortcut requested does not exist. This is the Python way. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
parent
6e2f70063b
commit
561f8f2d90
@ -68,10 +68,7 @@ def remove_shortcut(shortcut_id):
|
||||
if not match(shortcut)}
|
||||
|
||||
|
||||
def hide_shortcut(shortcut_id):
|
||||
"""
|
||||
Makes the shortcut hidden
|
||||
"""
|
||||
def hide_shortcut(shortcut_id, hide=True):
|
||||
"""Mark a shortcut as hidden or not hidden."""
|
||||
global shortcuts
|
||||
if shortcut_id in shortcuts.keys():
|
||||
shortcuts[shortcut_id]['hidden'] = True
|
||||
shortcuts[shortcut_id]['hidden'] = hide
|
||||
|
||||
@ -27,25 +27,27 @@
|
||||
{% if shortcuts %}
|
||||
|
||||
{% for shortcut in shortcuts %}
|
||||
{% 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 %}
|
||||
<li class="active">
|
||||
<a href="{{ shortcut.url }}" class="active">
|
||||
{% else %}
|
||||
<li>
|
||||
<a href="{{ shortcut.url }}">
|
||||
{% endif %}
|
||||
<center>
|
||||
<img src="{% static 'theme/icons/' %}{{ shortcut.icon }}.png" style="max-width: 100px; height: 100px" />
|
||||
<br>
|
||||
{{ shortcut.label|linebreaks }}
|
||||
</center>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
{% if not shortcut.hidden %}
|
||||
{% if user.is_authenticated or not shortcut.login_required %}
|
||||
<div class="col-sm-3">
|
||||
<ul class="nav nav-pills nav-stacked">
|
||||
{% if selected_id == shortcut.id %}
|
||||
<li class="active">
|
||||
<a href="{{ shortcut.url }}" class="active">
|
||||
{% else %}
|
||||
<li>
|
||||
<a href="{{ shortcut.url }}">
|
||||
{% endif %}
|
||||
<center>
|
||||
<img src="{% static 'theme/icons/' %}{{ shortcut.icon }}.png" style="max-width: 100px; height: 100px" />
|
||||
<br>
|
||||
{{ shortcut.label|linebreaks }}
|
||||
</center>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user