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") @GetMapping("/new")
public String test(@PathVariable(name = "slug")int id, Model model) { public String test(Model model) {
model.addAttribute("categories", categorieService.findAllCategories()); model.addAttribute("categories", categorieService.findAllCategories());
return "newArticle"; return "newArticle";
} }

View File

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