<template name="navbar">
  <div class="template-navbar">
    <div class="navbar navbar-inverse">
      <div class="container close-navbar">
        <div class="navbar-header">
          <input type="checkbox" id="sliding-menu-controller" class="hide">
          <label type="button" class="navbar-toggle" for="sliding-menu-controller">
            <span class="icon"></span>
          </label>
          <div class="sliding-menu visible-xs">
            <div class="panel panel-default">
              {{#if User}}
                <div class="panel-heading">{{niceName User._id}}</div>
                <div class="list-group">
                  <a class="list-group-item" href="{{pathFor 'profile'}}">{{_ "profile"}}</a>
                  <a class="list-group-item" href="{{pathFor 'account'}}">{{_ "account"}}</a>
                  <a class="list-group-item" href="{{pathFor 'notifications'}}">
                    {{#if notificationCount}}
                      <span class="badge bg-success">{{notificationCount}}</span>
                    {{/if}}
                    {{_ "notifications"}}
                  </a>
                  <a class="list-group-item" href="/sign-out">{{_ "signout"}}</a>
                </div>
              {{/if}}
            </div>
          </div>
          <a class="navbar-brand" href="{{#if User}}{{Config.dashboardRoute}}{{else}}{{Config.homeRoute}}{{/if}}">{{{Config.logo}}}</a>
        </div>
        <div class="navbar-collapse collapse" id="bs-example-navbar-collapse-1">
          <ul class="nav navbar-nav navbar-right">
            {{#if User}}
              {{> notificationsDropdown}}
              {{#if isInRole 'admin'}}
                <li><a href="{{pathFor 'adminDashboard'}}">{{_ "admin"}}</a></li>
              {{/if}}
              {{> userDropdown}}
              <li class="visible-xs">
                <a href="{{pathFor 'profile'}}" class="close-navbar">{{_ "edit_profile"}}</a>
              </li>
              <li class="visible-xs">
                <a class="close-navbar" href="/sign-out">{{_ "signout"}}</a>
              </li>
            {{else}}
              <li>
                <a class="close-navbar" href="/sign-up">{{_ "signup"}}</a>
              </li>
              <li>
                <a class="close-navbar" href="/sign-in">{{_ "login"}}</a>
              </li>
            {{/if}}
          </ul>
        </div>
      </div>
    </div>
  </div>
</template>
