<%= link_to "Huginn", root_path, :class => 'brand' %>

<% if user_signed_in? %>
  <ul class='nav pull-left'>
    <%= nav_link "Agents", agents_path %>
    <%= nav_link "Events", events_path %>
    <%= nav_link "Credentials", user_credentials_path %>
  </ul>
<% end %>

<ul class="nav pull-right">
  <% if user_signed_in? %>

    <form class="navbar-search pull-left">
      <input type="text" class="search-query" id='agent-navigate' autocomplete="off" placeholder="Search">
      <%= image_tag "spinner-arrows.gif", :class => "spinner" %>
    </form>

    <li id='job-indicator'>
      <% if defined?(DelayedJobWeb) %>
        <a href="/delayed_job">
          <span class="badge"><i class="icon-refresh icon-white"></i> <span class='number'>0</span></span>
        </a>
      <% else %>
        <a href="#" onclick='return false;'>
          <span class="badge"><i class="icon-refresh icon-white"></i> <span class='number'>0</span></span>
        </a>
      <% end %>
    </li>

    <li id='event-indicator'>
      <a href="#">
        <span class="badge"><i class="icon-random icon-white"></i> <span class='number'>0</span> new events</span>
      </a>
    </li>
  <% end %>

  <li class="dropdown">
    <a href="#" class="dropdown-toggle" data-toggle="dropdown">
      Account
      <b class="caret"></b>
    </a>
    <ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
      <li>
        <% if user_signed_in? %>
          <%= link_to 'Account', edit_user_registration_path, :tabindex => "-1" %>
        <% else %>
          <%= link_to 'Sign up', new_user_registration_path, :tabindex => "-1" %>
        <% end %>
      </li>

      <li>
        <%= link_to 'About', 'https://github.com/cantino/huginn', :tabindex => "-1" %>
      </li>

      <li>
        <% if user_signed_in? %>
          <%= link_to 'Logout', destroy_user_session_path, :method => :delete, :tabindex => "-1" %>
        <% else %>
          <%= link_to 'Login', new_user_session_path, :tabindex => "-1" %>
        <% end %>
      </li>
    </ul>
  </li>
</ul>

