[application] added chat context to profile page
[iw4script] reworked balance to balance based on performance rating [stats] log penalty context to database
This commit is contained in:
@ -38,6 +38,7 @@ namespace WebfrontCore.Controllers
|
||||
|
||||
var penaltiesDto = penalties.Select(p => new PenaltyInfo()
|
||||
{
|
||||
Id = p.PenaltyId,
|
||||
OffenderId = p.OffenderId,
|
||||
Offense = p.Offense,
|
||||
PunisherId = p.PunisherId,
|
||||
|
@ -15,6 +15,7 @@ namespace WebfrontCore.ViewComponents
|
||||
var penalties = await Program.Manager.GetPenaltyService().GetRecentPenalties(12, offset, showOnly);
|
||||
var penaltiesDto = penalties.Select(p => new PenaltyInfo()
|
||||
{
|
||||
Id = p.PenaltyId,
|
||||
OffenderId = p.OffenderId,
|
||||
OffenderName = p.Offender.Name,
|
||||
PunisherId = p.PunisherId,
|
||||
|
12
WebfrontCore/Views/Client/_MessageContext.cshtml
Normal file
12
WebfrontCore/Views/Client/_MessageContext.cshtml
Normal file
@ -0,0 +1,12 @@
|
||||
@model IEnumerable<SharedLibraryCore.Dtos.ChatInfo>
|
||||
@{
|
||||
Layout = null;
|
||||
}
|
||||
|
||||
<div class="client-message-context bg-dark p-2 mt-2 mb-2 border-top border-bottom">
|
||||
<h5>@Model.First().Time.ToString()</h5>
|
||||
@foreach (var message in Model)
|
||||
{
|
||||
<span class="text-white">@message.Name</span><span> — @message.Message</span><br />
|
||||
}
|
||||
</div>
|
@ -53,6 +53,7 @@
|
||||
<PackageReference Include="Bower" Version="1.3.11" />
|
||||
<PackageReference Include="BuildBundlerMinifier" Version="2.6.375" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.7" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -201,3 +201,7 @@ select {
|
||||
.client-rating-change-amount {
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.client-message {
|
||||
cursor:pointer;
|
||||
}
|
||||
|
@ -55,6 +55,44 @@ $(document).ready(function () {
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
* load context of chat
|
||||
*/
|
||||
$(document).on('click', '.client-message', function (e) {
|
||||
showLoader();
|
||||
const location = $(this);
|
||||
$.get('/Stats/GetMessageAsync', {
|
||||
'serverId': $(this).data('serverid'),
|
||||
'when': $(this).data('when')
|
||||
})
|
||||
.done(function (response) {
|
||||
$('.client-message-context').remove();
|
||||
location.after(response);
|
||||
hideLoader();
|
||||
})
|
||||
.fail(function (jqxhr, textStatus, error) {
|
||||
errorLoader();
|
||||
});
|
||||
});
|
||||
|
||||
/*
|
||||
* load info on ban/flag
|
||||
*/
|
||||
$(document).on('click', '.automated-penalty-info-detailed', function (e) {
|
||||
showLoader();
|
||||
const location = $(this).parent();
|
||||
$.get('/Stats/GetAutomatedPenaltyInfoAsync', {
|
||||
'clientId': $(this).data('clientid'),
|
||||
})
|
||||
.done(function (response) {
|
||||
location.after(response);
|
||||
hideLoader();
|
||||
})
|
||||
.fail(function (jqxhr, textStatus, error) {
|
||||
errorLoader();
|
||||
});
|
||||
});
|
||||
|
||||
/*
|
||||
get ip geolocation info into modal
|
||||
*/
|
||||
@ -97,7 +135,7 @@ $(document).ready(function () {
|
||||
})
|
||||
.fail(function (jqxhr, textStatus, error) {
|
||||
$('#mainModal .modal-title').text("Error");
|
||||
$('#mainModal .modal-body').html('<span class="text-danger">—'+ error + '</span>');
|
||||
$('#mainModal .modal-body').html('<span class="text-danger">—' + error + '</span>');
|
||||
$('#mainModal').modal();
|
||||
});
|
||||
});
|
||||
@ -171,10 +209,10 @@ function loadMeta(meta) {
|
||||
const timeRemaining = meta.value.type === 'TempBan' && meta.value.timeRemaining.length > 0 ?
|
||||
`(${meta.value.timeRemaining} remaining)` :
|
||||
'';
|
||||
eventString = `<div><span class="penalties-color-${meta.value.type.toLowerCase()}">${penaltyToName(meta.value.type)}</span> by <span class="text-highlight"> <a class="link-inverse" href="${meta.value.punisherId}">${meta.value.punisherName}</a></span > for <span style="color: white; ">${meta.value.offense}</span><span class="text-muted"> ${timeRemaining}</span></div>`;
|
||||
eventString = `<div><span class="penalties-color-${meta.value.type.toLowerCase()}">${penaltyToName(meta.value.type)}</span> by <span class="text-highlight"> <a class="link-inverse" href="${meta.value.punisherId}">${meta.value.punisherName}</a></span > for <span style="color: white; " class="automated-penalty-info-detailed" data-clientid="${meta.value.offenderId}">${meta.value.offense}</span><span class="text-muted"> ${timeRemaining}</span></div>`;
|
||||
}
|
||||
else {
|
||||
eventString = `<div><span class="penalties-color-${meta.value.type.toLowerCase()}">${penaltyToName(meta.value.type)} </span> <span class="text-highlight"><a class="link-inverse" href="${meta.value.offenderId}"> ${meta.value.offenderName}</a></span > for <span style="color: white; ">${meta.value.offense}</span></div>`;
|
||||
eventString = `<div><span class="penalties-color-${meta.value.type.toLowerCase()}">${penaltyToName(meta.value.type)} </span> <span class="text-highlight"><a class="link-inverse" href="${meta.value.offenderId}"> ${meta.value.offenderName}</a></span > for <span style="color: white;" class="automated-penalty-info-detailed" data-clientid="${meta.value.offenderId}">${meta.value.offense}</span></div>`;
|
||||
}
|
||||
}
|
||||
else if (meta.key.includes("Alias")) {
|
||||
@ -182,7 +220,7 @@ function loadMeta(meta) {
|
||||
}
|
||||
// it's a message
|
||||
else if (meta.key.includes("Event")) {
|
||||
eventString = `<div><span style="color:white;">></span><span class="text-muted"> ${meta.value}</span></div>`;
|
||||
eventString = `<div><span style="color:white;">></span><span class="client-message text-muted" data-serverid="${meta.extra}" data-when="${meta.when}"> ${meta.value}</span></div>`;
|
||||
}
|
||||
$('#profile_events').append(eventString);
|
||||
}
|
||||
|
Reference in New Issue
Block a user