From c0cfa90874cf5a3d9963793b0cff0fb80040446c Mon Sep 17 00:00:00 2001 From: adam Date: Mon, 6 Jan 2025 00:14:56 -0500 Subject: [PATCH] i forget the opposite of @{} --- .../Controllers/ChannelsController.cs | 20 +++++++++++++ WebInterface/Views/Channels/Details.cshtml | 29 +++++++++++++------ 2 files changed, 40 insertions(+), 9 deletions(-) diff --git a/WebInterface/Controllers/ChannelsController.cs b/WebInterface/Controllers/ChannelsController.cs index 9a91891..188f40d 100644 --- a/WebInterface/Controllers/ChannelsController.cs +++ b/WebInterface/Controllers/ChannelsController.cs @@ -1,5 +1,6 @@ using System.ComponentModel; using System.Diagnostics; +using System.Text; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using vassago.Models; @@ -44,6 +45,25 @@ public class ChannelsController : Controller ViewData["breadcrumbs"]; walker = walker.ParentChannel; } + var sb = new StringBuilder(); + sb.Append("["); + sb.Append("{text: \"channels\", nodes: ["); + var first=true; + foreach(var subChannel in channel.SubChannels) + { + if(!first) + { + sb.Append(','); + } + else + { + first = false; + } + sb.Append($"{{\"text\": \"{subChannel.DisplayName}\""); + } + sb.Append("]"); + + ViewData.Add("channelsTree", sb.ToString()); return View( new Tuple( channel, channel.EffectivePermissions.LewdnessFilterLevel, channel.EffectivePermissions.MeannessFilterLevel diff --git a/WebInterface/Views/Channels/Details.cshtml b/WebInterface/Views/Channels/Details.cshtml index 442089c..df872d3 100644 --- a/WebInterface/Views/Channels/Details.cshtml +++ b/WebInterface/Views/Channels/Details.cshtml @@ -7,7 +7,7 @@ var IfInheritedMeannessFilterLevel = Model.Item3; } - +home/ @Html.Raw(ViewData["breadcrumbs"]) @@ -78,7 +78,16 @@ - + @@ -87,7 +96,6 @@
Sub Channels@(ThisChannel.SubChannels?.Count ?? 0) + @if((ThisChannel.SubChannels?.Count ?? 0) > 0) + { + @Html.Raw("
"); + } + else + { + @Html.Raw("0") + } +
Accounts
- @section Scripts{ } \ No newline at end of file