FEAT : Ajout pagination galerie publique

This commit is contained in:
2025-12-02 09:12:07 +01:00
parent 109cc8065e
commit 6cb141293c
15 changed files with 181 additions and 78 deletions

View File

@@ -1,17 +1,40 @@
<!doctype html>
<html xmlns:th="http://www.thymeleaf.org">
<head><meta charset="utf-8"><title>Galerie</title></head>
<head>
<meta charset="utf-8"/>
<title>Galerie publique</title>
</head>
<body>
<h1>Galerie publique</h1>
<p><a th:href="@{/}">Accueil</a></p>
<!-- Affichage des photos -->
<div>
<a th:each="p : ${photosPage.content}"
th:href="@{'/photo/' + ${p.id}}"
style="display:inline-block; margin:10px;">
<img th:src="@{'/photo/' + ${p.id} + '/raw'}"
width="150"
style="border:1px solid #ccc;"/>
</a>
</div>
<!-- Pagination -->
<div style="margin-top:20px;">
<a th:if="${currentPage > 0}"
th:href="@{/galerie(page=${currentPage - 1})}">
⬅ Précédent
</a>
<span th:text="'Page ' + (${currentPage} + 1)"></span>
<a th:if="${photosPage.hasNext()}"
th:href="@{/galerie(page=${currentPage + 1})}">
Suivant ➡
</a>
</div>
<ul>
<li th:each="p : ${photos}">
<span th:text="${p.nomFichierOriginal}">nom</span>
<a th:href="@{'/photo/' + ${p.id}}">Voir</a>
</li>
</ul>
</body>
</html>

View File

@@ -11,24 +11,30 @@
<div th:if="${#lists.isEmpty(mesPhotos)}">
<p>Vous n'avez pas encore de photos.</p>
</div>
<h2>Mes photos privées</h2>
<ul>
<li th:each="p : ${mesPhotos}">
<span th:text="${p.nomFichierOriginal}"></span>
<a th:href="@{'/photo/' + ${p.id}}">Voir</a>
<li th:each="p : ${photosPrivees}">
<a th:href="@{'/photo/' + ${p.id}}"
th:text="${p.nomFichierOriginal}"></a>
<span style="color:red;">[PRIVÉE]</span>
</li>
</ul>
<h2>Mes photos publiques</h2>
<ul>
<li th:each="p : ${photosPubliques}">
<a th:href="@{'/photo/' + ${p.id}}"
th:text="${p.nomFichierOriginal}"></a>
<span style="color:blue;">[PUBLIQUE]</span>
</li>
</ul>
<h2>Photos partagées avec moi</h2>
<div th:if="${#lists.isEmpty(photosPartagees)}">
<p>Aucune photo partagée.</p>
</div>
<ul th:if="${!#lists.isEmpty(photosPartagees)}">
<ul>
<li th:each="p : ${photosPartagees}">
<span th:text="${p.nomFichierOriginal}"></span>
<span style="color: green; font-weight: bold;">[SHARED]</span>
<a th:href="@{'/photo/' + ${p.id}}">Voir</a>
<a th:href="@{'/photo/' + ${p.id}}"
th:text="${p.nomFichierOriginal}"></a>
<span style="color:green;">[SHARED]</span>
</li>
</ul>

View File

@@ -30,6 +30,14 @@
</ul>
<!-- Partage de la photo -->
<h2>Partagée avec :</h2>
<ul>
<li th:each="p : ${partages}">
<span th:text="${p.utilisateur.email}"></span>
<a th:href="@{'/photo/' + ${photo.id} + '/unshare/' + ${p.utilisateur.email}}"
style="color:red;">Retirer</a>
</li>
</ul>
<h2>Partager la photo</h2>
<div th:if="${currentUser == photo.proprietaire.email}">
<form th:action="@{'/photo/' + ${photo.id} + '/share'}" method="post">