Skip to content

Commit

Permalink
refactor code so userid is not requested when not logged in
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanderhaegen Cedrik committed Mar 4, 2015
1 parent 5c18db1 commit 3a8e85b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 19 deletions.
35 changes: 17 additions & 18 deletions pyoes/templates/pyoes/header.jinja2
Expand Up @@ -69,29 +69,28 @@

{% set login_nav = login_nav|default(default_login_nav) -%}
{% set login_sub_nav = login_sub_nav|default(default_login_sub_nav) -%}
{% set login_user = login_user|default(request.user.userid) -%}

{% if not request.user %}
<ul class="right">
{% for caption, href in login_nav %}
<li><a href="{{ href }}">{{ caption }}</a></li>
{% endfor %}
</ul>

{% else %}
<ul class="right">
{% if not login_user == ' ' %}
<li class="has-dropdown">
<a href="#">{{ login_user }}</a>
<ul class="dropdown">
{% for caption, href in login_sub_nav %}
{% if login_nav|length > 0 %}
{% if not request.user %}
<ul class="right">
{% for caption, href in login_nav %}
<li><a href="{{ href }}">{{ caption }}</a></li>
{% endfor %}
</ul>
</li>
</ul>
{% else %}
<ul class="right">
<li class="has-dropdown">
<a href="#">{{ request.user.userid }}</a>
<ul class="dropdown">
{% for caption, href in login_sub_nav %}
<li><a href="{{ href }}">{{ caption }}</a></li>
{% endfor %}
</ul>
</li>
</ul>
{% endif %}
</ul>
{% endif %}

</section>
</nav>
{% endblock %}
Expand Down
1 change: 0 additions & 1 deletion pyoes/templates/pyoes/layout.jinja2
Expand Up @@ -11,7 +11,6 @@
{% set login_sub_nav = login_sub_nav -%}
{% set service_nav = service_nav -%}
{% set home_link = home_link -%}
{% set login_user = login_user -%}

{% set default_footer_nav = [
('Toegankelijkheid', '/toegankelijkheid'),
Expand Down

0 comments on commit 3a8e85b

Please sign in to comment.