<a id="me-btn"
   class="ui-btn-right"
   data-role="button"
   {{action "meClicked" target="view"}}>
    {{#if view.gravatarURL}}
        <img class="gravatar-image" {{bind-attr src="view.gravatarURL"}}/>
    {{else}}
        <img class="gravatar-image" src="resources/images/user.png" />

    {{/if}}
    &nbsp;</a>

<div id="user-menu-popup" data-role="popup" data-position-to="#me-btn" data-theme="b" data-overlay-theme="b" data-transition="flip">

    <div data-role="content">

        <div>{{EMAIL}}</div>

        <a href="https://mistio.zendesk.com/access/login"
           target="_blank"
           data-role="button"
           data-mini="true">Support</a>

        {{#if Mist.authenticated}}

            <a data-role="button" data-mini="true"
               {{bind-attr href="view.accountUrl"}}
               {{bind-attr target="view.isNotCore"}}>Account</a>

            {{#if Mist.isCore}}
                <button data-mini="true" {{action "logoutClicked" target="view"}}>Logout</a>
            {{/if}}
        {{else}}
            {{#unless Mist.isCore}}
                <button data-mini="true" {{action "loginClicked" target="view"}}>Login</a>
            {{/unless}}
        {{/if}}

    </div>

</div>

{{view Mist.loginView}}