1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-06-27 15:40:32 -05:00

finish initial rework of profile page with meta pagination

This commit is contained in:
RaidMax
2019-03-29 21:56:56 -05:00
parent 25472b06c3
commit 807d9fa069
16 changed files with 227 additions and 140 deletions

View File

@ -79,7 +79,6 @@
</div>
<div id="profile_info" class="row d-block d-lg-flex flex-row border-bottom border-top pt-2 pb-2">
<div id="profile_meta_0" class="text-center text-lg-left mr-0 mr-lg-4">
@for (int i = 0; i < informationMeta.Count; i += 3)
{
@ -117,6 +116,10 @@
</div>
</div>
<div class="row">
<div class="oi oi-chevron-bottom text-center mt-2 btn btn-primary btn-block loader-load-more" title="Load more meta" data-action="unban" aria-hidden="true"></div>
</div>
@section targetid {
<input type="hidden" name="targetId" value="@Model.ClientId" />
}

View File

@ -1,20 +1,62 @@
@model List<SharedLibraryCore.Dtos.ProfileMeta>
@{Layout = null;}
@{
Layout = null;
<div class="p2 text-white profile-event-timestep">
<span class="text-primary">&mdash;</span>
<span>@SharedLibraryCore.Utilities.GetTimePassed(Model.FirstOrDefault()?.When ?? DateTime.Now, true)</span>
</div>
string formatPenalty(SharedLibraryCore.Dtos.ProfileMeta meta)
{
var penalty = meta.Value as SharedLibraryCore.Dtos.PenaltyInfo;
@foreach (var meta in Model)
string localizationKey = meta.Type == SharedLibraryCore.Dtos.ProfileMeta.MetaType.Penalized ?
$"WEBFRONT_CLIENT_META_PENALIZED_{penalty.PenaltyType.ToUpper()}" :
$"WEBFRONT_CLIENT_META_WAS_PENALIZED_{penalty.PenaltyType.ToUpper()}";
string localizationMessage = SharedLibraryCore.Utilities.CurrentLocalization.LocalizationIndex[localizationKey];
var regexMatch = System.Text.RegularExpressions.Regex.Match(localizationMessage, @"^{{([^{}]+)}}.+$");
string penaltyType = regexMatch.Groups[1].Value.ToString();
localizationMessage = localizationMessage.Replace(penaltyType, $"<span class='penalties-color-{penalty.PenaltyType.ToLower()}'>{penaltyType}</span>");
return meta.Type == SharedLibraryCore.Dtos.ProfileMeta.MetaType.Penalized ?
string.Format(localizationMessage,
$"<span class='text-highlight'><a class='link-inverse' href='{penalty.OffenderId}'>{penalty.OffenderName}</a></span>",
$"<span class='automated-penalty-info-detailed text-white' data-clientid='{penalty.OffenderId}'>{penalty.Offense}</span>")
.Replace("{", "")
.Replace("}", "") :
string.Format(localizationMessage,
$"<span class='text-highlight'><a class='link-inverse' href='{penalty.PunisherId}'>{penalty.PunisherName}</a></span>",
$"<span class='automated-penalty-info-detailed text-white' data-clientid='{penalty.OffenderId}'>{penalty.Offense}</span>",
penalty.Offense)
.Replace("{", "")
.Replace("}", "");
}
}
@if (Model.Count > 0)
{
<div class="p2 text-white profile-event-timestep">
<span class="text-primary">&mdash;</span>
<span>@SharedLibraryCore.Utilities.GetTimePassed(Model.First().When, true)</span>
</div>
}
@if (Model.Count == 0)
{
<div class="p2 text-muted profile-event-timestep">@SharedLibraryCore.Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_CLIENT_META_NONE"]</div>
}
@foreach (var meta in Model.OrderByDescending(_meta => _meta.When))
{
@switch (meta.Type)
{
case SharedLibraryCore.Dtos.ProfileMeta.MetaType.ChatMessage:
<div>
<div class="profile-meta-entry loader-data-time" data-time="@meta.When">
<span style="color:white;">></span>
<span class="client-message text-muted" data-serverid="@meta.Extra" data-when="@meta.When"> @meta.Value</span>
</div>
break;
case SharedLibraryCore.Dtos.ProfileMeta.MetaType.ReceivedPenalty:
case SharedLibraryCore.Dtos.ProfileMeta.MetaType.Penalized:
<div class="profile-meta-entry loader-data-time" data-time="@meta.When">@Html.Raw(formatPenalty(meta))</div>
break;
}
}