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(): def buildNav():
nav = [] nav = []
if isLoggedin(): if isLoggedin():
nav.append('edit') nav.append(('Edit own Account', 'edit'))
if isAdmin(): if isAdmin():
nav.append('list') nav.append(('List Accounts', 'list_users'))
nav.append('create') nav.append(('Create Account', 'create'))
nav.append('logout') nav.append(('Logout', 'logout'))
else: else:
nav.append('login') nav.append(('Login', 'login'))
return nav return nav

View File

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