Merged conditional display code from the navigation template into the navigation tag, added support for conditional disabling of links

This commit is contained in:
Roberto Rosario
2011-06-28 01:05:57 -04:00
parent bafda3f7ad
commit 69c354b116
4 changed files with 56 additions and 63 deletions

View File

@@ -2,19 +2,16 @@
{% load navigation_tags %}
{% with link.permissions as permissions %}
{% with link.condition as condition %}
{% check_permissions request.user permissions %}
{% if permission %}
{% evaluate_link condition as conditional_display %}
{% if conditional_display %}
{% if as_li %}
<li class="{% if forloop.first and li_class_first %}{{ li_class_first}} {% endif %}{% if link.active and li_class_active %}{{ li_class_active }}{% endif %}">
{% endif %}
{% include "generic_link_instance.html" %}
{% if as_li %}</li>{% endif %}
{% if as_li %}
<li class="{% if forloop.first and li_class_first %}{{ li_class_first }} {% endif %}{% if link.active and li_class_active %}{{ li_class_active }}{% endif %}">
{% endif %}
{% include "generic_link_instance.html" %}
{% if as_li %}
</li>
{% endif %}
{% endif %}
{% endwith %}
{% endwith %}