Compare commits

..

No commits in common. "1d02292c61268b932cf54a2c020b93aaa9e12174" and "972231e4b200f48ee136a96d5dc89721a894bfa4" have entirely different histories.

7 changed files with 36 additions and 12 deletions

View File

@ -92,6 +92,32 @@ def album(uuid):
return abort(404) return abort(404)
@bp.route("/<album_uuid>/<partition_uuid>")
def partition(album_uuid, partition_uuid):
"""
Returns a partition in a given album
"""
db = get_db()
partition = db.execute(
"""
SELECT * FROM partition
JOIN contient_partition ON partition_uuid = partition.uuid
JOIN album ON album.id = album_id
WHERE album.uuid = ?
AND partition.uuid = ?
""",
(album_uuid, partition_uuid),
).fetchone()
if partition is None:
return abort(404)
return send_file(
os.path.join("partitions", f"{partition_uuid}.pdf"),
download_name = f"{partition['name']}.pdf"
)
@bp.route("/create-album", methods=["POST"]) @bp.route("/create-album", methods=["POST"])
@login_required @login_required
def create_album(): def create_album():

View File

@ -13,6 +13,7 @@ from .utils import get_all_partitions, User, Partition
bp = Blueprint("partition", __name__, url_prefix="/partition") bp = Blueprint("partition", __name__, url_prefix="/partition")
@bp.route("/<uuid>") @bp.route("/<uuid>")
@login_required
def partition(uuid): def partition(uuid):
db = get_db() db = get_db()
partition = db.execute( partition = db.execute(

View File

@ -381,7 +381,7 @@ img.partition-thumbnail {
#sidebar-navigation { #sidebar-navigation {
overflow: scroll; overflow: scroll;
height: calc(100% - 375px); /* we don't want it hidden behind settings */ height: calc(100% - 400px); /* we don't want it hidden behind settings */
padding: 0 5px; padding: 0 5px;
} }

View File

@ -66,7 +66,7 @@
<section id="partitions-grid"> <section id="partitions-grid">
{% for partition in partitions | reverse %} {% for partition in partitions | reverse %}
<div> <div>
<a href="/partition/{{ partition['uuid'] }}"> <a href="/albums/{{ album.uuid }}/{{ partition['uuid'] }}">
<div class="partition" id="partition-{{ partition['uuid'] }}"> <div class="partition" id="partition-{{ partition['uuid'] }}">
<img class="partition-thumbnail" src="/static/thumbnails/{{ partition['uuid'] }}.jpg"> <img class="partition-thumbnail" src="/static/thumbnails/{{ partition['uuid'] }}.jpg">
<div class="partition-description"> <div class="partition-description">

View File

@ -54,11 +54,6 @@
{% for album in user.albums %} {% for album in user.albums %}
<option value="{{ album['uuid'] }}">{{ album["name"] }}</option> <option value="{{ album['uuid'] }}">{{ album["name"] }}</option>
{% endfor %} {% endfor %}
{% for groupe in user.get_groupes() %}
{% for album in groupe.get_albums() %}
<option value="{{ album['uuid'] }}">{{ groupe.name }}/{{ album["name"] }}</option>
{% endfor %}
{% endfor %}
</select> </select>
<input type="hidden" value="{{ partition['uuid'] }}" name="partition-uuid"> <input type="hidden" value="{{ partition['uuid'] }}" name="partition-uuid">
<input type="hidden" value="online_search" name="partition-type"> <input type="hidden" value="online_search" name="partition-type">

View File

@ -25,9 +25,6 @@
<input type="text" name="name" id="name" placeholder="Nom" required><br/> <input type="text" name="name" id="name" placeholder="Nom" required><br/>
<input type="submit" value="Créer"> <input type="submit" value="Créer">
</form> </form>
<br/>
<br/>
Je souhaite créer plusieurs albums et pouvoir tous les partager avec un seul lien. <a href="#create-groupe">Créer un groupe</a>.
<a href="#!" class="close-dialog">Close</a> <a href="#!" class="close-dialog">Close</a>
</dialog> </dialog>
<dialog id="create-groupe"> <dialog id="create-groupe">
@ -75,6 +72,11 @@
Créer un album Créer un album
</div> </div>
</a> </a>
<a href="#create-groupe">
<div class="create-button">
Créer un groupe
</div>
</a>
{% endif %} {% endif %}
{% if g.user %} {% if g.user %}
@ -92,7 +94,7 @@
Aucun album Aucun album
{% else %} {% else %}
{% for album in groupe.get_albums() %} {% for album in groupe.get_albums() %}
<a href="/groupe/{{ groupe.uuid }}/{{ album['uuid'] }}"> <a href="/groupe/{{ groupe.uuid }}/{{ album["uuid"] }}">
<div class="groupe-album-cover"> <div class="groupe-album-cover">
{{ album["name"] }} {{ album["name"] }}
</div> </div>

View File

@ -9,7 +9,7 @@
<form method="post"> <form method="post">
<input type="submit" id="delete-partition" value="Supprimer"> <input type="submit" id="delete-partition" value="Supprimer">
</form> </form>
<a class="button-href" href="/partition/{{ partition.uuid }}/edit"> <a class="button-href" href="/albums/{{ partition.uuid }}/edit">
<button id="cancel-deletion">Annuler</button> <button id="cancel-deletion">Annuler</button>
</a> </a>