Created
August 4, 2012 03:00
-
-
Save electroniceagle/3253750 to your computer and use it in GitHub Desktop.
django mezzanine alternative dropdown menu with login_required filter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{# place this at templates/pages/menus/dropdown.html to override the mezzanine dropdown menu #} | |
{% load i18n pages_tags %} | |
{% spaceless %} | |
{% if page_branch_in_menu %} | |
{% if branch_level == 0 %} | |
<ul class="nav pull-right"> | |
{% for page in page_branch %} | |
{% if page.in_menu %} | |
{% if page.login_required and request.user.is_authenticated or not page.login_required %} | |
<li class="dropdown{% if page.is_current_or_ascendant %} active{% endif %}" | |
id="dropdown-menu-{{ page.html_id }}"> | |
<a href="{{ page.get_absolute_url }}"> | |
{{ page.title }} | |
{% if page.has_children %}<span class="caret"></span>{% endif %} | |
</a> | |
{% if page.has_children %}{% page_menu page %}{% endif %} | |
</li> | |
<li class="divider-vertical"></li> | |
{% endif %} | |
{% endif %} | |
{% endfor %} | |
</ul> | |
{% endif %} | |
{% if branch_level == 1 %} | |
<ul class="dropdown-menu"> | |
{% for page in page_branch %} | |
{% if page.in_menu %} | |
{% if page.login_required and request.user.is_authenticated or not page.login_required %} | |
<li{% if page.is_current_or_ascendant %} class="active"{% endif %} | |
id="dropdown-menu-{{ page.html_id }}"> | |
<a href="{{ page.get_absolute_url }}">{{ page.title }}</a> | |
</li> | |
{% endif %} | |
{% endif %} | |
{% endfor %} | |
</ul> | |
{% endif %} | |
{% endif %} | |
{% endspaceless %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment