Skip to content

Instantly share code, notes, and snippets.

@washort
Created February 21, 2012 18:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save washort/1878014 to your computer and use it in GitHub Desktop.
Save washort/1878014 to your computer and use it in GitHub Desktop.
{% set amo_user = request.amo_user %}
{% if user.is_authenticated() %}
<li class="account">
<a href="#" class="user" title="{{ amo_user.email }}">
{{ amo_user.welcome_name }}</a>
{% if account_links %}
<ul>
{% for link in account_links %}
{% if not loop.last %}
<li><a href="{{ link.href }}">{{ link.text }}</a></li>
{% endif %}
{% endfor %}
</ul>
{% endif %}
</li>
<li class="nomenu logout">
<a href="{{ url('users.logout') }}">{{ _('Log out') }}</a>
</li>
{% else %}
<li class="account anonymous nomenu logout{{ ' legacy' if not waffle.switch('browserid-login') }}">
{% if waffle.switch('browserid-login') %}
<a contextmenu="login" href="{{ login_link() }}" class="browserid-login"
data-url="{{ url('users.browserid_login') }}"
data-profile-form-url="{{ url('users.complete_profile_form') }}">
{{ _('Log in / Register') }}</a>
<menu type="context" id="login">
<menuitem data-url="{{ login_link() }}#open" label="{{ _('Admin / Editor Log in') }}" id="admin-login"></menuitem>
</menu>
{% else %}
{% trans login=login_link() %}
<a id="amo-register" href="#">Register</a> or <a href="{{ login }}">Log in</a>
{% endtrans %}
<div id="register-dropdown">Email: <form action="{{ url('users.maybe_register') }}" method="POST">{{ csrf }}<input type="text" name="email"><button type="submit">{{ _('Register') }}</button></div>
{% endif %}
</li>
{% endif %}
{% if user.is_authenticated() %}
{% if tools_links|count > 1 %}
<li class="tools">
<a href="#">{{ tools_title }}</a>
<ul>
{% for link in tools_links %}
<li><a href="{{ link.href }}">{{ link.text }}</a></li>
{% endfor %}
</ul>
</li>
{% elif tools_links %}
<li class="context tools nomenu">
<a href="{{ tools_links[0].href }}">{{ tools_links[0].text }}</a>
</li>
{% endif %}
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment