correction des pages ajout categorie modifier categorie et ajout artcile.Intégration de ckedito dans ajout article
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
|
||||
<style>
|
||||
body{
|
||||
background: #f4f6f9;
|
||||
background: #f4f6f981;
|
||||
|
||||
}
|
||||
.container{
|
||||
@@ -20,7 +20,7 @@
|
||||
<body>
|
||||
|
||||
<div class="container">
|
||||
<h2 class="mb-4 text-center">Ajouter une catégorie</h2>
|
||||
<h2 class="mb-5 text-center">Ajouter une catégorie</h2>
|
||||
|
||||
<!--Erreur champ vide -->
|
||||
<div id="errorEmpty" class="alert alert-danger d-none">Le nom de catégorie est obligatoire.</div>
|
||||
@@ -34,8 +34,8 @@
|
||||
<form id="addCategoryForm">
|
||||
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label fw-bold">Nom de la catégorie *</label>
|
||||
<div class="mb-4">
|
||||
<label class="form-label fw-bold">Nom de la catégorie (obligatoire)</label>
|
||||
<input type="text" id="categoryName" class="form-control" placeholder="Actualité, chien, chat .." required></div>
|
||||
|
||||
<div class="mb-3">
|
||||
@@ -44,7 +44,7 @@
|
||||
</div>
|
||||
|
||||
<div class="d-flex gap-3 mt-4">
|
||||
<a href="liste_categories.html" class="btn btn-danger w-50">Annuler</a>
|
||||
<a href="liste_categories.html" class="btn btn-secondary w-50">Annuler</a>
|
||||
<button type="submit" class="btn btn-primary w-50">Ajouter</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Ajouter un article</title>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css">
|
||||
<script src="https://cdn.ckeditor.com/ckeditor5/39.0.1/classic/ckeditor.js"></script>
|
||||
|
||||
|
||||
|
||||
<style>
|
||||
body {
|
||||
@@ -19,7 +22,7 @@
|
||||
<body>
|
||||
|
||||
<div class="container">
|
||||
<h2 class="mb-4 text-center">Ajouter un article</h2>
|
||||
<h2 class="mb-5 text-center">Ajouter un article</h2>
|
||||
|
||||
<!--Erreur titre vide-->
|
||||
<div id="errorEmpty" class="alert alert-danger d-none">Le titre de l'article est obligatoire</div>
|
||||
@@ -35,15 +38,20 @@
|
||||
<!--Succès ajout article-->
|
||||
<div id="successMsg" class="alert alert-success d-none">Article ajouté avec succès !</div>
|
||||
|
||||
<!--Image-->
|
||||
<div class="mb-3">
|
||||
<label class="form-label fw-bold">Image de l'article</label>
|
||||
<input type="file" id="articleImage" class="form-control" accept="image/*">
|
||||
</div>
|
||||
<!--Catégorie-->
|
||||
<div class="mb-4">
|
||||
<label class="form-label fw-bold">Catégorie de l'article</label>
|
||||
<select id="articleCategory" class="form-select">
|
||||
<option value="" selected disabled>Choisissez une catégorie</option>
|
||||
<option value="actualités">Actualités</option>
|
||||
<option value="chien">Chien</option>
|
||||
<option value="chat">Chat</option>
|
||||
<option value="boutique">Boutique</option>
|
||||
</select>
|
||||
|
||||
<!--Titre-->
|
||||
<div class="mb-3">
|
||||
<label class="form-label fw-bold">Titre de l'article *</label>
|
||||
<div class="mb-4">
|
||||
<label class="form-label fw-bold">Titre de l'article (obligatoire)</label>
|
||||
<input type="text" id="articleTitle" class="form-control" placeholder="Entrez le titre de l'article">
|
||||
</div>
|
||||
|
||||
@@ -53,16 +61,13 @@
|
||||
<textarea id="articleContent" class="form-control" rows="5" placeholder="Entrez le contenu de l'article"></textarea>
|
||||
</div>
|
||||
|
||||
<!--Catégorie-->
|
||||
<div class="mb-3">
|
||||
<label class="form-label fw-bold">Catégorie de l'article</label>
|
||||
<select id="articleCategory" class="form-select">
|
||||
<option value="" selected disabled>Choisissez une catégorie</option>
|
||||
<option value="actualités">Actualités</option>
|
||||
<option value="chien">Chien</option>
|
||||
<option value="chat">Chat</option>
|
||||
<option value="boutique">Boutique</option>
|
||||
</select>
|
||||
<!--Image-->
|
||||
<div class="mb-4">
|
||||
<label class="form-label fw-bold">Image de l'article</label>
|
||||
<input type="file" id="articleImage" class="form-control" accept="image/*">
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<!--Publié-->
|
||||
@@ -73,7 +78,7 @@
|
||||
|
||||
<!--Boutons-->
|
||||
<div class="d-flex gap-3 mt-4">
|
||||
<a href="liste_articles.html" class="btn btn-danger w-50">Annuler</a>
|
||||
<a href="liste_articles.html" class="btn btn-secondary w-50">Annuler</a>
|
||||
<button type="submit" class="btn btn-primary w-50">Ajouter</button>
|
||||
</div>
|
||||
</form>
|
||||
@@ -81,7 +86,13 @@
|
||||
|
||||
<script src="ajouter_article.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||
|
||||
<script>
|
||||
ClassicEditor
|
||||
.create(document.querySelector('#articleContent'))
|
||||
.catch(error => {
|
||||
console.error(error);
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -46,9 +46,6 @@ form.addEventListener('submit', function(e) {
|
||||
}
|
||||
}
|
||||
|
||||
// Succès
|
||||
successMsg.classList.remove('d-none');
|
||||
|
||||
// Simuler enregistrement
|
||||
titreExistants.push(titre);
|
||||
|
||||
|
||||
@@ -8,7 +8,8 @@
|
||||
|
||||
<style>
|
||||
body {
|
||||
background: #f4f6f9;
|
||||
background: #f4f6f981;
|
||||
|
||||
}
|
||||
.container {
|
||||
max-width: 600px;
|
||||
@@ -19,7 +20,7 @@
|
||||
<body>
|
||||
|
||||
<div class="container">
|
||||
<h2 class="mb-4 text-center">Modifier une catégorie</h2>
|
||||
<h2 class="mb-5 text-center">Modifier une catégorie</h2>
|
||||
|
||||
<div id="errorMsg" class="alert alert-danger d-none">Veuillez ezmplir tous les champs obligatoires</div>
|
||||
|
||||
@@ -28,25 +29,20 @@
|
||||
<form id="modifierCategorie">
|
||||
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label fw-bold">Nom de la catégorie *</label>
|
||||
<select id="categoryName" class="form-select" required>
|
||||
<option value="" selected disabled>— Choisir une catégorie —</option>
|
||||
<option value="actualité">Actualité</option>
|
||||
<option value="chien">Chien</option>
|
||||
<option value="chat">Chat</option>
|
||||
<option value="boutique">Boutique</option>
|
||||
</select>
|
||||
<div class="mb-4">
|
||||
<label class="form-label fw-bold">Nom de la catégorie (obligatoire)</label>
|
||||
<input type="text" id="categoryName" class="form-control" placeholder="Entrez le nom de la catégorie" required>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label fw-bold">Description *</label>
|
||||
<label class="form-label fw-bold">Description (optionnel)</label>
|
||||
<textarea id="categorieDescription" class="form-control" rows="4" placeholder="Entrez une description" required></textarea>
|
||||
</div>
|
||||
|
||||
<div class="d-flex gap-3 mt-4">
|
||||
<a href="liste_categories.html" class="btn btn-danger w-50">Annuler</a>
|
||||
<a href="liste_categories.html" class="btn btn-secondary w-50">Annuler</a>
|
||||
<button type="submit" class="btn btn-primary w-50">Enregistrer</button>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
const form = document.getElementById("modifierCatgorie");
|
||||
const nameField = document.getElementById("nomCategorie");
|
||||
const form = document.getElementById("modifierCategorie");
|
||||
const nameField = document.getElementById("categoryName");
|
||||
const descField = document.getElementById("categorieDescription");
|
||||
const errorMsg = document.getElementById("errorMsg");
|
||||
const successMsg = document.getElementById("successMsg");
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
<style>
|
||||
body {
|
||||
background: #f2f4f7;
|
||||
background: #f4f6f981;
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
/>
|
||||
<style>
|
||||
body {
|
||||
background: #f2f4f7;
|
||||
background: #f4f6f981;
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
<style>
|
||||
body {
|
||||
background: #f2f4f7;
|
||||
background: #f4f6f981;
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
|
||||
Reference in New Issue
Block a user