<!-- Page Header -->
<header>
  <h1 class="logo">
    <a href="/">GITLAB</a>
  </h1>
  <div class="account-box">
    <%= link_to profile_path, :class => "pic" do %>
      <%= image_tag gravatar_icon(current_user.email) %>
    <% end %>

    <div class="account-links">
      <%= link_to profile_path, :class => "username" do %>
        <%#= current_user.name %> 
        My profile
      <% end %>
      <%= link_to 'Logout', destroy_user_session_path, :class => "logout", :method => :delete %>
    </div>
  </div><!-- .account-box -->

  <div class="search">
    <%= text_field_tag "search", nil, :placeholder => "Search", :class => "search-input"  %>
  </div>
  <!-- .login-top -->
  <nav>
    <%= link_to dashboard_path, :class => current_page?(root_path) ? "current dashboard" : "dashboard" do %>
      <span></span>Dashboard
    <% end %>
    <%= link_to projects_path, :class => current_page?(projects_path) ? "current project" : "project" do %>
      <span></span>Projects
    <% end %>
    <%= link_to((current_user.is_admin? ? admin_root_path : "#"), :class => (admin_namespace? ? "current admin" : "admin")) do %>
      <span></span>Admin
    <% end  %>
  </nav>

</header>
<!-- eo Page Header -->

<% if current_user %>
  <%= javascript_tag do %>
    $(function() {
      $("#search" ).autocomplete({
        source: <%= raw search_autocomplete_source %>,
        select: function(event, ui) { location.href = ui.item.url }
        });
    });
  <% end %>
<% end %>

<% if current_user.keys.all.empty? %>
  <div id="no_ssh_key_defined">
    <h2>ATTENTION!</h2>
    <p>No SSH Key is defined. You won't be able to use any Git command!
    <p>Click <%=link_to( 'here', keys_path ) %> to add one!
  </div>
<% end %>
