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

<%!
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 = user.username
            profile_image_url = get_profile_image_urls_for_user(user)['medium']
            %>
            <img class="menu-image" src="${profile_image_url}" alt="">
            ${username}
        </a>
        <button type="button" class="menu-button button-more has-dropdown js-dropdown-button default-icon" aria-haspopup="true" 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')}" class="action">${_("Dashboard")}</a></li>
                <li class="dropdown-item item has-block-link"><a href="${reverse('learner_profile', kwargs={'username': user.username})}" class="action">${_("Profile")}</a></li>
                <li class="dropdown-item item has-block-link"><a href="${reverse('account_settings')}" class="action">${_("Account")}</a></li>
            </%block>
            <li class="dropdown-item item has-block-link"><a href="${reverse('logout')}" role="menuitem" class="action">${_("Sign Out")}</a></li>
        </ul>
    </div>
% else:
    <ol class="user">
        <li class="primary">
            <a href="${reverse('dashboard')}" class="user-link">
                <span class="sr">${_("Dashboard for:")}</span>
                <%
                username = user.username
                profile_image_url = get_profile_image_urls_for_user(user)['medium']
                %>
                <img class="user-image-frame" src="${profile_image_url}" alt="${_('Profile image for {username}').format(username=username)}">
                <div class="label-username">${username}</div>
            </a>
        </li>
        <li class="primary">
            <button class="dropdown" aria-haspopup="true" aria-expanded="false"><span class="sr">${_("More options dropdown")}</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">${_("Sign Out")}</a></li>
            </ul>
        </li>
    </ol>
% endif
