<ul class="sidemenu">

	<li class="sidemenu-org-section" ng-if="::ctrl.isSignedIn" class="dropdown">
		<a class="sidemenu-org" href="profile">
			<div class="sidemenu-org-avatar">
				<img ng-src="{{::ctrl.user.gravatarUrl}}">
				<span class="sidemenu-org-avatar--missing">
					<i class="fa fa-fw fa-user"></i>
				</span>
			</div>
			<div class="sidemenu-org-details">
				<span class="sidemenu-org-user sidemenu-item-text">{{::ctrl.user.name}}</span>
				<span class="sidemenu-org-name sidemenu-item-text">{{::ctrl.user.orgName}}</span>
			</div>
		</a>
		<i class="fa fa-caret-right"></i>
		<ul class="dropdown-menu" role="menu">
			<li ng-repeat="menuItem in ctrl.orgMenu" ng-class="::menuItem.cssClass">
				<span ng-show="::menuItem.section">{{::menuItem.section}}</span>
				<a href="{{::menuItem.url}}" ng-show="::menuItem.url" target="{{::menuItem.target}}">
					<i class="{{::menuItem.icon}}" ng-show="::menuItem.icon"></i>
					{{::menuItem.text}}
				</a>
			</li>
            <li ng-show="ctrl.orgs.length > ctrl.maxShownOrgs" style="margin-left: 10px;width: 90%">
                <span class="sidemenu-item-text">Max shown : {{::ctrl.maxShownOrgs}}</span>
                <input ng-model="::ctrl.orgFilter" style="padding-left: 5px" type="text" ng-change="::ctrl.loadOrgsItems();" class="gf-input-small width-12" placeholder="Filter">
            </li>
            <li ng-repeat="orgItem in ctrl.orgItems" ng-class="::orgItem.cssClass">
				<a href="{{::orgItem.url}}" ng-show="::orgItem.url" target="{{::orgItem.target}}">
					<i class="{{::orgItem.icon}}" ng-show="::orgItem.icon"></i>
					{{::orgItem.text}}
				</a>
			</li>
		</ul>
	</li>

	<li ng-repeat="item in ::ctrl.mainLinks" class="dropdown">
		<a href="{{::item.url}}" class="sidemenu-item sidemenu-main-link" target="{{::item.target}}">
			<span class="icon-circle sidemenu-icon">
				<i class="{{::item.icon}}" ng-show="::item.icon"></i>
				<img ng-src="{{::item.img}}" ng-show="::item.img">
			</span>
			<span class="sidemenu-item-text">{{::item.text}}</span>
			<span class="fa fa-caret-right" ng-if="::item.children"></span>
		</a>
		<ul class="dropdown-menu" role="menu" ng-if="::item.children">
			<li ng-repeat="child in ::item.children" ng-class="{divider: child.divider}">
				<a href="{{::child.url}}">
					<i class="{{::child.icon}}" ng-show="::child.icon"></i>
					{{::child.text}}
				</a>
			</li>
		</ul>
	</li>

	<li ng-show="::!ctrl.isSignedIn">
    <a href="{{ctrl.loginUrl}}" class="sidemenu-item" target="_self">
			<span class="icon-circle sidemenu-icon"><i class="fa fa-fw fa-sign-in"></i></span>
			<span class="sidemenu-item-text">Sign in</span>
		</a>
	</li>

	<li>
		<a class="sidemenu-item" target="_self" ng-hide="ctrl.contextSrv.pinned" ng-click="ctrl.contextSrv.setPinnedState(true)">
			<span class="icon-circle sidemenu-icon"><i class="fa fa-fw fa-thumb-tack"></i></span>
			<span class="sidemenu-item-text">Pin</span>
		</a>
	</li>
</ul>

