jumpserver/apps/templates/_user_profile.html

48 lines
1.8 KiB
HTML
Raw Normal View History

{% load static %}
2016-09-03 16:51:36 +00:00
{% load i18n %}
<li class="nav-header">
<div class="dropdown profile-element">
<span>
2017-12-29 18:29:29 +00:00
<img alt="image" class="img-circle" width="48" height="48" src="{{ request.user.avatar_url }}"/>
</span>
<a data-toggle="dropdown" class="dropdown-toggle" href="#">
<span class="clear">
<span class="block m-t-xs">
2017-12-29 18:29:29 +00:00
<strong class="font-bold"> {{ request.user.name }}<span style="color: #8095a8"></span></strong>
</span>
<span class="text-muted text-xs block">
2017-12-29 18:29:29 +00:00
{{ request.user.get_role_display | default:_('User') }}<b class="caret"></b>
</span>
</span>
</a>
<ul class="dropdown-menu animated fadeInRight m-t-xs">
2017-03-31 10:47:50 +00:00
<li><a href="{% url 'users:user-profile' %}">{% trans 'Profile' %}</a></li>
<li><a href="{% url 'users:user-profile-update' %}">{% trans 'Profile settings' %}</a></li>
<li class="divider"></li>
2017-12-21 03:31:13 +00:00
{% if request.user.is_superuser %}
2017-12-24 10:53:07 +00:00
{% if request.COOKIES.IN_ADMIN_PAGE == 'No' %}
2017-12-21 03:31:13 +00:00
<li><a id="switch_admin">{% trans 'Admin page' %}</a></li>
{% else %}
<li><a id="switch_user">{% trans 'User page' %}</a></li>
{% endif %}
{% endif %}
<li><a href="{% url 'users:logout' %}">{% trans 'Logout' %}</a></li>
</ul>
</div>
<div class="logo-element">
JMS
</div>
</li>
2017-12-21 03:31:13 +00:00
<script>
$(document).ready(function () {
})
.on('click', '#switch_admin', function () {
2017-12-24 10:53:07 +00:00
setCookie("IN_ADMIN_PAGE", "Yes");
2017-12-21 03:31:13 +00:00
window.location = "/"
})
.on('click', '#switch_user', function () {
2017-12-24 10:53:07 +00:00
setCookie("IN_ADMIN_PAGE", "No");
2017-12-21 03:31:13 +00:00
window.location = "/"
})
</script>