Created
April 3, 2013 09:25
-
-
Save jose-lpa/5299720 to your computer and use it in GitHub Desktop.
A Mezzanine 5-level dropdown menu. Very dirty and strict, but it just works. You can design (via CSS) a dropdown menu using HTML lists. So, a list is the main menu and then each element of the list can have another list as a submenu. This Django template will generate that dynamically when you are using Mezzanine framework http://mezzanine.jupo.…
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
{% load i18n future pages_tags %} | |
{% spaceless %} | |
{% if page_branch_in_menu %} | |
{% if branch_level == 0 %} | |
<ul class="menu"> | |
{% for page in page_branch %} | |
{% if page.in_menu %} | |
<li> | |
<a href="{{ page.get_absolute_url }}">{{ page.title }}</a> | |
{% if page.has_children_in_menu %}{% page_menu page %}{% endif %} | |
</li> | |
{% endif %} | |
{% endfor %} | |
</ul> | |
{% endif %} | |
{% if branch_level == 1 %} | |
<ul> | |
{% for page in page_branch %} | |
{% if page.in_menu %} | |
<li> | |
<a href="{{ page.get_absolute_url }}">{{ page.title }}</a> | |
{% if page.has_children_in_menu %}{% page_menu page %}{% endif %} | |
</li> | |
{% endif %} | |
{% endfor %} | |
</ul> | |
{% endif %} | |
{% if branch_level == 2 %} | |
<ul> | |
{% for page in page_branch %} | |
{% if page.in_menu %} | |
<li> | |
<a href="{{ page.get_absolute_url }}">{{ page.title }}</a> | |
{% if page.has_children_in_menu %}{% page_menu page %}{% endif %} | |
</li> | |
{% endif %} | |
{% endfor %} | |
</ul> | |
{% endif %} | |
{% if branch_level == 3 %} | |
<ul> | |
{% for page in page_branch %} | |
{% if page.in_menu %} | |
<li> | |
<a href="{{ page.get_absolute_url }}">{{ page.title }}</a> | |
{% if page.has_children_in_menu %}{% page_menu page %}{% endif %} | |
</li> | |
{% endif %} | |
{% endfor %} | |
</ul> | |
{% endif %} | |
{% if branch_level == 4 %} | |
<ul> | |
{% for page in page_branch %} | |
{% if page.in_menu %} | |
<li> | |
<a href="{{ page.get_absolute_url }}">{{ page.title }}</a> | |
{% if page.has_children_in_menu %}{% page_menu page %}{% endif %} | |
</li> | |
{% endif %} | |
{% endfor %} | |
</ul> | |
{% endif %} | |
{% if branch_level == 5 %} | |
<ul> | |
{% for page in page_branch %} | |
{% if page.in_menu %} | |
<li> | |
<a href="{{ page.get_absolute_url }}">{{ page.title }}</a> | |
</li> | |
{% endif %} | |
{% endfor %} | |
</ul> | |
{% endif %} | |
{% endif %} | |
{% endspaceless %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment