diff --git a/ProjectLighthouse.Servers.Website/Pages/SlotSettingsPage.cshtml b/ProjectLighthouse.Servers.Website/Pages/SlotSettingsPage.cshtml index 97d078261..0b5db4a23 100644 --- a/ProjectLighthouse.Servers.Website/Pages/SlotSettingsPage.cshtml +++ b/ProjectLighthouse.Servers.Website/Pages/SlotSettingsPage.cshtml @@ -60,6 +60,33 @@ function onSubmit(){ +
+ + + @if (Model.Slot.GameVersion != GameVersion.LittleBigPlanet1) + { + + } + else + { + + } @if (Model.Slot.GameVersion != GameVersion.LittleBigPlanet1) {
@@ -106,6 +133,14 @@ function onSubmit(){ function onHoverStart(btn){ generateRandomSkew(btn); } + function onCheckboxChange(checkbox) { + const label = checkbox.parentElement; + if (checkbox.checked) { + label.classList.add('selected'); + } else { + label.classList.remove('selected'); + } + } function generateRandomSkew(element){ let rand = Math.random() * 6 - 3; element.style.setProperty("--skew", "rotate(" + rand + "deg)"); diff --git a/ProjectLighthouse.Servers.Website/Pages/SlotSettingsPage.cshtml.cs b/ProjectLighthouse.Servers.Website/Pages/SlotSettingsPage.cshtml.cs index 2c44a87cb..39db9def9 100644 --- a/ProjectLighthouse.Servers.Website/Pages/SlotSettingsPage.cshtml.cs +++ b/ProjectLighthouse.Servers.Website/Pages/SlotSettingsPage.cshtml.cs @@ -5,6 +5,7 @@ using LBPUnion.ProjectLighthouse.Helpers; using LBPUnion.ProjectLighthouse.Servers.Website.Pages.Layouts; using LBPUnion.ProjectLighthouse.Types.Entities.Level; +using LBPUnion.ProjectLighthouse.Types.Users; using LBPUnion.ProjectLighthouse.Types.Filter; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; @@ -18,7 +19,18 @@ public class SlotSettingsPage : BaseLayout public SlotSettingsPage(DatabaseContext database) : base(database) {} - public async Task OnPost([FromRoute] int slotId, [FromForm] string? avatar, [FromForm] string? name, [FromForm] string? description, string? labels) + public async Task OnPost + ( + [FromRoute] int slotId, + [FromForm] string? avatar, + [FromForm] string? name, + [FromForm] string? description, + [FromForm] string? labels, + [FromForm] bool initiallyLocked, + [FromForm] int shareable, + [FromForm] bool subLevel, + [FromForm] bool lbp1Only + ) { this.Slot = await this.Database.Slots.FirstOrDefaultAsync(u => u.SlotId == slotId); if (this.Slot == null) return this.NotFound(); @@ -56,6 +68,22 @@ public async Task OnPost([FromRoute] int slotId, [FromForm] strin this.Slot.AuthorLabels = labels; } + if (this.Slot.InitiallyLocked != initiallyLocked) this.Slot.InitiallyLocked = initiallyLocked; + + if (this.Slot.Shareable != shareable) this.Slot.Shareable = shareable; + + if (this.Slot.SubLevel != subLevel) + { + if (this.Slot.GameVersion != GameVersion.LittleBigPlanet1) + this.Slot.SubLevel = subLevel; + } + + if (this.Slot.Lbp1Only != lbp1Only) + { + if (this.Slot.GameVersion == GameVersion.LittleBigPlanet1) + this.Slot.Lbp1Only = lbp1Only; + } + // ReSharper disable once InvertIf if (this.Database.ChangeTracker.HasChanges()) { @@ -77,4 +105,4 @@ public async Task OnGet([FromRoute] int slotId) return this.Page(); } -} \ No newline at end of file +}