From e5f0d12b398288f93e4cda7f3cd4a3ed89fdbbe3 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Thu, 19 Nov 2020 16:27:49 +0000 Subject: [PATCH] people: Update design of profile page Signed-off-by: Michael Tremer --- src/backend/accounts.py | 8 +- src/templates/people/user.html | 178 +++++++++++++++++++-------------- 2 files changed, 111 insertions(+), 75 deletions(-) diff --git a/src/backend/accounts.py b/src/backend/accounts.py index 8da02a58..e0cf401d 100644 --- a/src/backend/accounts.py +++ b/src/backend/accounts.py @@ -888,7 +888,7 @@ class Account(LDAPObject): if self.country_name: address.append(self.country_name) - return address + return [line for line in address if line] def get_street(self): return self._get_string("street") or self._get_string("homePostalAddress") @@ -936,6 +936,12 @@ class Account(LDAPObject): def email_to(self): return "%s <%s>" % (self, self.email) + @lazy_property + def alternate_email_addresses(self): + addresses = self._get_strings("mailAlternateAddress") + + return sorted(addresses) + # Mail Routing Address def get_mail_routing_address(self): diff --git a/src/templates/people/user.html b/src/templates/people/user.html index a89ec8d0..313994ce 100644 --- a/src/templates/people/user.html +++ b/src/templates/people/user.html @@ -1,50 +1,82 @@ -{% extends "base.html" %} +{% extends "../base.html" %} -{% block main %} +{% block container %} {% import phonenumbers %} -
-
- {% if account.description %} -
-
- {% module Markdown(account.description) %} -
+
+
+
+
+ {{ account }}
- {% end %} -
-
- - {{ _("Email %s") % account.first_name }} - +
+

{{ account }}

+ + {% if account.description %} +
+ {% module Markdown(account.description) %} +
+ {% end %} + +
+ {% if account.has_shell() %} + + {{ _("Home Directory") }} + + {% end %} + + {% if account.can_be_managed_by(current_user) %} + + {{ _("Edit") }} + + + + {{ _("Change Password") }} + + {% end %} +
+
+
- {% if current_user == account or current_user.is_staff() %} + {% if current_user == account or current_user.is_staff() %} +
+
- {% if account.address %} -
-
{{ _("Postal Address") }}
+
+ {% if current_user.is_staff() %} +
{{ _("Email") }}
+ + + {% end %} + + {% if account.address %} +
{{ _("Address") }}
- {{ account.name }} -
+ {{ account.name }}
{% for line in account.address %} {{ line }}
{% end %}
-
- {% end %} + {% end %} - -
- {% end %} -
- - {% if current_user.is_staff() and account.groups %} -
-
-
-
{{ _("Groups") }}
-
-
-
-
- {% end %} -
+ {% if current_user.is_staff() %} +
+ {% if account.groups %} +
{{ _("Groups") }}
-
    -
  • - {{ _("Joined %s") % locale.format_date(account.created_at, shorter=True) }} -
  • - - {% if current_user.is_admin() %} -
  • - {{ _("Last Modified %s") % locale.format_date(account.modified_at) }} -
  • +
    + {% for g in account.groups %} + + {{ g }} + + {% end %} +
    + {% end %} - {% if account.last_successful_authentication %} -
  • - {{ _("Last successful authentication: %s") % locale.format_date(account.last_successful_authentication) }} -
  • - {% end %} +
      +
    • + {{ _("Joined %s") % locale.format_date(account.created_at, shorter=True) }} +
    • - {% if account.failed_login_count %} -
    • - {{ _("One unsuccessful authentication attempt.", "%(num)s unsuccessful authentication attempts.", account.failed_login_count) % { "num" : account.failed_login_count } }} + {% if current_user.is_admin() %} +
    • + {{ _("Last Modified %s") % locale.format_date(account.modified_at) }} +
    • - {% if account.last_failed_authentication %} - {{ _("Last attempt: %s") % locale.format_date(account.last_failed_authentication) }} + {% if account.last_successful_authentication %} +
    • + {{ _("Last successful authentication: %s") % locale.format_date(account.last_successful_authentication) }} +
    • + {% end %} + + {% if account.failed_login_count %} +
    • + {{ _("One unsuccessful authentication attempt.", "%(num)s unsuccessful authentication attempts.", account.failed_login_count) % { "num" : account.failed_login_count } }} + + {% if account.last_failed_authentication %} + {{ _("Last attempt: %s") % locale.format_date(account.last_failed_authentication) }} + {% end %} +
    • + {% end %} + {% end %} +
    +
{% end %} - - {% end %} - {% end %} - +
+ +
+ {% end %} {% end block %} -- 2.47.3