## 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)
%>

<%!
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_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>
            <%
            username = self.real_user.username
            profile_image_url = get_profile_image_urls_for_user(self.real_user)['medium']
            %>
            <img class="menu-image" src="${profile_image_url}" alt="">
            ${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('learner_profile', kwargs={'username': self.real_user.username})}" role="menuitem" class="action dropdown-menuitem">${_("Profile")}</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>
                <%
                username = self.real_user.username
                profile_image_url = get_profile_image_urls_for_user(self.real_user)['medium']
                %>
                <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="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="dropdown-menu" aria-label="More Options" role="menu">
                    ${navigation_dropdown_menu_links()}
                    <li class="item"><a href="${reverse('logout')}" role="menuitem" class="dropdown-menuitem">${_("Sign Out")}</a></li>
                </ul>
            </div>
        </li>
    </ol>
% endif
