Various small fixes

This commit is contained in:
augustin64 2023-06-22 16:06:48 +02:00
parent 341dcdb567
commit 13039dcf07
5 changed files with 47 additions and 29 deletions

View File

@ -4,7 +4,7 @@ Main file
"""
import os
from flask import Flask, g, redirect, render_template, request, send_file, flash
from flask import Flask, g, redirect, render_template, request, send_file, flash, session
from werkzeug.security import generate_password_hash
from .modules.utils import User, Album, get_all_albums

View File

@ -3,7 +3,7 @@
Admin Panel
"""
import os
from flask import Blueprint, abort, send_file, render_template
from flask import Blueprint, abort, send_file, render_template, session
from .db import get_db
from .auth import admin_required
@ -16,6 +16,7 @@ bp = Blueprint("admin", __name__, url_prefix="/admin")
@admin_required
def index():
current_user = User(user_id=session.get("user_id"))
current_user.get_albums() # We need to do that before we close the db
db = get_db()
users_id = db.execute(
"""

View File

@ -454,7 +454,7 @@ textarea {
}
textarea {
resize: vertical;
resize: both;
}
input[type="submit"] {
@ -491,6 +491,21 @@ input[type="file"] {
padding: 5px 5px;
}
/** Search results */
.add-partition-form select {
width: 178px;
margin: 0px;
}
.add-partition-form {
align-items: center;
display: grid;
}
.add-partition-form input[type="submit"] {
margin: 5px 0;
width: 178px;
}
/** Flashed messages */
.flash {

View File

@ -29,31 +29,33 @@
{% block content %}
<header id="album-header">
<h2 id="album-title">{{ album.name }}</h2>
<div id="header-actions">
<section id="users">
{% for album_user in album.users %}
<div class="user-profile-picture" style="background-color:{{ album_user.color }};" title="{{ album_user.username }}">
{{ album_user.username[0] | upper }}
</div>
{% endfor %}
</section>
<div class="dropdown dp1">
+
<div class="dropdown-content dp1">
{% if g.user %}
<a href="#add-partition">Ajouter une partition</a>
{% endif %}
{% if not_participant %}
<a href="/albums/{{ album.uuid }}/join">Rejoindre</a>
{% else %}
<a href="/albums/{{ album.uuid }}/quit">Quitter</a>
{% endif %}
{% if g.user.access_level == 1 %}
<a id="delete-album" href="#delete">Supprimer</a>
{% endif %}
{% if g.user %}
<div id="header-actions">
<section id="users">
{% for album_user in album.users %}
<div class="user-profile-picture" style="background-color:{{ album_user.color }};" title="{{ album_user.username }}">
{{ album_user.username[0] | upper }}
</div>
{% endfor %}
</section>
<div class="dropdown dp1">
+
<div class="dropdown-content dp1">
{% if g.user %}
<a href="#add-partition">Ajouter une partition</a>
{% endif %}
{% if not_participant %}
<a href="/albums/{{ album.uuid }}/join">Rejoindre</a>
{% elif album.users | length > 1 %}
<a href="/albums/{{ album.uuid }}/quit">Quitter</a>
{% endif %}
{% if g.user.access_level == 1 or (not not_participant and album.users | length == 1) %}
<a id="delete-album" href="#delete">Supprimer</a>
{% endif %}
</div>
</div>
</div>
</div>
{% endif %}
</header>
<hr/>
{% if partitions|length != 0 %}

View File

@ -21,7 +21,7 @@
</a>
<form action="/albums/add-partition" method="post">
<select name="album-uuid">
{% for album in albums %}
{% for album in user.albums %}
<option value="{{ album['uuid'] }}">{{ album["name"] }}</option>
{% endfor %}
</select>
@ -46,9 +46,9 @@
</div>
</div>
</a>
<form action="/albums/add-partition" method="post">
<form action="/albums/add-partition" class="add-partition-form" method="post">
<select name="album-uuid">
{% for album in albums %}
{% for album in user.albums %}
<option value="{{ album['uuid'] }}">{{ album["name"] }}</option>
{% endfor %}
</select>