This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

Cpt.Meatball
Cpt.Meatball

As the standard partials for staticMenu do not include the classes that bootstrap's Navbar needs to generate dropdowns, I've made a simple edit so they do work.

partials/*component-alias*/default.htm

{% if __SELF__.menuItems %}
<ul class="nav navbar-nav">
    {% partial __SELF__ ~ "::items" items=__SELF__.menuItems %}
</ul>
{% endif %}

partials/*component-alias*/items.htm

{% for item in items %}
{% if item.items %}
    <li class="dropdown" {{ item.isChildActive ? 'child-active' : '' }}>
        <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{{item.title}} <span class="caret"></span></a>

        <ul class="dropdown-menu">{% partial __SELF__ ~ "::items" items=item.items %}</ul>
    </li>
{% else %}
<li class="{{ item.isActive ? 'active' : '' }}">
    <a href="{{ item.url }}">{{ item.title }}</a>
</li>
{%endif%}
{% endfor %}

Last updated

1-1 of 1

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.