{% if menu.url_name %}
<li class="{{ 'active' if menu.active else '' }}">
  <a data-url-has-params href="{{reverse_url_with_params(menu.url_name,
  url_args=menu.url_params.values())}}">{{menu.title}}</a>
</li>
{% end %}
{% if menu.active and menu.children %}
<li class="divider"></li>
   {% if len(menu.children) > 6 %}
    <li class="heading">
        <a href="#" data-dropdown="drop-{{menu.url_name}}" aria-controls="drop1"
        aria-expanded="false" class="dropdown">
        {% set current_child = None %}
        {% for child in menu.children  %}
            {% if child.active %}
                {{child.title}}
                {% set current_child = child %}
                {% break %}
            {% end %}
        {% else %}
            Select one...
        {% end %}
        </a></li>
        <ul data-dropdown-content class="f-dropdown" aria-hidden="true" tabindex="-1"
                                                                        id="drop-{{menu.url_name}}">
        {% for child in menu.children %}
            {% if child != current_child %}
                {% raw child.render(handler) %}
            {% end %}
        {% end %}
        </ul>
    </li>
    {% set current_menu = current_child %}
  {% else %}
    {% set current_menu = menu %}
  {% end %}
  {% if current_menu is not None %}
    {% for child in current_menu.children %}
        {% raw child.render(handler) %}
    {% end %}
  {% end %}
</li>
{% end %}

