edit article

This commit is contained in:
Parpaillax
2024-04-26 15:42:25 +02:00
parent bd37441f9c
commit 54f1503ac2
5 changed files with 38 additions and 4 deletions

View File

@@ -63,7 +63,7 @@
</form>
<div class="mt-5">
<a class="btn btn-secondary" href="/accueil" th:text="'Retour'"></a>
<a th:if="${#strings.equals(user.getPseudo(), article.pseudoUtilisateur)}" class="btn btn-secondary" href="/article/edit" th:text="'Modifier'"></a>
<a th:if="${#strings.equals(user.getPseudo(), article.pseudoUtilisateur)}" class="btn btn-secondary" th:href="@{/article/edit(id=${article.id})}" th:text="'Modifier'"></a>
</div>
</div>
</div>

View File

@@ -1,10 +1,26 @@
<!DOCTYPE html>
<html lang="en">
<html lang="fr" th:replace="~{modele-page :: layout('Modifier votre article' , ~{::#link}, ~{::#container-main})}" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<div id="container-main" class="container mt-5">
<h1 th:text="#{edit.article.title}"></h1>
<form th:action="@{/article/new}" th:object="${article}">
<div class="mb-3">
<label for="nom" class="form-label">Titre</label>
<input type="text" class="form-control" th:field="*{nom}" id="nom">
</div>
<div class="mb-3">
<label for="categorie" class="form-label">Catégorie:</label>
<select class="form-control" th:field="*{numCategorie}" id="categorie" required>
<option th:each="categorie : ${categories}" th:value="${categorie.id}" th:text="${categorie.libelle}"></option>
</select>
<div class="invalid-feedback">Veuillez sélectionner une catégorie.</div>
</div>
</form>
</div>
</body>
</html>