<%! from django.core.urlresolvers import reverse %>

<% active_tab_class = 'active-tab-' + active_tab if active_tab else '' %>
<header class="primary-header ${active_tab_class}">  
  <div class="class">
    <div class="inner-wrapper">
      <div class="left">        
        % if context_course:
          <% ctx_loc = context_course.location %>
          <a href="/" class="home"><span class="small-home-icon"></span></a> › 
          <a href="${reverse('course_index', kwargs=dict(org=ctx_loc.org, course=ctx_loc.course, name=ctx_loc.name))}" class="class-name">${context_course.display_name}</a> ›
        % endif
      </div>

      <div class="right">
        <span class="username">${ user.username }</span>
        % if user.is_authenticated():
           <a href="${reverse('logout')}" class="log-out"><span class="log-out-icon"></span></a>
        % else:
           <a href="${reverse('login')}">Log in</a>
        % endif
      </div>
    </div>
  </div>
  <nav class="class-nav-bar">
    % if context_course:
    <% ctx_loc = context_course.location %>
    <ul class="class-nav inner-wrapper">
      <li><a href="${reverse('course_index', kwargs=dict(org=ctx_loc.org, course=ctx_loc.course, name=ctx_loc.name))}" id='courseware-tab'>Courseware</a></li>
      <li><a href="${reverse('course_info', kwargs=dict(org=ctx_loc.org, course=ctx_loc.course, name=ctx_loc.name))}" id='courseinfo-tab'>Course Info</a></li>
      <li><a href="${reverse('edit_tabs', kwargs=dict(org=ctx_loc.org, course=ctx_loc.course, coursename=ctx_loc.name))}" id='pages-tab'>Pages</a></li>
      <li><a href="${reverse('manage_users', kwargs=dict(location=ctx_loc))}" id='users-tab'>Users</a></li>
      <li><a href="${reverse('asset_index', kwargs=dict(org=ctx_loc.org, course=ctx_loc.course, name=ctx_loc.name))}" id='assets-tab'>Assets</a></li>
      <li><a href="${reverse('course_settings', kwargs=dict(org=ctx_loc.org, course=ctx_loc.course, name=ctx_loc.name))}" id='settings-tab'>Settings</a></li>
      <li><a href="${reverse('import_course', kwargs=dict(org=ctx_loc.org, course=ctx_loc.course, name=ctx_loc.name))}" id='import-tab'>Import</a></li>
      <li><a href="${reverse('export_course', kwargs=dict(org=ctx_loc.org, course=ctx_loc.course, name=ctx_loc.name))}" id='export-tab'>Export</a></li>
    </ul>
    % endif
  </nav>
</header>
