profile.html 4.48 KB
Newer Older
1
{% extends "dashboard/base.html" %}
2
{% load staticfiles %}
3
{% load i18n %}
4
{% load crispy_forms_tags %}
5
{% load arrowfilter %}
6 7 8 9 10 11

{% block title-page %}{{ profile.username}} | {% trans "Profile" %}{% endblock %}

{% block content %}

<div class="row">
12
  <div class="col-md-{% if perms.auth.change_user %}8{% else %}12{% endif %}">
13 14
    <div class="panel panel-default">
      <div class="panel-heading">
15 16 17 18 19 20 21 22 23 24 25
        <div class="pull-right">
          {% if request.user.is_superuser %}
          <a href="{{ login_token }}" class="btn btn-danger btn-xs"
            title="{% trans "Log in as this user. Recommended to open in an incognito window." %}">
            <i class="fa fa-user-secret"></i>
            {% trans "Login as this user" %}
          </a>
          {% endif %}
          <a class="btn btn-default btn-xs" href="{% url "dashboard.views.user-list" %}">
            {% trans "Back" %}</a>
        </div>
26 27 28 29 30
        <h3 class="no-margin">
          {% include "dashboard/_display-name.html" with user=profile show_org=True %}
        </h3>
      </div>
      <div class="panel-body">
31 32
        <div class="row">
          <div class="col-sm-4">
33
            <img id="dashboard-profile-avatar" src="{{ avatar_url }}" class="img-rounded"/>
34
          </div>
35
          <div class="col-sm-8">
36
            <p>{% trans "Username" %}: {{ profile.username }}</p>
Kálmán Viktor committed
37
            <p>{% trans "Organization ID" %}: {{ profile.profile.org_id|default:"-" }}</p>
38 39
            <p>{% trans "First name" %}: {{ profile.first_name|default:"-" }}</p>
            <p>{% trans "Last name" %}: {{ profile.last_name|default:"-" }}</p>
40
            <p>
41
              {% if perm_email %}
42 43 44
                {% trans "Email address" %}: {{ profile.email }}
              {% endif %}
            </p>
Kálmán Viktor committed
45
            <p>{% trans "Last login" %}: <span title="{{ profile.last_login  }}">{{ profile.last_login|arrowfilter:LANGUAGE_CODE}}</span></p>
46
            {% if request.user == profile %}
47
            <p>
48
              {% trans "Use email address as Gravatar profile image" %}:
49
              <input id="dashboard-profile-use-gravatar" data-user="{{ profile.username }}"
50
              {% if profile.profile.use_gravatar %}checked="checked"{% endif %}
51
              type="checkbox"/> <a href="https://gravatar.com">{% trans "What's Gravatar?" %}</a>
52
            </p>
53
            <a href="{% url "dashboard.views.profile-preferences" %}">{% trans "Change my preferences" %}</a>
54
            {% endif %}
55 56 57
          </div>
        </div>

58 59 60
        {% if perm_group_list %}
          <hr />
          <h4>
61
            <i class="fa fa-group"></i> {% trans "Groups" %}
62 63
          </h4>
          <ul class="dashboard-profile-group-list">
64 65
            {% for g in groups %}
            <li><a href="{{ g.profile.get_absolute_url }}">{{ g.name }}</a></li>
66 67
            {% empty %}
            {% trans "This user is not in any group." %}
68
            {% endfor %}
69 70
          </ul>
        {% endif %}
71 72 73 74

        <hr />

        <h4>
75
          <i class="fa fa-desktop"></i>
76
          {% trans "Virtual machines owned by the user" %} ({{ instances_owned|length }})
77
        </h4>
78
        <ul class="dashboard-profile-vm-list fa-ul">
79 80 81
        {% for i in instances_owned %}
          <li>
            <a href="{{ i.get_absolute_url }}">
82
              <i class="fa fa-li {{ i.get_status_icon }}"></i>
83 84 85 86 87 88 89 90 91 92 93 94 95
              {{ i }}
            </a>
          </li>
          {% empty %}
          <li>
            {% trans "This user have no virtual machines." %}
          </li>
        {% endfor %}
        </ul>

        <hr />

        <h4>
96
          <i class="fa fa-desktop"></i>
97
          {% trans "Virtual machines with access" %} ({{ instances_with_access|length }})
98
        </h4>
99
        <ul class="dashboard-profile-vm-list fa-ul">
100 101 102
        {% for i in instances_with_access %}
          <li>
            <a href="{{ i.get_absolute_url }}">
103
              <i class="fa fa-li {{ i.get_status_icon }}"></i>
104 105 106 107 108 109 110 111 112 113 114 115
              {{ i }}
            </a>
          </li>
          {% empty %}
          <li>
            {% trans "This user have no access to any virtual machine." %}
          </li>
        {% endfor %}
        </ul>
      </div>
    </div>
  </div>
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132

  {% if perms.auth.change_user %}
  <div class="col-md-4">
    <div class="panel panel-default">
      <div class="panel-heading">
        <h3 class="no-margin">
          <i class="fa fa-user"></i>
          {% trans "Edit user" %}
        </h3>
      </div>
      <div class="panel-body">
        {% crispy form %}
      </div>
    </div>
  </div>
  {% endif %}

133 134 135
</div>

{% endblock %}