FEAT : Ajout des commentaires

This commit is contained in:
2025-12-01 21:47:15 +01:00
parent ca3e693969
commit 4a35c375ec
16 changed files with 234 additions and 6 deletions

View File

@@ -0,0 +1,62 @@
<!doctype html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="utf-8"/>
<title>Détail de la photo</title>
</head>
<body>
<h1>Détail de la photo</h1>
<p>
<a th:href="@{/}">Accueil</a> |
<a th:href="@{/galerie}">Galerie publique</a> |
<a th:href="@{/mes-photos}">Mes photos</a>
</p>
<!-- Affichage de la photo -->
<div>
<img th:src="@{'/photo/' + ${photo.id} + '/raw'}"
alt="Photo"
style="max-width:500px; border:1px solid #ccc; margin:20px 0;"/>
</div>
<!-- Infos -->
<ul>
<li><strong>Nom original :</strong> <span th:text="${photo.nomFichierOriginal}"></span></li>
<li><strong>Date upload :</strong> <span th:text="${photo.dateUpload}"></span></li>
<li><strong>Visibilité :</strong> <span th:text="${photo.visibilite}"></span></li>
<li><strong>Propriétaire :</strong> <span th:text="${photo.proprietaire.email}"></span></li>
</ul>
<!-- 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> :
<span th:text="${c.contenu}"></span>
<em>(<span th:text="${c.dateCommentaire}"></span>)</em>
</li>
</ul>
<!-- Formulaire d'ajout de commentaire -->
<div th:if="${currentUser}">
<h3>Ajouter un commentaire</h3>
<form th:action="@{'/photo/' + ${photo.id} + '/comment'}" method="post">
<textarea name="contenu" rows="3" cols="50"></textarea><br/>
<button type="submit">Envoyer</button>
</form>
</div>
<div th:if="${currentUser == null}">
<p><a th:href="@{/login}">Connectez-vous</a> pour commenter.</p>
</div>
<p>
<a th:href="@{'/photo/' + ${photo.id} + '/raw'}" target="_blank">Voir en grande taille</a>
</p>
</body>
</html>