{% load lib_tags %}

<!-- Brand and toggle get grouped for better mobile display -->
<div class="row">
  {% block before_menubar %}{% endblock %}
  <div class="btn-toolbar {{ extraclasses }} {% block menubar_classes %}col-xs-12{% endblock %}">
    {% for entry in entries %}
    <div class="btn-group">
      {% if entry.menu %}
        {% if entry.url %}
      <a name="{{ entry.name }}" class="btn {{ entry.class }}" href="{{ entry.url }}" title="{{ entry.title }}">
        {% if entry.img %}<span class="{{ entry.img}}"></span> {% endif %}{{ entry.label }}</a>
      <button type="button" class="btn {{ entry.class }} dropdown-toggle" data-toggle="dropdown">
        <span class="caret"></span>
        <span class="sr-only">Toggle Dropdown</span>
      </button>
        {% else %}
      <button type="button" title="{{ entry.title }}" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
        {% if entry.img %}<span class="{{ entry.img}}"></span> {% endif %}{{ entry.label }}
        <span class="caret"></span>
      </button>
        {% endif %}
      <ul class="dropdown-menu">
        {% for sentry in entry.menu %}
          {% if sentry.divider %}
        <li class="divider"></li>
          {% else %}
        <li>{% render_link sentry %}</li>
          {% endif %}
        {% endfor %}
      </ul>
      {% else %}
        {% render_link entry "btn" %}
      {% endif %}
    </div>
    {% endfor %}
    {% block extra_buttons %}{% endblock %}
  </div>
  {% block after_menubar %}{% endblock %}
</div>

