FEAT : ajout partage simple

This commit is contained in:
2025-12-01 22:30:22 +01:00
parent 4a35c375ec
commit 109cc8065e
14 changed files with 169 additions and 29 deletions

View File

@@ -5,23 +5,34 @@
<title>Mes photos</title>
</head>
<body>
<h1>Mes photos</h1>
<h2>Mes photos</h2>
<p><a th:href="@{/upload}">Uploader une photo</a></p>
<p><a th:href="@{/}">Retour accueil</a></p>
<div th:if="${#lists.isEmpty(photos)}">
<div th:if="${#lists.isEmpty(mesPhotos)}">
<p>Vous n'avez pas encore de photos.</p>
</div>
<ul th:if="${!#lists.isEmpty(photos)}">
<li th:each="p : ${photos}">
<span th:text="${p.nomFichierOriginal}">Nom du fichier</span>
<ul>
<li th:each="p : ${mesPhotos}">
<span th:text="${p.nomFichierOriginal}"></span>
<a th:href="@{'/photo/' + ${p.id}}">Voir</a>
</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)}">
<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>
</li>
</ul>
<p><a th:href="@{/galerie}">Galerie publique</a></p>
</body>

View File

@@ -29,6 +29,20 @@
<li><strong>Propriétaire :</strong> <span th:text="${photo.proprietaire.email}"></span></li>
</ul>
<!-- Partage de la photo -->
<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)}">