{% load bootstrap_tags %}
{% for child in children %}
<li class="{% if child.selected or child.ancestor %}active{% endif %}{% if child.children %} dropdown{% endif %}">
	{% if child.children %}
	<a href="{{ child.get_absolute_url }}" class="dropdown-toggle" data-toggle="dropdown">{{ child.get_menu_title|safe }} <b class="caret"></b></a>
	<ul class="dropdown-menu">
		{% if child.visible %}
		<li class="{% if child.selected %}active{% endif %}">
			<a href="{{ child.attr.redirect_url|default:child.get_absolute_url }}"><strong>{{ child.get_menu_title|safe }}</strong></a>
		</li>
		<li class="divider"></li>
		{% endif %}
		{% comment %}
		Bootsrap3 does not support submenues, so levels > 1 can't be handled be the main_menu tag and therfore
		recursion has been dropped intentionally. Read https://github.com/twbs/bootstrap/pull/6342 for details.
		{% endcomment %}
		{% for grandchild in child.children %}
			<li{% if grandchild.selected %} class="active"{% endif %}>
				<a href="{{ grandchild.attr.redirect_url|default:grandchild.get_absolute_url }}">{{ grandchild.get_menu_title|safe }}</a>
			</li>
		{% endfor %}
	</ul>
	{% else %}
	<a href="{{ child.attr.redirect_url|default:child.get_absolute_url }}">{{ child.get_menu_title|safe }}</a>
	{% endif %}
</li>
{% endfor %}
