divan/DiwanRazor/Areas/User/Pages/ReportedComments.cshtml
Anas Rashid e8f2306422 Rename Ganjoor -> Diwan throughout the code
Projects (GanjooRazor -> DiwanRazor, GanjoorService.sln -> DiwanService.sln), files,
folders, classes, namespaces, settings, API routes (/api/diwan) and DB tables (Diwan*).
External addresses (ganjoor.net, github.com/ganjoor) unchanged. Migrations renamed
consistently (no pending model changes); requires a fresh database.
Upstream RUNNING_LOCALLY/SEMANTIC_SEARCH docs archived unmodified under docs/.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 23:49:01 +02:00

84 lines
3.2 KiB
Plaintext

@page
@model DiwanRazor.Areas.User.Pages.ReportedCommentsModel
@using DNTPersianUtils.Core
@{
Layout = "_UserPanelLayout";
ViewData["Title"] = "حاشیه‌های گزارش شده";
await DiwanRazor.Utils.DiwanSessionChecker.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" />
}