compiles, needs db update

This commit is contained in:
Adam R Grey 2024-07-07 14:22:10 -04:00
parent 1d73fe0be8
commit 9648ea563b
3 changed files with 60 additions and 16 deletions

View File

@ -11,6 +11,9 @@ public class User
public Guid Id { get; set; } public Guid Id { get; set; }
public List<Account> Accounts { get; set; } public List<Account> Accounts { get; set; }
//if I ever get lots and lots of tags, or some automatic way to register a feature's arbitrary tags, then I can move this off.
public bool Tag_CanTwitchSummon { get; set; }
public string DisplayName public string DisplayName
{ {
get get

View File

@ -1,15 +1,35 @@
@model User @model User
@using System.Text
@{ @{
ViewData["Title"] = "User details"; ViewData["Title"] = "User details";
} }
<table class="table">
<tbody>
<tr>
<th scope="row">Display Name</th>
<td>@Model.DisplayName</td>
</tr>
<tr>
<th scope="row">Accounts</th>
<td>
<div id="accountsTree"></div>
</td>
</tr>
<tr>
<th scope="row">Permission Tags</th>
<td>
<div id="tagsTree"></div>
</td>
</tr>
</tbody>
</table>
User @Model.DisplayName<br />
<div class="permissions">
</div> @section Scripts{
<div class="accounts"> <script type="text/javascript">
var detailLink='<a asp-controller="Accounts" asp-action="Details" asp-route-id="accid">Details</a>;
@foreach (var acc in Model.Accounts) @foreach (var acc in Model.Accounts)
{ {
<div class="account @acc.Protocol"> <div class="account @acc.Protocol">
@ -18,4 +38,25 @@ User @Model.DisplayName<br />
<a asp-controller="Accounts" asp-action="Details" asp-route-id="@acc.Id">Details</a> <a asp-controller="Accounts" asp-action="Details" asp-route-id="@acc.Id">Details</a>
</div> </div>
} }
</div> function getTree() {
@{
var sb = new StringBuilder();
sb.Append("[{text: \"accounts\", \"expanded\":true, nodes: [");
var first = true;
foreach (var acc in Model.Accounts)
{
if(!first)
sb.Append(',');
sb.Append($"{{text: \"<div class=\"account {acc.Protocol}\"><div class=\"protocol-icon\">&nbsp;</div>{Html.DisplayFor(acc => acc.DisplayName)}Details\"}}");
first=false;
}
sb.Append("}]");
}
var tree = @Html.Raw(sb.ToString());
console.log(tree);
return tree;
}
$('#accountsTree').bstreeview({ data: getTree() });
</script>
}

View File

@ -2,10 +2,10 @@
// for details on configuring this project to bundle and minify static web assets. // for details on configuring this project to bundle and minify static web assets.
// Write your JavaScript code. // Write your JavaScript code.
function Account(displayName, accountId, protocol){
function testfunct(caller){ this.displayName = displayName;
console.log("[gibberish]"); this.accountId = accountId;
console.log(caller); this.protocol = protocol;
} }
//todo: figure out what the URL actually needs to be, rather than assuming you get a whole-ass server to yourself. //todo: figure out what the URL actually needs to be, rather than assuming you get a whole-ass server to yourself.
//you selfish fuck... What are you, fox? //you selfish fuck... What are you, fox?