Files
FotoSharing/target/classes/templates/photo-detail.html

85 lines
2.7 KiB
HTML

<!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>
<!-- 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">
<label>Email de l'utilisateur :</label>
<input type="email" name="email" required />
<button type="submit">Partager</button>
</form>
</div>
<div th:if="${currentUser != photo.proprietaire.email}">
<em>Seul le propriétaire peut partager cette photo.</em>
</div>
<!-- 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>