mirror of
https://github.com/partitioncloud/partitioncloud-server.git
synced 2025-01-23 17:26:26 +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:
|
try:
|
||||||
album = Album(uuid=uuid)
|
album = Album(uuid=uuid)
|
||||||
|
album.users = [User(i["id"]) for i in album.get_users()]
|
||||||
user = User(session.get("user_id"))
|
user = User(session.get("user_id"))
|
||||||
partitions = album.get_partitions()
|
partitions = album.get_partitions()
|
||||||
if user.id is None:
|
if user.id is None:
|
||||||
|
@ -208,3 +208,18 @@ input[type=submit] {
|
|||||||
font-size: .7rem;
|
font-size: .7rem;
|
||||||
font-weight: lighter;
|
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 %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block header_actions %}
|
{% 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 %}
|
{% if not_participant %}
|
||||||
<a class="button-href" href="/albums/{{ album.uuid }}/join">
|
<a class="button-href" href="/albums/{{ album.uuid }}/join">
|
||||||
<button id="join-album">Rejoindre</button>
|
<button id="join-album">Rejoindre</button>
|
||||||
|
@ -21,6 +21,7 @@ class User():
|
|||||||
).fetchone()
|
).fetchone()
|
||||||
self.username = data["username"]
|
self.username = data["username"]
|
||||||
self.access_level = data["access_level"]
|
self.access_level = data["access_level"]
|
||||||
|
self.color = self.get_color()
|
||||||
|
|
||||||
|
|
||||||
def is_participant(self, album_uuid):
|
def is_participant(self, album_uuid):
|
||||||
@ -71,6 +72,11 @@ class User():
|
|||||||
db.commit()
|
db.commit()
|
||||||
|
|
||||||
|
|
||||||
|
def get_color(self):
|
||||||
|
integer = int.from_bytes(self.username.encode(), "little") % 16777215
|
||||||
|
return "#" + str(hex(integer))[2:]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Album():
|
class Album():
|
||||||
def __init__(self, uuid=None, id=None):
|
def __init__(self, uuid=None, id=None):
|
||||||
@ -106,6 +112,8 @@ class Album():
|
|||||||
else:
|
else:
|
||||||
raise LookupError
|
raise LookupError
|
||||||
|
|
||||||
|
self.users = None
|
||||||
|
|
||||||
|
|
||||||
def get_users(self):
|
def get_users(self):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user