mirror of
https://github.com/partitioncloud/partitioncloud-server.git
synced 2025-01-23 17:26:26 +01:00
Shorter path for partitions
`/albums/<album_uuid>/<partition_uuid>` -> `/partition/<partition_uuid>`
This commit is contained in:
parent
972231e4b2
commit
340b6541ca
@ -92,32 +92,6 @@ 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():
|
||||||
|
@ -13,7 +13,6 @@ 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(
|
||||||
|
@ -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="/albums/{{ album.uuid }}/{{ partition['uuid'] }}">
|
<a href="/partition/{{ 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">
|
||||||
|
@ -94,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>
|
||||||
|
@ -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="/albums/{{ partition.uuid }}/edit">
|
<a class="button-href" href="/partition/{{ partition.uuid }}/edit">
|
||||||
<button id="cancel-deletion">Annuler</button>
|
<button id="cancel-deletion">Annuler</button>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user