diff --git a/ProjectLighthouse/Pages/Layouts/BaseLayout.cshtml.cs b/ProjectLighthouse/Pages/Layouts/BaseLayout.cshtml.cs index eaca0975..5046b568 100644 --- a/ProjectLighthouse/Pages/Layouts/BaseLayout.cshtml.cs +++ b/ProjectLighthouse/Pages/Layouts/BaseLayout.cshtml.cs @@ -9,12 +9,11 @@ namespace LBPUnion.ProjectLighthouse.Pages.Layouts { public readonly Database Database; - private User? user; - public string Title = string.Empty; - public bool ShowTitleInPage = true; + private User? user; + public new User? User { get { if (this.user != null) return this.user; diff --git a/ProjectLighthouse/Pages/Partials/SlotCardPartial.cshtml b/ProjectLighthouse/Pages/Partials/SlotCardPartial.cshtml index 61fcf25b..1d64b996 100644 --- a/ProjectLighthouse/Pages/Partials/SlotCardPartial.cshtml +++ b/ProjectLighthouse/Pages/Partials/SlotCardPartial.cshtml @@ -21,10 +21,22 @@ } string callbackUrl = (string)ViewData["CallbackUrl"]; + bool showLink = (bool?)ViewData["ShowLink"] ?? false; }
-

@slotName

+ @if (showLink) + { +

+ @slotName +

+ } + else + { +

+ @slotName +

+ }
@Model.Hearts @Model.Plays diff --git a/ProjectLighthouse/Pages/SlotPage.cshtml b/ProjectLighthouse/Pages/SlotPage.cshtml new file mode 100644 index 00000000..75145e55 --- /dev/null +++ b/ProjectLighthouse/Pages/SlotPage.cshtml @@ -0,0 +1,40 @@ +@page "/slot/{id:int}" +@model LBPUnion.ProjectLighthouse.Pages.SlotPage + +@{ + Layout = "Layouts/BaseLayout"; + Model.Title = Model.Slot.Name; + Model.ShowTitleInPage = false; +} + +@await Html.PartialAsync("Partials/SlotCardPartial", Model.Slot, new ViewDataDictionary(ViewData) +{ + { + "User", Model.User + }, + { + "CallbackUrl", $"~/slot/{Model.Slot.SlotId}" + }, + { + "ShowLink", false + }, +}) + + +
+
+
+

Description

+

@Model.Slot.Description

+
+
+
+
+

Tags

+ @foreach (string label in Model.Slot.AuthorLabels.Split(",")) + { +
@label.Replace("LABEL_", "")
+ } +
+
+
\ No newline at end of file diff --git a/ProjectLighthouse/Pages/SlotPage.cshtml.cs b/ProjectLighthouse/Pages/SlotPage.cshtml.cs new file mode 100644 index 00000000..bd2de3ab --- /dev/null +++ b/ProjectLighthouse/Pages/SlotPage.cshtml.cs @@ -0,0 +1,28 @@ +#nullable enable +using System.Threading.Tasks; +using JetBrains.Annotations; +using LBPUnion.ProjectLighthouse.Pages.Layouts; +using LBPUnion.ProjectLighthouse.Types.Levels; +using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; + +namespace LBPUnion.ProjectLighthouse.Pages +{ + public class SlotPage : BaseLayout + { + public SlotPage([NotNull] Database database) : base(database) + {} + + public Slot Slot; + + public async Task OnGet([FromRoute] int id) + { + Slot? slot = await this.Database.Slots.FirstOrDefaultAsync(s => s.SlotId == id); + if (slot == null) return this.NotFound(); + + this.Slot = slot; + + return this.Page(); + } + } +} \ No newline at end of file diff --git a/ProjectLighthouse/Pages/SlotsPage.cshtml b/ProjectLighthouse/Pages/SlotsPage.cshtml index f94c1c69..ef76e3aa 100644 --- a/ProjectLighthouse/Pages/SlotsPage.cshtml +++ b/ProjectLighthouse/Pages/SlotsPage.cshtml @@ -20,6 +20,9 @@ { "CallbackUrl", $"~/slots/{Model.PageNumber}" }, + { + "ShowLink", true + }, })
}