<span class="namespace-selector-dropdown">
  <span ng-show="user.organizations.length == 0">
    <img src="//www.gravatar.com/avatar/{{ user.gravatar }}?s=24&d=identicon" />
    <span class="namespace-name">{{user.username}}</span>
  </span>

  <div class="btn-group" ng-show="user.organizations.length > 0">
  <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
    <img src="//www.gravatar.com/avatar/{{ namespaceObj.gravatar }}?s=16&d=identicon" />
    {{namespace}} <span class="caret"></span>
  </button>
  <ul class="dropdown-menu" role="menu">
    <li class="namespace-item" ng-repeat="org in user.organizations"
        ng-class="(requireCreate && !namespaces[org.name].can_create_repo) ? 'disabled' : ''">
      <a class="namespace" href="javascript:void(0)" ng-click="setNamespace(org)">
        <img src="//www.gravatar.com/avatar/{{ org.gravatar }}?s=24&d=identicon" />
        <span class="namespace-name">{{ org.name }}</span>    
      </a>

      <i class="fa fa-exclamation-triangle" ng-show="requireCreate && !namespaces[org.name].can_create_repo"
         data-title="You do not have permission to create repositories for this organization"
         data-placement="right"
         bs-tooltip="tooltip.title"></i>
    </li>
    <li class="divider"></li>
    <li>
      <a class="namespace" href="javascript:void(0)" ng-click="setNamespace(user)">
        <img src="//www.gravatar.com/avatar/{{ user.gravatar }}?s=24&d=identicon" />
        <span class="namespace-name">{{ user.username }}</span>
      </a>
    </li>
  </ul>
</div>
</span>
