From 7d368ed0ac9d47966fba676a1b225ee7cd671340 Mon Sep 17 00:00:00 2001 From: Inga Kirschnick Date: Mon, 19 Dec 2022 15:02:43 +0100 Subject: [PATCH] Avatar picture dashboard list --- app/models.py | 2 +- .../js/RessourceLists/PublicUserList.js | 27 ++++++++++++++----- app/templates/main/dashboard.html.j2 | 4 +-- 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/app/models.py b/app/models.py index fbec78fa..affcd79b 100644 --- a/app/models.py +++ b/app/models.py @@ -269,7 +269,7 @@ class Avatar(HashidMixin, FileMixin, db.Model): def to_json_serializeable(self, backrefs=False, relationships=False): json_serializeable = { - 'id': self.id + 'id': self.hashid } return json_serializeable diff --git a/app/static/js/RessourceLists/PublicUserList.js b/app/static/js/RessourceLists/PublicUserList.js index 4597ed3e..f00e145d 100644 --- a/app/static/js/RessourceLists/PublicUserList.js +++ b/app/static/js/RessourceLists/PublicUserList.js @@ -7,7 +7,6 @@ class PublicUserList extends RessourceList { static options = { initialHtmlGenerator: (id) => { - console.log(id); return `
search @@ -19,6 +18,10 @@ class PublicUserList extends RessourceList { Username + Full name + Location + Organization + Corpora online @@ -29,8 +32,12 @@ class PublicUserList extends RessourceList { }, item: ` - user-image - + user-image + + + + + send @@ -40,8 +47,12 @@ class PublicUserList extends RessourceList { return { 'id': user.id, 'member-since': user.member_since, - 'avatar': `/static/images/user_avatar.png`, - 'username': user.username + 'avatar': user.avatar ? `/profile/${user.id}/avatars/${user.avatar.id}` : '/static/images/user_avatar.png', + 'username': user.username, + 'full-name': user.full_name ? user.full_name : '', + 'location': user.location ? user.location : '', + 'organization': user.organization ? user.organization : '', + 'corpora-online': '0' }; }, sortArgs: ['member-since', {order: 'desc'}], @@ -49,7 +60,11 @@ class PublicUserList extends RessourceList { {data: ['id']}, {data: ['member-since']}, {name: 'avatar', attr: 'src'}, - 'username' + 'username', + 'full-name', + 'location', + 'organization', + 'corpora-online' ] }; diff --git a/app/templates/main/dashboard.html.j2 b/app/templates/main/dashboard.html.j2 index eb504cb3..a7d642b7 100644 --- a/app/templates/main/dashboard.html.j2 +++ b/app/templates/main/dashboard.html.j2 @@ -44,7 +44,7 @@

Social

-
+
Other users and groups @@ -53,7 +53,7 @@
-
+
Public corpora