divan/GanjooRazor/Areas/User/Pages/AllPoemSections.cshtml
2026-08-07 08:37:28 +03:30

103 lines
4.1 KiB
Plaintext

@page
@model GanjooRazor.Areas.User.Pages.AllPoemSectionsModel
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@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 (!string.IsNullOrEmpty(Model.FatalError))
{
<div class="up-alert up-alert--danger">@Html.Raw(Model.FatalError)</div>
}
else
{
<script>
async function rebuildRelatedSections(sectionId, meterId, rhyming) {
var ok = await upConfirm(String(meterId) + ' : ' + rhyming);
if (!ok) return;
$('#rebuild-related-' + String(sectionId)).hide();
var url = '?handler=RebuildRelatedSections';
$.ajax({
type: "POST",
url: url,
data: {
meterId: meterId,
rhyming: rhyming
},
success: function() {
upToast('شروع شد.');
},
error: function(e) {
upToast(e.responseText || String(e), 'error');
$('#rebuild-related-' + String(sectionId)).show();
}
});
}
</script>
@if (Model.PoemSections != null && Model.PoemSections.Length > 0)
{
@foreach (var poemSection in Model.PoemSections)
{
<div class="up-card">
@if (poemSection.SectionType == RMuseum.Models.Ganjoor.PoemSectionType.WholePoem)
{
<h2 class="up-card__title">
<a href="/User/Section?poemId=@poemSection.PoemId&index=@poemSection.Index" role="button" class="up-btn up-btn--sm up-btn--ghost">
قطعهٔ @(poemSection.Number.ToPersianNumbers()):
</a>
</h2>
}
<p>@Html.Raw(poemSection.HtmlText)</p>
<div class="up-field-row">
<div class="up-field">
<label>نوع</label>
<p class="up-field-static">@poemSection.SectionType</p>
</div>
<div class="up-field">
<label>Verse Type</label>
<p class="up-field-static">@poemSection.VerseType</p>
</div>
<div class="up-field">
<label>Index</label>
<p class="up-field-static">@poemSection.Index</p>
</div>
<div class="up-field">
<label>Number</label>
<p class="up-field-static">@poemSection.Number</p>
</div>
</div>
<div class="up-field-row">
<div class="up-field">
<label><span class="up-field-icon" aria-hidden="true">🎵</span> وزن</label>
<p class="up-field-static">@(poemSection.GanjoorMetre == null ? "تعیین نشده" : poemSection.GanjoorMetre.Rhythm)</p>
</div>
<div class="up-field">
<label><span class="up-field-icon" aria-hidden="true">🔤</span> حروف قافیه</label>
<p class="up-field-static">@poemSection.RhymeLetters</p>
</div>
</div>
@if (poemSection.GanjoorMetre != null && !string.IsNullOrEmpty(poemSection.RhymeLetters) && Model.CanEdit)
{
<a role="button" id="rebuild-related-@poemSection.Id" class="up-btn up-btn--danger up-btn--block" onclick="rebuildRelatedSections(@poemSection.Id, @poemSection.GanjoorMetreId, '@poemSection.RhymeLetters')">🔁 بازسازی مرتبط‌ها</a>
}
</div>
}
}
else
{
<partial name="_EmptyState" model="@("قطعه‌ای برای این شعر یافت نشد.")" />
}
}