<div class="container">
  <div class="navbar-header">
    <a class="navbar-brand {{#if logoUrl}}navbar-brand-custom{{/if}}" href="{{link '/'}}">
      {{#if logoUrl}}
        <img src="{{logoUrl}}" {{#if logoWidth}}width="{{logoWidth}}"{{/if}} height="30"
             alt="{{t 'layout.sonar.slogan'}}" title="{{t 'layout.sonar.slogan'}}">
      {{else}}
        {{> '_nav-logo'}}
      {{/if}}
    </a>
  </div>

  <ul class="nav navbar-nav">
    <li class="dropdown t-dashboards">
      <a class="dropdown-toggle" data-toggle="dropdown" href="#">
        {{t 'layout.dashboards'}}&nbsp;<span class="icon-dropdown"></span>
      </a>
      <ul class="dropdown-menu">
        {{#each globalDashboards}}
          <li>
            <a href="{{link '/dashboard/index?did=' key}}">{{dashboardL10n name}}</a>
          </li>
        {{/each}}
        {{#if canManageGlobalDashboards}}
          <li class="divider"></li>
          <li>
            <a href="{{link '/dashboards'}}">{{t 'dashboard.manage_dashboards'}}</a>
          </li>
        {{/if}}
      </ul>
    </li>
    <li {{#isActiveLink '/issues'}}class="active"{{/isActiveLink}}>
      <a href="{{link '/issues/search'}}">{{t 'issues.page'}}</a>
    </li>
    <li {{#isActiveLink '/measures'}}class="active"{{/isActiveLink}}>
      <a href="{{link '/measures/search?qualifiers[]=TRK'}}">{{t 'layout.measures'}}</a>
    </li>
    <li {{#isActiveLink '/coding_rules'}}class="active"{{/isActiveLink}}>
      <a href="{{link '/coding_rules'}}">{{t 'coding_rules.page'}}</a>
    </li>
    <li {{#isActiveLink '/profiles'}}class="active"{{/isActiveLink}}>
      <a href="{{link '/profiles'}}">{{t 'quality_profiles.page'}}</a>
    </li>
    <li {{#isActiveLink '/quality_gates'}}class="active"{{/isActiveLink}}>
      <a href="{{link '/quality_gates'}}">{{t 'quality_gates.page'}}</a>
    </li>
    {{#if isUserAdmin}}
      <li {{#isActiveLink '/settings'}}class="active"{{/isActiveLink}}>
        <a class="navbar-admin-link" href="{{link '/settings'}}">{{t 'layout.settings'}}</a>
      </li>
    {{/if}}
    <li class="dropdown t-more">
      <a class="dropdown-toggle" data-toggle="dropdown" href="#">{{t 'more'}}&nbsp;<i class="icon-dropdown"></i></a>
      <ul class="dropdown-menu">
        <li>
          <a href="{{link '/comparison'}}">{{t 'comparison_global.page'}}</a>
        </li>
        {{#each globalPages}}
          <li>
            <a href="{{link url}}">{{name}}</a>
          </li>
        {{/each}}
      </ul>
    </li>
  </ul>

  <ul class="nav navbar-nav navbar-right">
    {{#if user}}
      <li class="dropdown">
        <a class="dropdown-toggle" data-toggle="dropdown" href="#">
          {{#ifShowAvatars}}<span class="little-spacer-right">{{avatarHelper userEmail 20}}&nbsp;{{/ifShowAvatars}}</span>{{userName}}&nbsp;<span class="icon-dropdown"></span>
        </a>
        <ul class="dropdown-menu dropdown-menu-right">
          <li>
            <a href="{{link '/account/index'}}">{{t 'layout.user_panel.my_profile'}}</a>
          </li>
          <li>
            <a href="{{link '/sessions/logout'}}"
               onclick="if (sonarRecentHistory) { sonarRecentHistory.clear(); }">{{t 'layout.logout'}}</a>
          </li>
        </ul>
      </li>
    {{else}}
      <li>
        <a class="js-login" href="{{link '/sessions/new'}}">{{t 'layout.login'}}</a>
      </li>
    {{/if}}
    <li class="dropdown js-search-dropdown">
      <a class="dropdown-toggle navbar-search-dropdown js-search-dropdown-toggle" data-toggle="dropdown" href="#">
        <i class="icon-search navbar-icon"></i>&nbsp;<span class="icon-dropdown"></span>
      </a>

      <div class="js-search-region dropdown-menu dropdown-menu-right"></div>
    </li>
    <li>
      <a class="js-shortcuts" href="#">
        <i class="icon-help navbar-icon"></i>
      </a>
    </li>
  </ul>

</div>
