<nav id="app-navbar" class="navbar navbar-inverse">
  <div class="container-fluid" >
    <!-- Brand and toggle get grouped for better mobile display -->
    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#app-navbar-menu" aria-expanded="false">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <%= link_to(image_tag("logo.png",
                            alt: "#{Rails.configuration.branding[:application][:name]} #{_('logo')}",
                            class: "app-logo",
                            title: Rails.configuration.branding[:application][:name]),
                  root_path) %>
    </div>

    <!-- Collect the nav links, forms, and other content for toggling -->
    <div class="collapse navbar-collapse" id="app-navbar-menu">
      <ul class="nav navbar-nav">
        <% if user_signed_in? %>
          <li class="<%= ' active' if active_page?(root_path) %>">
            <%= link_to _('My Dashboard'), plans_path %>
          </li>
          <li <%= 'class=active' if active_page?(new_plan_path) %>>
            <%= link_to _('Create plans'), new_plan_path %>
          </li>
            <li class="dropdown" id="reference-dropdown">
              <a href="#" class="dropdown-toggle" role="button" id="reference-menu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                <i class="fa fa-book" aria-hidden="true">&nbsp;</i>
                <%= _("Reference") %>
                <span class="caret"></span>
              </a>
              <ul class="dropdown-menu inverse-dropdown" aria-labelledby="reference-menu">
                <li <%= 'class=active' if active_page?(public_plans_path) %>>
                  <%= link_to _('Public DMPs'), public_plans_path %>
                </li>
                <li <%= 'class=active' if active_page?(public_templates_path) %>>
                  <%= link_to _('DMP Templates'), public_templates_path %>
              </ul>
            </a>
          </li>
        <% else %>
          <li <%= 'class=active' if active_page?(root_path, true) || active_page?(plans_path, true) %>>
            <%= link_to _('Home'), root_path %>
          </li>
          <li <%= 'class=active' if active_page?(public_plans_path, true) %>>
            <%= link_to _('Public DMPs'), public_plans_path %>
          </li>
          <li <%= 'class=active' if active_page?(public_templates_path, true) %>>
            <%= link_to _('DMP Templates'), public_templates_path %>
          </li>
        <% end %>
        <!-- help page -->
        <li <%= 'class=active' if active_page?(help_path, true) %>>
          <%= link_to _('Help'), help_path %>
        </li>
      </ul>
      <ul class="nav navbar-nav navbar-right">
          <%= render "layouts/signin_signout" %>
      </ul>

      <% unless active_page?(root_path, true) %>
        <%= render partial: 'shared/access_controls', layout: 'shared/modal', locals: { id: "header-signin", title: _('Sign in')} %>
      <% end %>
    </div><!-- /.navbar-collapse -->
  </div><!-- /.container-fluid -->
</nav>


