FEAT : Pagination des commentaires / photos

This commit is contained in:
2025-12-02 19:43:29 +01:00
parent 6cb141293c
commit ce5ed0cbe3
115 changed files with 240 additions and 121 deletions

View File

@@ -12,31 +12,51 @@
<p>Vous n'avez pas encore de photos.</p>
</div>
<h2>Mes photos privées</h2>
<ul>
<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>
<div>
<a th:each="p : ${photosPrivees.content}"
th:href="@{'/photo/' + ${p.id}}">
<img th:src="@{'/photo/' + ${p.id} + '/raw'}" width="120"/>
</a>
</div>
<div>
<a th:if="${photosPrivees.hasPrevious()}"
th:href="@{/mes-photos(pagePrivees=${pagePrivees - 1}, pagePubliques=${pagePubliques}, pagePartagees=${pagePartagees})}"></a>
<span th:text="'Page ' + (${pagePrivees}+1)"></span>
<a th:if="${photosPrivees.hasNext()}"
th:href="@{/mes-photos(pagePrivees=${pagePrivees + 1}, pagePubliques=${pagePubliques}, pagePartagees=${pagePartagees})}"></a>
</div>
<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>
<div>
<a th:each="p : ${photosPubliques.content}"
th:href="@{'/photo/' + ${p.id}}">
<img th:src="@{'/photo/' + ${p.id} + '/raw'}" width="120"/>
</a>
</div>
<div>
<a th:if="${photosPubliques.hasPrevious()}"
th:href="@{/mes-photos(pagePrivees=${pagePrivees}, pagePubliques=${pagePubliques - 1}, pagePartagees=${pagePartagees})}"></a>
<span th:text="'Page ' + (${pagePubliques}+1)"></span>
<a th:if="${photosPubliques.hasNext()}"
th:href="@{/mes-photos(pagePrivees=${pagePrivees}, pagePubliques=${pagePubliques + 1}, pagePartagees=${pagePartagees})}"></a>
</div>
<h2>Photos partagées avec moi</h2>
<ul>
<li th:each="p : ${photosPartagees}">
<a th:href="@{'/photo/' + ${p.id}}"
th:text="${p.nomFichierOriginal}"></a>
<span style="color:green;">[SHARED]</span>
</li>
</ul>
<div>
<a th:each="p : ${photosPartagees.content}"
th:href="@{'/photo/' + ${p.id}}">
<img th:src="@{'/photo/' + ${p.id} + '/raw'}" width="120"/>
</a>
</div>
<div>
<a th:if="${photosPartagees.hasPrevious()}"
th:href="@{/mes-photos(pagePrivees=${pagePrivees}, pagePubliques=${pagePubliques}, pagePartagees=${pagePartagees - 1})}"></a>
<span th:text="'Page ' + (${pagePartagees}+1)"></span>
<a th:if="${photosPartagees.hasNext()}"
th:href="@{/mes-photos(pagePrivees=${pagePrivees}, pagePubliques=${pagePubliques}, pagePartagees=${pagePartagees + 1})}"></a>
</div>
<p><a th:href="@{/galerie}">Galerie publique</a></p>

View File

@@ -53,16 +53,20 @@
<!-- Commentaires -->
<h2>Commentaires</h2>
<div th:if="${#lists.isEmpty(commentaires)}">
<p>Aucun commentaire pour l'instant.</p>
</div>
<ul th:if="${!#lists.isEmpty(commentaires)}">
<li th:each="c : ${commentaires}">
<strong th:text="${c.auteur.email}">Auteur</strong> :
<div th:each="c : ${commentairesPage.content}">
<p>
<b th:text="${c.auteur.email}"></b>
<span th:text="${c.contenu}"></span>
<em>(<span th:text="${c.dateCommentaire}"></span>)</em>
</li>
</ul>
</p>
</div>
<div>
<a th:if="${commentairesPage.hasPrevious()}"
th:href="@{/photo/{id}(id=${photo.id}, page=${currentPage - 1})}"></a>
<span th:text="'Page ' + (${currentPage}+1)"></span>
<a th:if="${commentairesPage.hasNext()}"
th:href="@{/photo/{id}(id=${photo.id}, page=${currentPage + 1})}"></a>
</div>
<!-- Formulaire d'ajout de commentaire -->
<div th:if="${currentUser}">
<h3>Ajouter un commentaire</h3>