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 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
{
get

View File

@ -1,21 +1,62 @@
@model User
@using System.Text
@{
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">
@foreach (var acc in Model.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)
{
<div class="account @acc.Protocol">
<div class="protocol-icon">&nbsp;</div>
@Html.DisplayFor(acc => acc.DisplayName)
<a asp-controller="Accounts" asp-action="Details" asp-route-id="@acc.Id">Details</a>
</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>
}
</div>

View File

@ -2,10 +2,10 @@
// for details on configuring this project to bundle and minify static web assets.
// Write your JavaScript code.
function testfunct(caller){
console.log("[gibberish]");
console.log(caller);
function Account(displayName, accountId, protocol){
this.displayName = displayName;
this.accountId = accountId;
this.protocol = protocol;
}
//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?