84 lines
3.2 KiB
Plaintext
84 lines
3.2 KiB
Plaintext
@page
|
|
@model GanjooRazor.Areas.User.Pages.ReportedCommentsModel
|
|
@using DNTPersianUtils.Core
|
|
@{
|
|
Layout = "_UserPanelLayout";
|
|
ViewData["Title"] = "حاشیههای گزارش شده";
|
|
await GanjooRazor.Utils.GanjoorSessionChecker.ApplyPermissionsToViewData(Request, Response, ViewData);
|
|
}
|
|
<div class="up-page-header">
|
|
<h1>@ViewData["Title"]</h1>
|
|
</div>
|
|
@if (Model.LastError != "")
|
|
{
|
|
<div class="up-alert up-alert--danger">@Model.LastError</div>
|
|
}
|
|
else
|
|
{
|
|
<script>
|
|
async function moderateReportedComment(reportId) {
|
|
var ok = await upConfirm('آیا از حذف این حاشیه اطمینان دارید؟');
|
|
if (!ok) return;
|
|
|
|
$.ajax({
|
|
type: "POST",
|
|
url: '?handler=ModerateComment',
|
|
data: { id: reportId },
|
|
error: function (e) {
|
|
upToast(e.responseText || 'خطا رخ داد.', 'error');
|
|
},
|
|
success: function () {
|
|
$('#report-' + reportId).remove();
|
|
upToast('حاشیه حذف شد.', 'success');
|
|
},
|
|
});
|
|
}
|
|
|
|
function deleteReport(reportId) {
|
|
$.ajax({
|
|
type: "DELETE",
|
|
url: '?handler=Report',
|
|
data: { id: reportId },
|
|
error: function (e) {
|
|
upToast(e.responseText || 'خطا رخ داد.', 'error');
|
|
},
|
|
success: function () {
|
|
$('#report-' + reportId).remove();
|
|
upToast('گزارش حذف شد.', 'success');
|
|
},
|
|
});
|
|
}
|
|
</script>
|
|
|
|
<partial name="_Pagination" model="Model.PaginationLinks" />
|
|
|
|
@if (Model.Reports.Count == 0)
|
|
{
|
|
<partial name="_EmptyState" model="@("گزارش رسیدگینشدهای وجود ندارد.")" />
|
|
}
|
|
else
|
|
{
|
|
<div class="up-list">
|
|
@foreach (var report in Model.Reports)
|
|
{
|
|
<div class="up-list-item" id="report-@report.Id">
|
|
<span class="up-badge up-badge--danger">@report.ReasonCode</span>
|
|
<p>@report.ReasonText</p>
|
|
<blockquote>
|
|
@Html.Raw(report.Comment.HtmlComment)
|
|
<div class="up-list-item__meta">
|
|
@report.Comment.AuthorName در @report.Comment.CommentDate.ToFriendlyPersianDateTextify() دربارهٔ <a href="@report.Comment.Poem.UrlSlug#comment-@report.Comment.Id">@report.Comment.Poem.Title</a>
|
|
</div>
|
|
</blockquote>
|
|
<div class="up-list-item__actions">
|
|
<a role="button" onclick="moderateReportedComment(@report.Id)" class="up-btn up-btn--danger up-btn--sm" title="تأیید و حذف حاشیه">✓ درست میگوید</a>
|
|
<a role="button" onclick="deleteReport(@report.Id)" class="up-btn up-btn--ghost up-btn--sm" title="حذف گزارش">گزارش نابجا ❌</a>
|
|
</div>
|
|
</div>
|
|
}
|
|
</div>
|
|
}
|
|
|
|
<partial name="_Pagination" model="Model.PaginationLinks" />
|
|
}
|