feature: support hiding user details with asterisk and ampersand suffixes

This commit is contained in:
Gary Sharp
2022-12-09 12:23:41 +11:00
parent b11fa5b1d6
commit 2bd9238090
6 changed files with 967 additions and 607 deletions
@@ -187,15 +187,35 @@
</tr>
</table>
</div>
@if (Model.DeviceDetails != null && Model.DeviceDetails.Details.Count > 0)
@if (Model.DeviceDetails != null && Model.DeviceDetails.Details.Count(d => !d.Key.EndsWith("&")) > 0)
{
<div id="Device_Show_CustomDetails" class="status clearfix">
@foreach (var detail in Model.DeviceDetails.Details)
@foreach (var detail in Model.DeviceDetails.Details.Where(d => !d.Key.EndsWith("&")))
{
<div>
<strong>@detail.Key:</strong> @Html.Partial(MVC.Shared.Views._CustomDetailValueRender, detail)
<strong>@detail.Key.TrimEnd('*'):</strong>
@if (detail.Key.EndsWith("*"))
{
<a href="" class="reveal smallMessage">[reveal]</a>
<span class="reveal hidden">@Html.Partial(MVC.Shared.Views._CustomDetailValueRender, detail)</span>
}
else
{
@Html.Partial(MVC.Shared.Views._CustomDetailValueRender, detail)
}
</div>
}
<script type="text/javascript">
$(() => {
$('#Device_Show_CustomDetails').on('click', 'a.reveal', e => {
e.preventDefault();
const t = $(e.currentTarget);
t.next('span.reveal').removeClass('hidden');
t.remove();
return false;
})
});
</script>
</div>
}
<div class="status">
@@ -283,15 +303,35 @@
</script>
</div>
}
@if (Model.AssignedUserDetails != null && Model.AssignedUserDetails.Details.Count > 0)
@if (Model.AssignedUserDetails != null && Model.AssignedUserDetails.Details.Count(d => !d.Key.EndsWith("&")) > 0)
{
<div id="Device_Show_User_CustomDetails" class="status clearfix">
@foreach (var detail in Model.AssignedUserDetails.Details)
@foreach (var detail in Model.AssignedUserDetails.Details.Where(d => !d.Key.EndsWith("&")))
{
<div>
<strong>@detail.Key:</strong> @Html.Partial(MVC.Shared.Views._CustomDetailValueRender, detail)
<strong>@detail.Key.TrimEnd('*'):</strong>
@if (detail.Key.EndsWith("*"))
{
<a href="" class="reveal smallMessage">[reveal]</a>
<span class="reveal hidden">@Html.Partial(MVC.Shared.Views._CustomDetailValueRender, detail)</span>
}
else
{
@Html.Partial(MVC.Shared.Views._CustomDetailValueRender, detail)
}
</div>
}
<script type="text/javascript">
$(() => {
$('#Device_Show_User_CustomDetails').on('click', 'a.reveal', e => {
e.preventDefault();
const t = $(e.currentTarget);
t.next('span.reveal').removeClass('hidden');
t.remove();
return false;
})
});
</script>
</div>
}
</div>