mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-08-21 09:49:34 +00:00
Add admin/mod badges on UserCardPartial (#697)
* Add admin/mod badges to UserCardPartial * Correct vertical alignment of badges * Move most of styling to stylesheet, lazy but it works * Implement more modular role coloring for UserLinkPartial and UserCardPartial --------- Co-authored-by: Slendy <josh@slendy.pw>
This commit is contained in:
parent
223cc0c883
commit
05b71b0d22
4 changed files with 49 additions and 9 deletions
|
@ -1,4 +1,5 @@
|
||||||
@using LBPUnion.ProjectLighthouse.Localization
|
@using LBPUnion.ProjectLighthouse.Localization
|
||||||
|
@using LBPUnion.ProjectLighthouse.Types.Users
|
||||||
@model LBPUnion.ProjectLighthouse.Types.Entities.Profile.User
|
@model LBPUnion.ProjectLighthouse.Types.Entities.Profile.User
|
||||||
|
|
||||||
@{
|
@{
|
||||||
|
@ -11,15 +12,9 @@
|
||||||
<a href="/user/@Model.UserId" title="@userStatus" class="user-link">
|
<a href="/user/@Model.UserId" title="@userStatus" class="user-link">
|
||||||
<img src="/gameAssets/@Model.WebsiteAvatarHash" alt=""/>
|
<img src="/gameAssets/@Model.WebsiteAvatarHash" alt=""/>
|
||||||
|
|
||||||
@if (Model.IsAdmin)
|
@if (Model.IsModerator)
|
||||||
{
|
{
|
||||||
<span style="color: red; font-weight: 600;">
|
<span style="color: @Model.PermissionLevel.ToHtmlColor(); font-weight: 600;">
|
||||||
@Model.Username
|
|
||||||
</span>
|
|
||||||
}
|
|
||||||
else if (Model.IsModerator)
|
|
||||||
{
|
|
||||||
<span style="color: rgb(200, 130, 0); font-weight: 600;">
|
|
||||||
@Model.Username
|
@Model.Username
|
||||||
</span>
|
</span>
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
@using LBPUnion.ProjectLighthouse.Localization
|
@using LBPUnion.ProjectLighthouse.Localization
|
||||||
|
@using LBPUnion.ProjectLighthouse.Types.Users
|
||||||
@model LBPUnion.ProjectLighthouse.Types.Entities.Profile.User
|
@model LBPUnion.ProjectLighthouse.Types.Entities.Profile.User
|
||||||
|
|
||||||
@{
|
@{
|
||||||
|
@ -19,12 +20,24 @@
|
||||||
{
|
{
|
||||||
<h2 style="margin-bottom: 2px;">
|
<h2 style="margin-bottom: 2px;">
|
||||||
<a href="~/user/@Model.UserId">@Model.Username</a>
|
<a href="~/user/@Model.UserId">@Model.Username</a>
|
||||||
|
@if (Model.IsModerator)
|
||||||
|
{
|
||||||
|
<span class="permissionBadge" style="background-color: @Model.PermissionLevel.ToHtmlColor();">
|
||||||
|
@Model.PermissionLevel.ToString()
|
||||||
|
</span>
|
||||||
|
}
|
||||||
</h2>
|
</h2>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<h1 style="margin-bottom: 2px;">
|
<h1 style="margin-bottom: 2px;">
|
||||||
@Model.Username
|
@Model.Username
|
||||||
|
@if (Model.IsModerator)
|
||||||
|
{
|
||||||
|
<span class="permissionBadge" style="background-color: @Model.PermissionLevel.ToHtmlColor();">
|
||||||
|
@Model.PermissionLevel.ToString()
|
||||||
|
</span>
|
||||||
|
}
|
||||||
</h1>
|
</h1>
|
||||||
}
|
}
|
||||||
<span>
|
<span>
|
||||||
|
|
|
@ -241,3 +241,22 @@ div.cardStatsUnderTitle > span {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*#endregion Slot labels */
|
/*#endregion Slot labels */
|
||||||
|
|
||||||
|
/*#region User permission badge */
|
||||||
|
|
||||||
|
.permissionBadge {
|
||||||
|
width: auto;
|
||||||
|
height: auto;
|
||||||
|
color: white;
|
||||||
|
background-color: inherit;
|
||||||
|
border: 0px solid black;
|
||||||
|
border-radius: 50px;
|
||||||
|
font-weight: 200;
|
||||||
|
font-size: 10pt;
|
||||||
|
padding: 1px;
|
||||||
|
padding-left: 6px;
|
||||||
|
padding-right: 6px;
|
||||||
|
vertical-align: top;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*#endregion User permission badge */
|
|
@ -9,3 +9,16 @@ public enum PermissionLevel
|
||||||
Moderator = 1,
|
Moderator = 1,
|
||||||
Administrator = 2,
|
Administrator = 2,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class PermissionLevelExtensions
|
||||||
|
{
|
||||||
|
public static string ToHtmlColor(this PermissionLevel permissionLevel)
|
||||||
|
{
|
||||||
|
return permissionLevel switch
|
||||||
|
{
|
||||||
|
PermissionLevel.Administrator => "red",
|
||||||
|
PermissionLevel.Moderator => "rgb(200, 130, 0)",
|
||||||
|
_ => "",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue