Ajout article v2

This commit is contained in:
jleroy
2024-04-24 10:32:03 +02:00
parent 389b5d6b23
commit 79fc4ce674
2 changed files with 7 additions and 5 deletions

View File

@@ -42,7 +42,7 @@ public class ArticleController {
}
@GetMapping("/new")
public String test(@PathVariable(name = "slug")int id, Model model) {
public String test(Model model) {
model.addAttribute("categories", categorieService.findAllCategories());
return "newArticle";
}

View File

@@ -23,9 +23,11 @@
<div>
<label for="categorie">Catégorie:</label>
<select id="categorie" name="categorie" required>
<option value="categorie1">Catégorie 1</option>
<option value="categorie2">Catégorie 2</option>
<!-- Ajoutez d'autres options si nécessaire -->
<!-- Boucle sur les catégories pour générer les options -->
<option value="">Sélectionnez une catégorie</option>
<th:block th:each="categorie : ${categories}">
<option th:value="${categorie.id}" th:text="${categorie.libelle}"></option>
</th:block>
</select>
</div>
@@ -54,7 +56,7 @@
</div>
<!-- Lieu de retrait -->
<h2>Retrait</h2>
<h4>Retrait</h4>
<div>
<label for="rue">Rue:</label>
<input type="text" id="rue" name="rue" required>