## mako

<%page expression_filter="h"/>

<%namespace name='static' file='../../static_content.html'/>
<%namespace file='../../main.html' import="login_query"/>
<%!
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext as _
%>

<div class="collapse navbar-collapse" id="navbarSupportedContent">
  <ul class="navbar-nav mr-auto">
     % if course:
      <div class="course-header">
        <span class="provider">${course.display_org_with_default}:</span>
        <span class="course-number">${course.display_number_with_default}</span>
        <%
        display_name = course.display_name_with_default
        if settings.FEATURES.get('CUSTOM_COURSES_EDX', False):
          ccx = get_current_ccx(course.id)
          if ccx:
            display_name = ccx.display_name
        %>
        <span class="course-name">${display_name}</span>
      </div>
    % endif


    % if settings.FEATURES.get('COURSES_ARE_BROWSABLE') and not show_program_listing:
      <li class="nav-item mt-2 nav-item-open-collapsed">
        <a class="nav-link" href="${marketing_link('COURSES')}">${_('Explore courses')}</a>
      </li>
    % endif

    % if show_dashboard_tabs:
      <li class="nav-item mt-2 nav-item-open-collapsed">
        <a class="nav-link ${'active' if reverse('dashboard') == request.path else ''}" href="${reverse('dashboard')}">
          ${_("Courses")}
        </a>
      </li>
      % if show_program_listing:
        <li class="nav-item mt-2 nav-item-open-collapsed">
          <a class="nav-link ${'active' if reverse('program_listing_view') in request.path else ''}" href="${reverse('program_listing_view')}">
            ${_("Programs")}
          </a>
        </li>
      % endif
      <%
        self.real_user = getattr(user, 'real_user', user)
        is_on_profile_page = data and data.get('profile_user_id') is not None
      %>
      <li class="nav-item mt-2 nav-item-open-collapsed">
        <a class="${'active ' if is_on_profile_page else ''}tab-nav-link" href="${reverse('learner_profile', args=[self.real_user.username])}">
          ${_("Profile")}
        </a>
      </li>
    % endif

    % if settings.FEATURES.get('ENABLE_SYSADMIN_DASHBOARD','') and user.is_staff:
      <li class="nav-item mt-2 nav-item-open-collapsed">
        ## Translators: This is short for "System administration".
        <a class="nav-link" href="${reverse('sysadmin')}">${_("Sysadmin")}</a>
      </li>
    % endif
  </ul>

  <ul class="navbar-nav navbar-right">
    % if should_display_shopping_cart_func() and not (course and static.is_request_in_themed_site()): # see shoppingcart.context_processor.user_has_cart_context_processor
      <a role="button" class="nav-item-open-collapsed btn-shopping-cart btn" href="${reverse('shoppingcart.views.show_cart')}">
        <span class="icon fa fa-shopping-cart" aria-hidden="true"></span> ${_("Shopping Cart")}
      </a>
    % endif

    <li class="nav-item mt-2 nav-item-open-collapsed">
      <a href="${get_online_help_info(online_help_token)['doc_url']}"
       target="_blank"
       class="nav-link">${_("Help")}</a>
    </li>

    <%include file="../../user_dropdown.html"/>
  </ul>
</div>
