{% load i18n grp_tags %}

<div id="grp-navigation">
    <h1 id="grp-admin-title">{% if grappelli_admin_title %}{{ grappelli_admin_title }}{% else %}{% get_admin_title %}{% endif %}</h1>
    {% if user.is_authenticated and user.is_staff %}
        <ul id="grp-user-tools">
            <!-- Userlinks -->
            {% block userlinks %}
                <!-- Username -->
                <li class="grp-user-options-container grp-collapse grp-closed {% if request.session.original_user %}grp-switch-user-is-target{% endif %}">
                    <a href="javascript://" class="user-options-handler grp-collapse-handler {% if request.session.original_user %}grp-switch-user-is-target{% else %}grp-switch-user-is-original{% endif %}">{% filter force_escape %}{% firstof user.first_name user.username user.get_short_name user.get_username %}{% endfilter %}</a>
                    <ul class="grp-user-options">
                        <!-- Change Password -->
                        {% if user.has_usable_password %}
                            {% url 'admin:password_change' as password_change_url %}
                            {% if password_change_url %}
                                <li><a href="{{ password_change_url }}" class="grp-change-password">
                            {% else %}
                                <li><a href="{{ root_path }}password_change/" class="grp-change-password">
                            {% endif %}
                            {% trans 'Change password' %}</a></li>
                        {% endif %}
                        <!-- Logout -->
                        {% url 'admin:logout' as logout_url %}
                        {% if logout_url %}
                            <li><a href="{{ logout_url }}" class="grp-logout">
                        {% else %}
                            <li><a href="{{ root_path }}logout/" class="grp-logout">
                        {% endif %}
                        {% trans 'Log out' %}</a></li>
                    </ul>
                </li>
                <!-- JS tests -->
                {% url 'test-index' as testindexurl %}
                {% if testindexurl %}
                    <li><a href="{{ testindexurl }}">{% trans 'Tests' %}</a></li>
                {% endif %}
                <!-- Documentation -->
                {% url 'django-admindocs-docroot' as docsroot %}
                {% if docsroot %}
                    <li><a href="{{ docsroot }}">{% trans 'Documentation' %}</a></li>
                {% endif %}
            {% endblock %}
        </ul>
    {% endif %}
    <!-- Nav-Global -->
    {% block nav-global %}{% endblock %}
</div>

<script type="text/javascript" charset="utf-8">
    (function($) {
        $(document).ready(function() {
            $("#grp-navigation .grp-collapse").grp_collapsible();
        });
    })(grp.jQuery);
</script>

