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 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 werkzeug.security import generate_password_hash
from .modules.utils import User, Album, get_all_albums from .modules.utils import User, Album, get_all_albums

View File

@ -3,7 +3,7 @@
Admin Panel Admin Panel
""" """
import os 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 .db import get_db
from .auth import admin_required from .auth import admin_required
@ -16,6 +16,7 @@ bp = Blueprint("admin", __name__, url_prefix="/admin")
@admin_required @admin_required
def index(): def index():
current_user = User(user_id=session.get("user_id")) 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() db = get_db()
users_id = db.execute( users_id = db.execute(
""" """

View File

@ -454,7 +454,7 @@ textarea {
} }
textarea { textarea {
resize: vertical; resize: both;
} }
input[type="submit"] { input[type="submit"] {
@ -491,6 +491,21 @@ input[type="file"] {
padding: 5px 5px; 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 */ /** Flashed messages */
.flash { .flash {

View File

@ -29,6 +29,7 @@
{% block content %} {% block content %}
<header id="album-header"> <header id="album-header">
<h2 id="album-title">{{ album.name }}</h2> <h2 id="album-title">{{ album.name }}</h2>
{% if g.user %}
<div id="header-actions"> <div id="header-actions">
<section id="users"> <section id="users">
{% for album_user in album.users %} {% for album_user in album.users %}
@ -45,15 +46,16 @@
{% endif %} {% endif %}
{% if not_participant %} {% if not_participant %}
<a href="/albums/{{ album.uuid }}/join">Rejoindre</a> <a href="/albums/{{ album.uuid }}/join">Rejoindre</a>
{% else %} {% elif album.users | length > 1 %}
<a href="/albums/{{ album.uuid }}/quit">Quitter</a> <a href="/albums/{{ album.uuid }}/quit">Quitter</a>
{% endif %} {% endif %}
{% if g.user.access_level == 1 %} {% if g.user.access_level == 1 or (not not_participant and album.users | length == 1) %}
<a id="delete-album" href="#delete">Supprimer</a> <a id="delete-album" href="#delete">Supprimer</a>
{% endif %} {% endif %}
</div> </div>
</div> </div>
</div> </div>
{% endif %}
</header> </header>
<hr/> <hr/>
{% if partitions|length != 0 %} {% if partitions|length != 0 %}

View File

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