{# -*- engine:django -*- #}

{% load menu_generator %}

{% get_menu "NAV_MENU_INFRABLUE" as core_menu %}

<ul class="collapsible collapsible-accordion">

    {% for item in core_menu %}
        {% if not item.submenu %}
            <li class="{% if item.selected %} active {% endif %}">
                <a class="truncate" href="{{ item.url }}">
                    {% if item.icon_class %}
                        <i class="{{ item.icon_class }}"></i>
                    {% elif item.icon %}
                        <i class="material-icons">{{ item.icon }}</i>
                    {% endif %}
                    {{ item.name }}
                </a>
            </li>
        {% endif %}
        {% if item.submenu %}
            <li class="bold {% if item.selected %} active {% endif %}">
                <a class="collapsible-header waves-effect waves-primary truncate" href="{{ item.url|default:"#" }}">
                    {% if item.icon_class %}
                        <i class="{{ item.icon_class }}"></i>
                    {% elif item.icon %}
                        <i class="material-icons">{{ item.icon }}</i>
                    {% endif %}
                    {{ item.name }}
                </a>
                <div class="collapsible-body">
                    <ul>
                        {% for menu in item.submenu %}
                            <li class="{% if menu.selected %} active {% endif %}">
                                <a class="truncate" href="{{ menu.url }}">
                                    {% if menu.icon_class %}
                                        <i class="{{ menu.icon_class }}"></i>
                                    {% elif menu.icon %}
                                        <i class="material-icons">{{ menu.icon }}</i>
                                    {% endif %}
                                    {{ menu.name }}
                                </a>
                            </li>
                        {% endfor %}
                    </ul>
                </div>
            </li>
        {% endif %}
    {% endfor %}
</ul>
