Files
docupulse/templates/components/member_list.html
2025-05-25 12:23:53 +02:00

76 lines
5.5 KiB
HTML

{% macro member_list(room) %}
<div class="card shadow-sm">
<div class="card-header bg-white">
<h5 class="card-title mb-0">Current Members</h5>
</div>
<div class="card-body">
{% if room.member_permissions %}
<div class="list-group">
{% for perm in room.member_permissions %}
{% set member = perm.user %}
<div class="list-group-item d-flex justify-content-between align-items-center member-row">
<div class="d-flex align-items-center">
<img src="{{ url_for('profile_pic', filename=member.profile_picture) if member.profile_picture else url_for('static', filename='default-avatar.png') }}"
alt="{{ member.username }}"
class="rounded-circle me-3"
style="width: 40px; height: 40px; object-fit: cover;">
<div>
<h6 class="mb-0">{{ member.username }} {{ member.last_name }}</h6>
<small class="text-muted">{{ member.email }}</small>
</div>
</div>
<div class="d-flex align-items-center gap-2">
{% if member.id != room.created_by %}
<form action="{{ url_for('rooms.update_member_permissions', room_id=room.id, user_id=member.id) }}" method="POST" class="d-flex align-items-center gap-2 auto-save-perms-form">
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
<div class="form-check form-check-inline mb-0">
<input class="form-check-input" type="checkbox" name="can_view" id="can_view_{{ member.id }}" checked disabled>
<input type="hidden" name="can_view" value="1">
<label class="form-check-label" for="can_view_{{ member.id }}" title="View permission is always required"><i class="fas fa-eye"></i></label>
</div>
<div class="form-check form-check-inline mb-0">
<input class="form-check-input" type="checkbox" name="can_download" id="can_download_{{ member.id }}" {% if perm.can_download %}checked{% endif %}>
<label class="form-check-label" for="can_download_{{ member.id }}" title="Can Download Files"><i class="fas fa-download"></i></label>
</div>
<div class="form-check form-check-inline mb-0">
<input class="form-check-input" type="checkbox" name="can_upload" id="can_upload_{{ member.id }}" {% if perm.can_upload %}checked{% endif %}>
<label class="form-check-label" for="can_upload_{{ member.id }}" title="Can Upload Files"><i class="fas fa-upload"></i></label>
</div>
<div class="form-check form-check-inline mb-0">
<input class="form-check-input" type="checkbox" name="can_delete" id="can_delete_{{ member.id }}" {% if perm.can_delete %}checked{% endif %}>
<label class="form-check-label" for="can_delete_{{ member.id }}" title="Can Delete Files"><i class="fas fa-trash"></i></label>
</div>
<div class="form-check form-check-inline mb-0">
<input class="form-check-input" type="checkbox" name="can_rename" id="can_rename_{{ member.id }}" {% if perm.can_rename %}checked{% endif %}>
<label class="form-check-label" for="can_rename_{{ member.id }}" title="Can Rename Files"><i class="fas fa-i-cursor"></i></label>
</div>
<div class="form-check form-check-inline mb-0">
<input class="form-check-input" type="checkbox" name="can_move" id="can_move_{{ member.id }}" {% if perm.can_move %}checked{% endif %}>
<label class="form-check-label" for="can_move_{{ member.id }}" title="Can Move Files"><i class="fas fa-arrows-alt"></i></label>
</div>
<div class="form-check form-check-inline mb-0">
<input class="form-check-input" type="checkbox" name="can_share" id="can_share_{{ member.id }}" {% if perm.can_share %}checked{% endif %}>
<label class="form-check-label" for="can_share_{{ member.id }}" title="Can Share Files"><i class="fas fa-share-alt"></i></label>
</div>
</form>
<form action="{{ url_for('rooms.remove_member', room_id=room.id, user_id=member.id) }}" method="POST" class="d-inline ms-2">
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
<button type="submit" class="btn btn-remove-member px-3 d-flex align-items-center gap-1">
<i class="fas fa-user-minus"></i> Remove
</button>
</form>
{% else %}
<span class="badge creator-badge px-3 py-2 d-flex align-items-center gap-1" style="height: 32px;">
<i class="fas fa-user"></i> Creator
</span>
{% endif %}
</div>
</div>
{% endfor %}
</div>
{% else %}
<p class="text-muted mb-0">No members in this room yet.</p>
{% endif %}
</div>
</div>
{% endmacro %}