Skip to content

Instantly share code, notes, and snippets.

@seanmavley
Created November 23, 2015 15:56
Show Gist options
  • Save seanmavley/a7f3bf6b3fa46ea8cecf to your computer and use it in GitHub Desktop.
Save seanmavley/a7f3bf6b3fa46ea8cecf to your computer and use it in GitHub Desktop.
Mezzanine Menu
{% load pages_tags i18n mezzanine_tags %}
{% if page_branch_in_menu %}
{% if branch_level == 0 %}
<a href="#" data-activates="mobile-demo" class="button-collapse"><i class="material-icons">menu</i></a>
<ul class="right hide-on-med-and-down">
<li> <a class="modal-trigger" href="#searchbox"><i class="material-icons">search</i></a></li>
{% if user.is_authenticated %}
<li> <a href="{% url 'add_project' %}"><i class="material-icons">add</i></a></li>
{% endif %}
{% for page in page_branch %}
{% if not has_home and page.is_primary and forloop.first %}
<li id="primary-menu-home" class="first{% if on_home %} active{% endif %}">
<a href="{% url "home" %}">{% trans "Home" %}</a>
</li>
{% endif %}
{% if page.in_menu %}
<li id="primary-menu-{{ page.html_id }}"
class="{% if page.is_current_or_ascendant %}active{% endif %}{% if forloop.last %} last{% endif %}">
<a href="{{ page.get_absolute_url }}"
{% if page.has_children_in_menu %}
class='dropdown-button' data-activates='testmenu{{ page.html_id}}'
{% endif %}
>{{ page.title }}</a>
{% if page.has_children_in_menu %}
<div id='testmenu{{page.html_id}}' class='dropdown-content'>
{% page_menu page %}
</div>
{% endif %}
</li>
{% endif %}
{% endfor %}
{% ifinstalled mezzanine.blog %}
<li> <a href="{% url 'blog_post_list' %}"><i class="material-icons">import_contacts</i></a></li>
{% endifinstalled %}
{% if user.is_authenticated %}
<li>
<a class='dropdown-button' href='#' data-activates='myaccount'><i class="material-icons">account_circle</i></a>
</li>
{% else %}
<li> <a href="{% url 'account_profile' %}"><i class="material-icons">account_circle</i></a></li>
{% endif %}
</ul>
{% else %}
<a href="#" data-activates="mobile-demo" class="button-collapse"><i class="material-icons">menu</i></a>
<ul class="right hide-on-med-and-down">
{% for page in page_branch %}
{% if not has_home and page.is_primary and forloop.first %}
<li id="primary-menu-home" class="first{% if on_home %} active{% endif %}">
<a href="{% url "home" %}">{% trans "Home" %}</a>
</li>
{% endif %}
{% if page.in_menu %}
<li id="primary-menu-{{ page.html_id }}"
class="{% if page.is_current_or_ascendant %}active{% endif %}{% if forloop.last %} last{% endif %}">
<a href="{{ page.get_absolute_url }}">{{ page.title }}</a>
</li>
{% endif %}
{% endfor %}
<li class="divider-vertical"></li>
</ul>
{% endif %}
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment