Merge branch 'TODO_erreurs' of http://10.4.0.131/gitea/DI1-P4-E1/Webzine into TODO_erreurs
This commit is contained in:
@@ -1,25 +1,32 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
// <copyright file="AccueilController.cs" company=" Equipe 1 - ">
|
||||||
using Webzine.Repository.Fake;
|
// Copyright (c) Equipe 1 - . All rights reserved.
|
||||||
using Webzine.WebApplication.ViewModels.Accueil;
|
// </copyright>
|
||||||
|
|
||||||
namespace Webzine.WebApplication.Controllers
|
namespace Webzine.WebApplication.Controllers
|
||||||
{
|
{
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Webzine.Repository.Fake;
|
||||||
|
using Webzine.WebApplication.ViewModels.Accueil;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Permet de retourner la page d'accueil avec tous les éléments.
|
||||||
|
/// </summary>
|
||||||
public class AccueilController : Controller
|
public class AccueilController : Controller
|
||||||
{
|
{
|
||||||
// Injection du logger via le constructeur
|
// Injection du logger via le constructeur
|
||||||
private readonly ILogger<AccueilController> _logger;
|
private readonly ILogger<AccueilController> logger;
|
||||||
private readonly IConfiguration _configuration;
|
private readonly IConfiguration configuration;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initialise une nouvelle instance du <see cref="AccueilController"/> avec un service de journalisation et de configuration injectés.
|
/// Initialise une nouvelle instance de la classe <see cref="AccueilController"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="logger">Service de journalisation injecté pour enregistrer les événements et les erreurs.</param>
|
/// <param name="logger">Service de journalisation injecté pour enregistrer les événements et les erreurs.</param>
|
||||||
/// <param name="configuration">Service d'injection de configuration pour accéder aux paramètres de l'application.</param>
|
/// <param name="configuration">Service d'injection de configuration pour accéder aux paramètres de l'application.</param>
|
||||||
public AccueilController(ILogger<AccueilController> logger, IConfiguration configuration)
|
public AccueilController(ILogger<AccueilController> logger, IConfiguration configuration)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
this.logger = logger;
|
||||||
_configuration = configuration;
|
this.configuration = configuration;
|
||||||
this._logger.LogDebug(1, "initialisation du AccueilController");
|
this.logger.LogDebug(1, "initialisation du AccueilController");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -28,10 +35,10 @@ namespace Webzine.WebApplication.Controllers
|
|||||||
/// <returns>La vue Index avec le ViewModel contenant les listes de titres à afficher.</returns>
|
/// <returns>La vue Index avec le ViewModel contenant les listes de titres à afficher.</returns>
|
||||||
public IActionResult Index()
|
public IActionResult Index()
|
||||||
{
|
{
|
||||||
_logger.LogInformation("Arrivée sur la page d'accueil");
|
this.logger.LogInformation("Arrivée sur la page d'accueil");
|
||||||
|
|
||||||
var derniereChronique = _configuration.GetValue<int>("Webzine:NombreDerniereChronique");
|
var derniereChronique = this.configuration.GetValue<int>("Webzine:NombreDerniereChronique");
|
||||||
var topTitres = _configuration.GetValue<int>("Webzine:NombreDeTopTitres");
|
var topTitres = this.configuration.GetValue<int>("Webzine:NombreDeTopTitres");
|
||||||
var titres = FakeDataFactory.GetTitres();
|
var titres = FakeDataFactory.GetTitres();
|
||||||
|
|
||||||
var vm = new AccueilIndexViewModel
|
var vm = new AccueilIndexViewModel
|
||||||
@@ -44,10 +51,10 @@ namespace Webzine.WebApplication.Controllers
|
|||||||
TopTitres = titres
|
TopTitres = titres
|
||||||
.OrderByDescending(t => t.NbLikes)
|
.OrderByDescending(t => t.NbLikes)
|
||||||
.Take(topTitres)
|
.Take(topTitres)
|
||||||
.ToList()
|
.ToList(),
|
||||||
};
|
};
|
||||||
|
|
||||||
return View(vm);
|
return this.View(vm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,15 +8,19 @@
|
|||||||
<div class="container">
|
<div class="container">
|
||||||
@foreach (var titre in Model.DerniersTitres)
|
@foreach (var titre in Model.DerniersTitres)
|
||||||
{
|
{
|
||||||
<div class="container bg-light row p-3 mt-3">
|
<div class="row bg-light p-3 mt-3 align-items-center">
|
||||||
<div class="col-auto">
|
|
||||||
<img class="img-thumbnail img-fluid"
|
<!-- Image -->
|
||||||
style="max-width:200px;" @* TODO à virer pour que ça soit responsive *@
|
<div class="col-12 col-md-3 text-center mb-3 mb-md-0">
|
||||||
@* UrlJaquette *@
|
<img class="img-fluid img-thumbnail"
|
||||||
src="@titre.UrlJaquette" />
|
src="@titre.UrlJaquette"
|
||||||
|
alt="@titre.Libelle" />
|
||||||
</div>
|
</div>
|
||||||
<div class="col">
|
|
||||||
@* Artiste - Titre @titre.Artiste - @titre.Libelle*@
|
<!-- Contenu -->
|
||||||
|
<div class="col-12 col-md-9">
|
||||||
|
|
||||||
|
<!-- Artiste - Titre -->
|
||||||
<div class="fw-light h4 text-primary">
|
<div class="fw-light h4 text-primary">
|
||||||
<a asp-action="Index"
|
<a asp-action="Index"
|
||||||
asp-controller="Artiste"
|
asp-controller="Artiste"
|
||||||
@@ -30,48 +34,68 @@
|
|||||||
@titre.Libelle
|
@titre.Libelle
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
@* Chronique *@
|
|
||||||
<p class="mt-2 mb-3 text-muted ">
|
<!-- Chronique -->
|
||||||
|
<p class="mt-2 mb-3 text-muted">
|
||||||
@titre.Chronique
|
@titre.Chronique
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<!-- Footer -->
|
||||||
<div class="d-flex flex-wrap align-items-center gap-3">
|
<div class="d-flex flex-wrap align-items-center gap-3">
|
||||||
<a asp-action="Details" asp-controller="Titre" asp-route-id="@titre.IdTitre" class="btn btn-primary btn-sm">Lire la suite</a>
|
<a asp-action="Details"
|
||||||
|
asp-controller="Titre"
|
||||||
|
asp-route-id="@titre.IdTitre"
|
||||||
|
class="btn btn-primary btn-sm">
|
||||||
|
Lire la suite
|
||||||
|
</a>
|
||||||
|
|
||||||
<div class="d-flex align-items-center text-muted small">
|
<div class="d-flex align-items-center text-muted small">
|
||||||
<i class="fa-solid fa-calendar me-1"> </i>
|
<i class="fa-solid fa-calendar me-1"></i>
|
||||||
@* Date de création *@
|
|
||||||
@titre.DateCreation
|
@titre.DateCreation
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="d-flex align-items-center text-muted small">
|
<div class="d-flex align-items-center text-muted small">
|
||||||
<i class="fa-solid fa-tags"></i>
|
<i class="fa-solid fa-tags me-1"></i>
|
||||||
@* Style *@
|
<a asp-controller="Titre"
|
||||||
<a asp-controller="Titre" asp-action="Style" asp-route-id="Pop" class="m-1">Pop</a>
|
asp-action="Style"
|
||||||
|
asp-route-id="Pop"
|
||||||
|
class="text-decoration-none">
|
||||||
|
Pop
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
<!-- Bouton -->
|
||||||
<div class="row justify-content-end">
|
<div class="row justify-content-end">
|
||||||
<button class="btn btn-secondary col-auto mt-3">Titres plus anciens >></button>
|
<button class="btn btn-secondary col-auto mt-3">
|
||||||
|
Titres plus anciens >>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<h1 class="mt-5">Titres les plus populaires</h1>
|
<h1 class="mt-5">Titres les plus populaires</h1>
|
||||||
<div class="row">
|
<div class="row g-3">
|
||||||
@foreach (var titre in Model.TopTitres)
|
@foreach (var titre in Model.TopTitres)
|
||||||
{
|
{
|
||||||
<div class="card col m-1" style="width: auto;">
|
<div class="col-12 col-md-6 col-lg-4">
|
||||||
<img class="card-img-top"
|
<div class="card h-100">
|
||||||
src="@titre.UrlJaquette" />
|
<img class="card-img-top" src="@titre.UrlJaquette" alt="@titre.Album" />
|
||||||
|
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<a asp-controller="Titre" asp-action="Details" asp-route-id="@titre.IdTitre" class="card-link">@titre.Album</a><br />
|
<a asp-controller="Titre" asp-action="Details" asp-route-id="@titre.IdTitre" class="card-link">
|
||||||
par <a asp-controller="Artiste" asp-action="Index" asp-route-nom="@titre.Artiste.Nom" class="card-link">@titre.Artiste.Nom</a>
|
@titre.Album
|
||||||
|
</a>
|
||||||
|
<br />
|
||||||
|
par
|
||||||
|
<a asp-controller="Artiste" asp-action="Index" asp-route-nom="@titre.Artiste.Nom" class="card-link">
|
||||||
|
@titre.Artiste.Nom
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
}
|
||||||
}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
@{
|
@{
|
||||||
ViewData["Title"] = "Recherche";
|
ViewData["Title"] = "Recherche";
|
||||||
Layout = "_Layout"; //TODO à virer c'est déjà dans le _ViewStart
|
|
||||||
}
|
}
|
||||||
|
|
||||||
<div class="container mt-4">
|
<div class="container mt-4">
|
||||||
|
|||||||
@@ -3,11 +3,6 @@
|
|||||||
*@
|
*@
|
||||||
@{
|
@{
|
||||||
}
|
}
|
||||||
<div class="site-footer text-bg-light mt-auto">
|
<footer class="py-3 text-bg-light">
|
||||||
<footer class="d-flex flex-wrap justify-content-between align-items-center py-3">
|
<p class="ms-5">© ASP .NET Core - DIIAGE 2025 - 2026</p>
|
||||||
<div class="col-md-4 d-flex align-items-center">
|
</footer>
|
||||||
|
|
||||||
<span class="mb-3 mb-md-0 ms-5 text-body-secondary">© ASP .NET Core - DIIAGE 2025 - 2026</span>
|
|
||||||
</div>
|
|
||||||
</footer>
|
|
||||||
</div>
|
|
||||||
|
|||||||
@@ -6,29 +6,25 @@
|
|||||||
<title>@ViewData["Title"] - Webzine</title>
|
<title>@ViewData["Title"] - Webzine</title>
|
||||||
|
|
||||||
@* Ajout de bootstrap *@
|
@* Ajout de bootstrap *@
|
||||||
<script src="~/js/bootstrap.min.js" defer></script> //TODO virer le bootstrap.bundle.js qui est en double
|
|
||||||
<script src="~/js/bootstrap.bundle.js" defer></script> //TODO script pas bien placé
|
|
||||||
<link rel="stylesheet" href="~/css/app.css"> // TODO mettre le app.css après le bootstrap pour pouvoir override les styles de bootstrap si besoin
|
|
||||||
<link rel="stylesheet" href="~/css/bootstrap.min.css">
|
<link rel="stylesheet" href="~/css/bootstrap.min.css">
|
||||||
|
<link rel="stylesheet" href="~/css/all.min.css">
|
||||||
|
<link rel="stylesheet" href="~/css/app.css">
|
||||||
|
|
||||||
@* Ajout de font-awesome, TODO cdn à virer, mettre font awesome dans le projet *@
|
<script src="~/js/bootstrap.bundle.js" defer></script>
|
||||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="site-shell">
|
<partial name="_Header"/>
|
||||||
<partial name="_Header"/>
|
<div class="container-fluid flex-grow-1 py-4">
|
||||||
<div class="container-fluid flex-grow-1 py-4">
|
<div class="row">
|
||||||
<div class="row g-0">
|
<main class="col mx-3">
|
||||||
<main class="col mx-3">
|
@RenderBody()
|
||||||
@RenderBody()
|
</main>
|
||||||
</main>
|
@if(ViewContext.RouteData.Values["area"]?.ToString() != "Administration")
|
||||||
@if(ViewContext.RouteData.Values["area"]?.ToString() != "Administration")
|
{
|
||||||
{
|
<partial name="_Sidebar" />
|
||||||
<partial name="_Sidebar" />
|
}
|
||||||
}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<partial name="_Footer" />
|
|
||||||
</div>
|
</div>
|
||||||
|
<partial name="_Footer" />
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
*@
|
*@
|
||||||
@{
|
@{
|
||||||
}
|
}
|
||||||
<aside class="col-3">
|
<aside class="col-lg-3 d-none d-lg-block">
|
||||||
<div>
|
<div>
|
||||||
<h2>À propos</h2>
|
<h2>À propos</h2>
|
||||||
<p>Retrouvez les dernières pépites sur notre webzine.</p>
|
<p>Retrouvez les dernières pépites sur notre webzine.</p>
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
@{
|
@{
|
||||||
ViewData["Title"] = $"Titres - {Model.StyleName}";
|
ViewData["Title"] = $"Titres - {Model.StyleName}";
|
||||||
Layout = "_Layout"; //TODO à virer c'est déjà dans le _ViewStart
|
|
||||||
}
|
}
|
||||||
<div class="container mt-4">
|
<div class="container mt-4">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|||||||
9
Webzine.WebApplication/wwwroot/css/all.min.css
vendored
Normal file
9
Webzine.WebApplication/wwwroot/css/all.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
6
Webzine.WebApplication/wwwroot/js/all.min.js
vendored
Normal file
6
Webzine.WebApplication/wwwroot/js/all.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
BIN
Webzine.WebApplication/wwwroot/webfonts/fa-brands-400.woff2
Normal file
BIN
Webzine.WebApplication/wwwroot/webfonts/fa-brands-400.woff2
Normal file
Binary file not shown.
BIN
Webzine.WebApplication/wwwroot/webfonts/fa-regular-400.woff2
Normal file
BIN
Webzine.WebApplication/wwwroot/webfonts/fa-regular-400.woff2
Normal file
Binary file not shown.
BIN
Webzine.WebApplication/wwwroot/webfonts/fa-solid-900.woff2
Normal file
BIN
Webzine.WebApplication/wwwroot/webfonts/fa-solid-900.woff2
Normal file
Binary file not shown.
BIN
Webzine.WebApplication/wwwroot/webfonts/fa-v4compatibility.woff2
Normal file
BIN
Webzine.WebApplication/wwwroot/webfonts/fa-v4compatibility.woff2
Normal file
Binary file not shown.
Reference in New Issue
Block a user