divan/DivanRazor/Pages/Partials/DivanPage/_CommentPartial.cshtml
Anas Rashid 4fd832dbcb Urdu public pages (#2); hide unconfigured semantic search; safe defaults
- translate reading-path views (poet, category, poem, search, header, login, partials)
  from Persian to Urdu (exact-run dictionary, 262 strings; AI-summary data marker kept)
- semantic search widget only when SemanticSearchAPIRoot is configured
- appsettings defaults: no Ganjoor tracking script, no Ganjoor semantic search,
  API/site roots default to the local Divan stack instead of api.ganjoor.net

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 00:18:00 +02:00

73 lines
4.3 KiB
Plaintext

@model DivanRazor.Pages._CommentPartialModel
@using DNTPersianUtils.Core
@{
Layout = null;
}
@if (Model.Comment == null)
{
<div class="item" id="comment-error" data-sanitizer-remaining-text="@Model.SanitizerRemainingText">
<p style="color:red">غلطی</p>
@Model.Error
</div>
}
else
{
<div class="divan-comment" id="comment-@Model.Comment.Id@Model.DivSuffix">
@if (!string.IsNullOrEmpty(Model.Comment.PublishStatus))
{
<div class="red-color">@Model.Comment.PublishStatus</div>
}
@if (Model.Comment.UserId != null)
{
<div class="comment-author"><a href="/hashieha/?userid=@Model.Comment.UserId">@(string.IsNullOrEmpty(Model.Comment.AuthorName) ? "#" : Model.Comment.AuthorName)</a> <small>میں @Html.Raw($"{Model.Comment.CommentDate.ToFriendlyPersianDateTextify()}")</small> @Model.Wrote:</div>
}
else
{
<div class="comment-author">@(string.IsNullOrEmpty(Model.Comment.AuthorName) ? "نامعلوم" : Model.Comment.AuthorName) <small>میں @Html.Raw($"{Model.Comment.CommentDate.ToFriendlyPersianDateTextify()}")</small> @Model.Wrote:</div>
}
@if (Model.Comment.CoupletIndex != -1)
{
<div class="commentquote">بارے میں <a href="@($"#bn{Model.Comment.CoupletIndex + 1}")">@Model.Comment.CoupletSummary</a></div>
}
<blockquote id="comment-text-@Model.Comment.Id@Model.DivSuffix" class="comment-body">
@Html.Raw(Model.Comment.HtmlComment)
</blockquote>
<p class="comment-actions">
@if (Model.Comment.MyComment)
{
<a role="button" title="حاشیہ حذف کریں" onclick="deleteMyComment(@Model.Comment.Id, '@Model.Comment.CoupletIndex')"><i class="notranslate pageicons">delete</i></a>
<a role="button" title="حاشیے میں ترمیم" onclick="editMyComment(@Model.Comment.Id, '@Model.Comment.CoupletIndex')"><i class="notranslate pageicons">edit</i></a>
}
<a role="button" title="اس حاشیے کا جواب دیں" onclick="replyComment(@Model.Comment.Id, @(Model.LoggedIn ? "true" : "false"), '@Model.DivSuffix')"><i class="notranslate pageicons">reply</i></a>
@if (!Model.Comment.MyComment)
{
<a role="button" title="پسند" id="like-btn-@Model.Comment.Id@Model.DivSuffix" class="cursor-pointer@(Model.Comment.CurrentUserRatingValue == 1 ? " green-color" : "")" onclick="rateComment(@Model.Comment.Id, 1, @(Model.LoggedIn ? "true" : "false"), '@Model.DivSuffix')"><i class="notranslate pageicons">thumb_up</i></a>
}
<small id="like-count-@Model.Comment.Id@Model.DivSuffix">@Model.Comment.LikeCount.ToPersianNumbers()</small>
@if (!Model.Comment.MyComment)
{
<a role="button" title="ناپسند" id="dislike-btn-@Model.Comment.Id@Model.DivSuffix" class="cursor-pointer@(Model.Comment.CurrentUserRatingValue == -1 ? " red-color" : "")" onclick="rateComment(@Model.Comment.Id, -1, @(Model.LoggedIn ? "true" : "false"), '@Model.DivSuffix')"><i class="notranslate pageicons">thumb_down</i></a>
}
<small id="dislike-count-@Model.Comment.Id@Model.DivSuffix">@Model.Comment.DislikeCount.ToPersianNumbers()</small>
<a href="/ReportComment/?CommentId=@Model.Comment.Id" title="نامناسب حاشیے کی اطلاع دیں" onclick="wpopen(this.href); return false"><i class="notranslate pageicons">flag</i></a>
<a role="button" onclick="copyCommentUrl(@Model.Comment.Id)"><i class="notranslate pageicons">link</i></a>
@if (Model.LoggedIn)
{
<a role="button" id="bookmark-comment-@Model.Comment.Id@Model.DivSuffix" class="cursor-pointer" onclick="switchBookmark(@Model.PoemId, -@Model.Comment.Id, '@Model.DivSuffix')"><i class="notranslate pageicons" id="bookmark-icon-comment-@Model.Comment.Id@Model.DivSuffix">@(@Model.Comment.IsBookmarked ? "star" : "star_border")</i></a>
}
</p>
<div class='spacer'>&nbsp;</div>
@foreach (var reply in Model.Comment.Replies ?? Array.Empty<RMuseum.Models.Divan.ViewModels.DivanCommentSummaryViewModel>())
{
<partial name="_CommentPartial.cshtml" model=Model.GetCommentModel(reply) />
}
</div>
}