Change navigation handling.

Use a tuple instead of a single string so that the name can differ
significantly from the function that is called.
This commit is contained in:
Markus 2016-04-16 21:00:01 +02:00
parent 9420e9913d
commit a01d33d989
2 changed files with 8 additions and 8 deletions

View File

@ -53,13 +53,13 @@ def isLoggedin():
def buildNav():
nav = []
if isLoggedin():
nav.append('edit')
nav.append(('Edit own Account', 'edit'))
if isAdmin():
nav.append('list')
nav.append('create')
nav.append('logout')
nav.append(('List Accounts', 'list_users'))
nav.append(('Create Account', 'create'))
nav.append(('Logout', 'logout'))
else:
nav.append('login')
nav.append(('Login', 'login'))
return nav

View File

@ -19,9 +19,9 @@
</a>
<hr/>
<ul class="nav nav-pills nav-stacked">
{% for ni in nav %}
<li{%- if request.path == url_for(ni) %} class="active"{% endif %}>
<a href="{{ url_for(ni) }}">{{ ni|capitalize }}</a>
{% for ni, func in nav %}
<li{%- if request.path == url_for(func) %} class="active"{% endif %}>
<a href="{{ url_for(func) }}">{{ ni }}</a>
</li>
{% endfor %}
</ul>