## mako
<%page expression_filter="h"/>
<%namespace name='static' file='static_content.html'/>

## This template should not use the target student's details when masquerading, see TNL-4895
<%
self.real_user = getattr(user, 'real_user', user)
username = self.real_user.username
profile_image_url = get_profile_image_urls_for_user(self.real_user)['medium']
%>

<%!
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext as _

from openedx.core.djangoapps.user_api.accounts.image_helpers import get_profile_image_urls_for_user
%>
% if uses_bootstrap:
    <div class="nav-item nav-item-hidden-collapsed container">
        <div class="nav align-items-center">
            <a class="menu-title mr-2" href="${reverse('dashboard')}">
                <span class="sr-only">${_("Dashboard for:")}</span>
                <img class="user-image-frame" src="${profile_image_url}" alt="${username}">
            </a>
            <div class="dropdown">
                <a class="dropdown-toggle" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">${username}</a>
                <ul role="menu" class="dropdown-menu dropdown-menu-right" id="${_("Usermenu")}" aria-labelledby="dropdownMenuLink" tabindex="-1">
                    <li role="presentation"><a role="menuitem" class="dropdown-item" href="${reverse('dashboard')}">${_("Dashboard")}</a></li>
                    <li role="presentation"><a role="menuitem" class="dropdown-item" href="${reverse('account_settings')}">${_("Account")}</a></li>
                    <li role="presentation"><a role="menuitem" class="dropdown-item" href="${reverse('logout')}">${_("Sign Out")}</a></li>
                </ul>
            </div>
        </div>
    </div>
    <ul role="menu" class="nav flex-column align-items-center">
        <li role="presentation" class="nav-item nav-item-open-collapsed-only collapse"><a role="menuitem" href="${reverse('dashboard')}">${_("Dashboard")}</a></li>
        <li role="presentation" class="nav-item nav-item-open-collapsed-only"><a role="menuitem" href="${reverse('account_settings')}">${_("Account")}</a></li>
        <li role="presentation" class="nav-item nav-item-open-collapsed-only"><a role="menuitem" href="${reverse('logout')}">${_("Sign Out")}</a></li>
    </ul>
% elif uses_pattern_library:
    <div class="wrapper-user-menu dropdown-menu-container logged-in js-header-user-menu">
        <a href="${reverse('dashboard')}" class="menu-title">
            <span class="sr-only">${_("Dashboard for:")}</span>
            <img class="menu-image" src="${profile_image_url}" alt="${username}">
            ${username}
        </a>
        <div role="group" aria-label="User menu" class="user-menu">
            <button type="button" class="menu-button button-more has-dropdown js-dropdown-button" aria-expanded="false" aria-controls="${_("Usermenu")}">
                  <span class="icon fa fa-caret-down" aria-hidden="true"></span>
                  <span class="sr-only">${_("Usermenu dropdown")}</span>
            </button>
            <ul class="dropdown-menu list-divided is-hidden" id="${_("Usermenu")}" tabindex="-1">
                <%block name="navigation_dropdown_menu_links" >
                    <li class="dropdown-item item has-block-link"><a href="${reverse('dashboard')}" role="menuitem" class="action dropdown-menuitem">${_("Dashboard")}</a></li>
                    <li class="dropdown-item item has-block-link"><a href="${reverse('account_settings')}" role="menuitem" class="action dropdown-menuitem">${_("Account")}</a></li>
                </%block>
                <li class="dropdown-item item has-block-link"><a href="${reverse('logout')}" role="menuitem" class="action dropdown-menuitem">${_("Sign Out")}</a></li>
            </ul>
        </div>
    </div>
% else:
    <ol class="user">
        <li class="primary">
            <a href="${reverse('dashboard')}" class="user-link">
                <span class="sr">${_("Dashboard for:")}</span>
                <img class="user-image-frame" src="${profile_image_url}" alt="">
                <div class="label-username">${username}</div>
            </a>
        </li>
        <li class="primary">
            <div class="user-menu">
                <button class="user-dropdown" aria-expanded="false" aria-haspopup="true">
                    <span class="sr">${_("More options")}</span>
                    <span class="fa fa-sort-desc" aria-hidden="true"></span>
                </button>
                <ul class="user-dropdown-menu" aria-label="More Options" role="menu">
                    ${navigation_dropdown_menu_links()}
                    <li class="item"><a href="${reverse('logout')}" role="menuitem" class="user-dropdown-menuitem">${_("Sign Out")}</a></li>
                </ul>
            </div>
        </li>
    </ol>
% endif
