From d39869f6e19252d0c00f2fb418f8806a374896df Mon Sep 17 00:00:00 2001 From: Hamid Reza Mohammadi Date: Fri, 25 Sep 2026 08:58:47 +0330 Subject: [PATCH] geotag couplet selection --- GanjooRazor/Areas/User/Pages/Editor.cshtml | 24 ++++++- GanjooRazor/Areas/User/Pages/Editor.cshtml.cs | 64 ++++++++++++++++++- 2 files changed, 85 insertions(+), 3 deletions(-) diff --git a/GanjooRazor/Areas/User/Pages/Editor.cshtml b/GanjooRazor/Areas/User/Pages/Editor.cshtml index 1ec10155..ca24b7ea 100644 --- a/GanjooRazor/Areas/User/Pages/Editor.cshtml +++ b/GanjooRazor/Areas/User/Pages/Editor.cshtml @@ -120,6 +120,7 @@ // staged client-side until the main save; each item matches // GanjoorPoemGeoDateTagCorrection's shape so it can be sent as-is var geoDateTagSuggestions = @Html.Raw(Model.MyLastEdit != null && Model.MyLastEdit.GeoDateTags != null ? Newtonsoft.Json.JsonConvert.SerializeObject(Model.MyLastEdit.GeoDateTags, new Newtonsoft.Json.JsonSerializerSettings { ContractResolver = new Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver() }) : "[]"); + var geoDateTagCoupletTexts = @Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(Model.Couplets.ToDictionary(c => c.Item1.ToString(), c => c.Item2))); $(document).ready(function () { renderPendingGeoDateTags(); }); @@ -153,12 +154,13 @@ container.innerHTML = ''; return; } - var html = ''; + var html = '
وضعیتمکانسالماهروز#
'; for (var i = 0; i < geoDateTagSuggestions.length; i++) { var s = geoDateTagSuggestions[i]; var status = s.markForDelete ? '🗑️ درخواست حذف' : '➕ پیشنهاد جدید'; + var coupletText = (s.coupletIndex != null && geoDateTagCoupletTexts[s.coupletIndex]) ? geoDateTagCoupletTexts[s.coupletIndex] : '— کل شعر —'; var locationText = s.markForDelete ? '' : (s.locationId ? $('#geotag-location-select option[value="' + s.locationId + '"]').text() : (s.suggestedLocationName || '')); - html += '' + + html += '' + ''; } html += '
وضعیتبیتمکانسالماهروز#
' + status + '' + locationText + '' + (s.lunarYear || '') + '' + (s.lunarMonth || '') + '' + (s.lunarDay || '') + '
' + status + '' + coupletText + '' + locationText + '' + (s.lunarYear || '') + '' + (s.lunarMonth || '') + '' + (s.lunarDay || '') + '✕ حذف از فهرست
'; @@ -184,6 +186,7 @@ // error toast for the case where the user explicitly asked to add an // empty entry vs. silently having nothing to pick up on save). function readGeoDateTagFromForm(showErrorIfEmpty) { + var coupletIndex = $('#geotag-couplet-select').val(); var locationId = $('#geotag-location-select').val(); var newLocationName = $('#geotag-new-location-name').val(); var newLocationLat = $('#geotag-new-location-lat').val(); @@ -204,6 +207,7 @@ return { markForDelete: false, + coupletIndex: (coupletIndex && coupletIndex != '') ? parseInt(coupletIndex) : null, locationId: (locationId && locationId != '') ? parseInt(locationId) : null, suggestedLocationName: (!locationId || locationId == '') ? (newLocationName || null) : null, suggestedLatitude: (!locationId || locationId == '') && newLocationLat ? parseFloat(newLocationLat) : null, @@ -217,6 +221,7 @@ } function resetGeoDateTagForm() { + $('#geotag-couplet-select').val(''); $('#geotag-location-select').val(''); $('#geotag-new-location-name').val(''); $('#geotag-new-location-lat').val(''); @@ -921,6 +926,7 @@ else { +

بیت: @(geoDateTag.CoupletIndex != null ? (Model.Couplets.Where(c => c.Item1 == geoDateTag.CoupletIndex).Select(c => c.Item2).FirstOrDefault() ?? "— کل شعر —") : "— کل شعر —")

@if (geoDateTag.MarkForDelete) {

درخواست حذف برچسب موجود (#@geoDateTag.ExistingTagId)

@@ -1756,6 +1762,7 @@ else { + @@ -1765,6 +1772,7 @@ else @foreach (var tag in Model.PoemGeoDateTags) { +
بیت مکان سال ماه
@(Model.Couplets.Where(c => c.Item1 == tag.CoupletIndex).Select(c => c.Item2).FirstOrDefault() ?? "— کل شعر —") @($"{(tag.Location == null ? "" : tag.Location.Name)}") @tag.LunarYear @@ -1833,6 +1841,18 @@ else
+
+ + +

اگر این برچسب به یک بیت مشخص اشاره دارد، آن را انتخاب کنید تا دیگران بتوانند شاهد آن را در متن پیدا کنند.

+
+