Projects (GanjooRazor -> DivanRazor, GanjoorService.sln -> DivanService.sln), files, folders, classes, namespaces, settings, API routes (/api/divan) and DB tables (Divan*). 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>
133 lines
6.4 KiB
Plaintext
133 lines
6.4 KiB
Plaintext
@page
|
|
@model DivanRazor.Areas.User.Pages.HistoryModel
|
|
@using DNTPersianUtils.Core
|
|
@{
|
|
Layout = "_UserPanelLayout";
|
|
ViewData["Title"] = "ادامهٔ مطالعه";
|
|
await DivanRazor.Utils.DivanSessionChecker.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 deleteHistoryItem(historyItemId) {
|
|
var ok = await upConfirm('آیا از حذف این مورد اطمینان دارید؟');
|
|
if (!ok) return;
|
|
|
|
$.ajax({
|
|
type: "DELETE",
|
|
url: '?handler=HistoryItem',
|
|
data: { id: historyItemId },
|
|
error: function (e) {
|
|
upToast(e.responseText || 'حذف مورد با خطا مواجه شد.', 'error');
|
|
},
|
|
success: function () {
|
|
$('#history-item-' + historyItemId).remove();
|
|
upToast('مورد حذف شد.', 'success');
|
|
},
|
|
});
|
|
}
|
|
|
|
async function switchTracking(start) {
|
|
if (start == false) {
|
|
var ok = await upConfirm('آیا از توقف ذخیرهٔ تاریخچه و حذف تاریخچهٔ بازدیدها اطمینان دارید؟');
|
|
if (!ok) return;
|
|
|
|
document.getElementById('switch-tracking-button').style.visibility = 'hidden';
|
|
document.getElementById('processing').innerHTML = 'در حال پردازش ...';
|
|
|
|
$.ajax({
|
|
type: "POST",
|
|
url: '?handler=StopTracking',
|
|
error: function () {
|
|
upToast('خطا رخ داد.', 'error');
|
|
location.reload();
|
|
},
|
|
success: function () {
|
|
location.reload();
|
|
},
|
|
});
|
|
return;
|
|
}
|
|
|
|
document.getElementById('switch-tracking-button').style.visibility = 'hidden';
|
|
document.getElementById('processing').innerHTML = 'در حال پردازش ...';
|
|
|
|
$.ajax({
|
|
type: "POST",
|
|
url: '?handler=StartTracking',
|
|
error: function () {
|
|
upToast('خطا رخ داد.', 'error');
|
|
location.reload();
|
|
},
|
|
success: function () {
|
|
location.reload();
|
|
},
|
|
});
|
|
}
|
|
</script>
|
|
|
|
<partial name="_Pagination" model="Model.PaginationLinks" />
|
|
|
|
<div class="up-card">
|
|
@if (Model.TrackingIsEnabled)
|
|
{
|
|
<div class="up-alert up-alert--success up-text-center">ذخیرهٔ تاریخچهٔ بازدیدهای شما فعال است.</div>
|
|
<div class="up-form-actions up-text-center" style="justify-content:center;">
|
|
<a role="button" onclick="switchTracking(false)" id="switch-tracking-button" class="up-btn up-btn--danger">توقف ذخیرهٔ تاریخچه</a>
|
|
</div>
|
|
<p id="processing" class="up-text-center"></p>
|
|
<p class="up-hint up-hint--danger up-text-center">تذکر مهم: توقف ذخیرهٔ تاریخچه باعث حذف تاریخچهٔ ذخیرهشده تا به حال میشود.</p>
|
|
}
|
|
else
|
|
{
|
|
<p class="up-text-center">ذخیرهٔ تاریخچهٔ بازدیدهای شما غیرفعال است.</p>
|
|
<div class="up-form-actions up-text-center" style="justify-content:center;">
|
|
<a role="button" onclick="switchTracking(true)" id="switch-tracking-button" class="up-btn up-btn--success">فعالسازی ذخیرهٔ تاریخچه</a>
|
|
</div>
|
|
<p id="processing" class="up-text-center"></p>
|
|
<p class="up-hint up-text-center">تاریخچهٔ بازدیدهای شما فقط به خود شما نمایش داده میشود و از آن استفادهٔ دیگری نمیشود. هر زمان که بخواهید میتوانید ذخیرهٔ تاریخچه را متوقف کنید و تاریخچهٔ بازدیدهایتان را پاک کنید.</p>
|
|
}
|
|
<p class="up-hint up-text-center">نکته: اگر روی دستگاههای متعدد به دیوان وارد شدهاید، توقف ذخیرهٔ تاریخچه روی همهٔ آنها اعمال میشود اما فعالسازی ذخیرهٔ تاریخچه مستلزم آن است که روی هر دستگاه دیگری غیر از دستگاهی که فعالسازی روی آن انجام شده یکبار از این صفحه بازدید کنید یا از حساب کاربری خود در دیوان خارج و مجدداً به آن وارد شوید.</p>
|
|
</div>
|
|
|
|
@if (Model.HistoryItems.Count == 0)
|
|
{
|
|
<partial name="_EmptyState" model="@("هنوز آیتمی در تاریخچهٔ مطالعهٔ شما ثبت نشده است.")" />
|
|
}
|
|
else
|
|
{
|
|
<div class="up-list">
|
|
@foreach (var historyItem in Model.HistoryItems)
|
|
{
|
|
<div class="up-list-item" id="history-item-@historyItem.Id">
|
|
<div class="up-list-item__meta">
|
|
<a href="@historyItem.PoemFullUrl">@historyItem.PoemFullTitle</a> در @historyItem.DateTime.ToFriendlyPersianDateTextify()
|
|
</div>
|
|
<a href="@historyItem.PoemFullUrl">
|
|
<img src="@historyItem.PoetImageUrl" style="width:unset;display:unset;border:unset" alt="@historyItem.PoetName" />
|
|
</a>
|
|
<div id="historyItem-text-@historyItem.Id">
|
|
<p>@historyItem.VerseText</p>
|
|
@if (!string.IsNullOrEmpty(historyItem.Verse2Text))
|
|
{
|
|
<p>@historyItem.Verse2Text</p>
|
|
}
|
|
</div>
|
|
<div class="up-list-item__actions">
|
|
<a role="button" onclick="deleteHistoryItem('@historyItem.Id')" class="up-icon-btn" title="حذف" aria-label="حذف این مورد"><i class="noindent-info-button delete-icon"></i></a>
|
|
</div>
|
|
</div>
|
|
}
|
|
</div>
|
|
}
|
|
|
|
<partial name="_Pagination" model="Model.PaginationLinks" />
|
|
}
|