mirror of
https://github.com/partitioncloud/partitioncloud-server.git
synced 2025-01-23 09:16:25 +01:00
Ajout de la liste des utilisateurs
This commit is contained in:
parent
89cec8ef35
commit
f36bc93e32
@ -57,6 +57,7 @@ def album(uuid):
|
||||
"""
|
||||
try:
|
||||
album = Album(uuid=uuid)
|
||||
album.users = [User(i["id"]) for i in album.get_users()]
|
||||
user = User(session.get("user_id"))
|
||||
partitions = album.get_partitions()
|
||||
if user.id is None:
|
||||
|
@ -207,4 +207,19 @@ input[type=submit] {
|
||||
#online-search-label {
|
||||
font-size: .7rem;
|
||||
font-weight: lighter;
|
||||
}
|
||||
|
||||
.user-profile-picture {
|
||||
width: 25px;
|
||||
height: 22px;
|
||||
text-align: center;
|
||||
padding-top: 3px;
|
||||
border-radius: 20px;
|
||||
border-width: 1px;
|
||||
border-color: black;
|
||||
margin: 1px;
|
||||
}
|
||||
|
||||
#users-list {
|
||||
display: flex;
|
||||
}
|
@ -5,6 +5,13 @@
|
||||
{% endblock %}
|
||||
|
||||
{% block header_actions %}
|
||||
<div id="users-list">
|
||||
{% for user in album.users %}
|
||||
<div class="user-profile-picture" style="background-color:{{ user.color }};" title="{{ user.username }}">
|
||||
{{ user.username[0] | upper }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% if not_participant %}
|
||||
<a class="button-href" href="/albums/{{ album.uuid }}/join">
|
||||
<button id="join-album">Rejoindre</button>
|
||||
|
@ -21,6 +21,7 @@ class User():
|
||||
).fetchone()
|
||||
self.username = data["username"]
|
||||
self.access_level = data["access_level"]
|
||||
self.color = self.get_color()
|
||||
|
||||
|
||||
def is_participant(self, album_uuid):
|
||||
@ -71,6 +72,11 @@ class User():
|
||||
db.commit()
|
||||
|
||||
|
||||
def get_color(self):
|
||||
integer = int.from_bytes(self.username.encode(), "little") % 16777215
|
||||
return "#" + str(hex(integer))[2:]
|
||||
|
||||
|
||||
|
||||
class Album():
|
||||
def __init__(self, uuid=None, id=None):
|
||||
@ -105,6 +111,8 @@ class Album():
|
||||
|
||||
else:
|
||||
raise LookupError
|
||||
|
||||
self.users = None
|
||||
|
||||
|
||||
def get_users(self):
|
||||
|
Loading…
Reference in New Issue
Block a user