## mako
## TODO: Split this into two files, one for people who are authenticated, and
## one for people who aren't. Assume a Course object is passed to the former,
## instead of using settings.COURSE_TITLE
<%namespace name='static' file='static_content.html'/>
<%!
from django.core.urlresolvers import reverse

# App that handles subdomain specific branding
import branding
%>

%if course:
  <header class="global slim" aria-label="Global Navigation">
%else:
  <header class="global" aria-label="Global Navigation">
%endif
  <nav>
  <h1 class="logo"><a href="${reverse('root')}"><img src="${static.url(branding.get_logo_url(request.META.get('HTTP_HOST')))}"/></a></h1>

    %if course:
      <h2><span class="provider">${course.org}:</span> ${course.number} ${course.title}</h2>
    %endif

    <ol class="left find-courses-button">
      <li class="primary">
        <a href="${reverse('courses')}">Find Courses</a>
      </li>
    </ol>

  %if user.is_authenticated():
    <ol class="user">
      <li class="primary">
        <a href="${reverse('dashboard')}" class="user-link">
          <span class="avatar"></span>
          ${user.username}
        </a>
      </li>
      <li class="primary">
        <a href="#" class="dropdown">&#9662</a>
        <ul class="dropdown-menu">
##          <li><a href="#">Account Settings</a></li>
          <li><a href="${reverse('help_edx')}">Help</a></li>
          <li><a href="${reverse('logout')}">Log Out</a></li>
        </ul>
      </li>
    </ol>

  %else:
    <ol class="guest">
      <li class="secondary">
        <a href="${reverse('about_edx')}">About</a>
        <a href="http://edxonline.tumblr.com/">Blog</a>
        <a href="${reverse('jobs')}">Jobs</a>
% if not settings.MITX_FEATURES['DISABLE_LOGIN_BUTTON']:
        <a href="#login-modal" id="login" rel="leanModal">Log In</a>
% endif
      </li>
% if not settings.MITX_FEATURES['DISABLE_LOGIN_BUTTON']:
      <li class="primary">
        <a href="#signup-modal" id="signup" rel="leanModal">Sign Up</a>
      </li>
% endif
    </ol>
  </nav>
  %endif
</header>

%if not user.is_authenticated():
  <%include file="login_modal.html" />
  <%include file="signup_modal.html" />
  <%include file="forgot_password_modal.html" />
%endif
