From 872a8aab61503b73c32fa195961da1e8539ba453 Mon Sep 17 00:00:00 2001 From: Hamid Reza Mohammadi Date: Fri, 2 Oct 2026 09:12:19 +0330 Subject: [PATCH] people tags #387 --- GanjooRazor/Pages/FamilyTree.cshtml | 82 ------------------- GanjooRazor/Pages/FamilyTreeWindow.cshtml | 53 ++++++++++++ ...e.cshtml.cs => FamilyTreeWindow.cshtml.cs} | 23 +++--- GanjooRazor/Pages/PeopleExplorer.cshtml | 2 +- GanjooRazor/Pages/PersonWindow.cshtml | 2 +- GanjooRazor/Pages/Shared/_AdminLayout.cshtml | 7 +- GanjooRazor/Pages/Shared/_Layout.cshtml | 8 +- .../Pages/Shared/_UserPanelLayout.cshtml | 7 +- GanjooRazor/wwwroot/js/familytree.js | 9 +- GanjooRazor/wwwroot/js/personwindow.js | 43 +++++++--- 10 files changed, 116 insertions(+), 120 deletions(-) delete mode 100644 GanjooRazor/Pages/FamilyTree.cshtml create mode 100644 GanjooRazor/Pages/FamilyTreeWindow.cshtml rename GanjooRazor/Pages/{FamilyTree.cshtml.cs => FamilyTreeWindow.cshtml.cs} (69%) diff --git a/GanjooRazor/Pages/FamilyTree.cshtml b/GanjooRazor/Pages/FamilyTree.cshtml deleted file mode 100644 index b1d1c58f..00000000 --- a/GanjooRazor/Pages/FamilyTree.cshtml +++ /dev/null @@ -1,82 +0,0 @@ -@page "{id:int}" -@model GanjooRazor.Pages.FamilyTreeModel -@{ - Layout = "_Layout"; -} -@section Head { - -} -@if (!string.IsNullOrEmpty(Model.LastError)) -{ - @Model.LastError -} -else -{ - - -
- -
- - - -
 
- -
-

- تبارنامهٔ @(string.IsNullOrEmpty(Model.RootPerson.FamilyTreeCaption) ? Model.RootPerson.Name : Model.RootPerson.FamilyTreeCaption) - مشاهدهٔ اطلاعات این شخصیت -

-

- برای مشاهدهٔ توضیحات هر شخصیت، روی آن کلیک کنید. برای پیمایش نمودار آن را با ماوس بکشید و با غلتک ماوس بزرگ/کوچک کنید. - این نمودار محدود به فرزندان این شخصیت نیست؛ تمام خویشاوندان به‌هم‌پیوسته (از جمله نیاکان و خانوادهٔ همسر) را نشان می‌دهد. -

- -
- - -
-
- -
 
- -
- - - -
- - - - - - - - @if (ViewData["TrackingScript"] != null && !string.IsNullOrEmpty(ViewData["TrackingScript"].ToString())) - { - @Html.Raw(ViewData["TrackingScript"]) - } -} diff --git a/GanjooRazor/Pages/FamilyTreeWindow.cshtml b/GanjooRazor/Pages/FamilyTreeWindow.cshtml new file mode 100644 index 00000000..c20e043a --- /dev/null +++ b/GanjooRazor/Pages/FamilyTreeWindow.cshtml @@ -0,0 +1,53 @@ +@page "{id:int}" +@model GanjooRazor.Pages.FamilyTreeWindowModel +@{ + Layout = null; +} +@if (!string.IsNullOrEmpty(Model.LastError)) +{ +

@Model.LastError

+} +else +{ +
+

+ تبارنامهٔ @(string.IsNullOrEmpty(Model.RootPerson.FamilyTreeCaption) ? Model.RootPerson.Name : Model.RootPerson.FamilyTreeCaption) + مشاهدهٔ اطلاعات این شخصیت +

+

+ برای مشاهدهٔ توضیحات هر شخصیت، روی آن کلیک کنید. برای پیمایش نمودار آن را با ماوس بکشید و با غلتک ماوس بزرگ/کوچک کنید. + این نمودار محدود به فرزندان این شخصیت نیست؛ تمام خویشاوندان به‌هم‌پیوسته (از جمله نیاکان و خانوادهٔ همسر) را نشان می‌دهد. +

+ +
+ + +
+ + + + @* not an executable script - just a data holder, parsed and rendered explicitly by + FamilyTreeWindow.open()'s onReady callback in personwindow.js once this fragment has + been injected into the modal body (innerHTML never executes a + +
+} diff --git a/GanjooRazor/Pages/FamilyTree.cshtml.cs b/GanjooRazor/Pages/FamilyTreeWindow.cshtml.cs similarity index 69% rename from GanjooRazor/Pages/FamilyTree.cshtml.cs rename to GanjooRazor/Pages/FamilyTreeWindow.cshtml.cs index c2dd95f5..c6b395b5 100644 --- a/GanjooRazor/Pages/FamilyTree.cshtml.cs +++ b/GanjooRazor/Pages/FamilyTreeWindow.cshtml.cs @@ -9,14 +9,16 @@ using RMuseum.Models.Ganjoor.ViewModels; namespace GanjooRazor.Pages { /// - /// interactive family-tree chart, drawn client-side (vanilla JS/SVG - see the <script> block - /// in FamilyTree.cshtml) from the connected kinship component GET api/people/{id}/familytree - /// returns. Public/read-only counterpart of the PersonWindow.open() modal's plain relatives - /// list, reachable from there and from the PeopleExplorer.open() modal's family-tree index. + /// interactive family-tree chart, drawn client-side (vanilla JS/SVG - see familytree.js) from + /// the connected kinship component GET api/people/{id}/familytree returns. Inline-modal + /// counterpart of the old standalone FamilyTree.cshtml page (now removed) - fetched as a + /// fragment (Layout = null, no site chrome) and opened over whatever page the user is already + /// on via FamilyTreeWindow.open(id) in personwindow.js, the same pattern PersonWindow.cshtml/ + /// PeopleExplorer.cshtml use. /// - public class FamilyTreeModel : LoginPartialEnabledPageModel + public class FamilyTreeWindowModel : LoginPartialEnabledPageModel { - public FamilyTreeModel(HttpClient httpClient, IConfiguration configuration) : base(httpClient, configuration) + public FamilyTreeWindowModel(HttpClient httpClient, IConfiguration configuration) : base(httpClient, configuration) { } @@ -27,9 +29,10 @@ namespace GanjooRazor.Pages public GanjoorFamilyTreeViewModel Tree { get; set; } /// - /// Tree, re-serialized with an explicit camelCase contract (same convention ReviewEdits.cshtml.cs - /// uses for AllLocationsJson/AllPeopleJson) so the client-side layout script has a predictable - /// shape to parse, regardless of the API's own default casing + /// Tree, re-serialized with an explicit camelCase contract (same convention + /// _PersonGraphPartial.cshtml.cs's GraphDataJson uses) so familytree.js has a predictable + /// shape to parse once this fragment's data block is read, regardless of the API's own + /// default casing /// public string TreeDataJson => JsonConvert.SerializeObject( @@ -54,8 +57,6 @@ namespace GanjooRazor.Pages return Page(); } - ViewData["Title"] = $"گنجور » تبارنامهٔ {(string.IsNullOrEmpty(RootPerson.FamilyTreeCaption) ? RootPerson.Name : RootPerson.FamilyTreeCaption)}"; - var treeResponse = await _httpClient.GetAsync($"{APIRoot.Url}/api/people/{id}/familytree"); if (!treeResponse.IsSuccessStatusCode) { diff --git a/GanjooRazor/Pages/PeopleExplorer.cshtml b/GanjooRazor/Pages/PeopleExplorer.cshtml index 8a614ecc..81fa91a1 100644 --- a/GanjooRazor/Pages/PeopleExplorer.cshtml +++ b/GanjooRazor/Pages/PeopleExplorer.cshtml @@ -21,7 +21,7 @@ else
  • @root.FamilyTreeCaption (@root.Name) - — نمایش نمودار + — نمایش نمودار
  • } diff --git a/GanjooRazor/Pages/PersonWindow.cshtml b/GanjooRazor/Pages/PersonWindow.cshtml index 631f5512..2ffcbdec 100644 --- a/GanjooRazor/Pages/PersonWindow.cshtml +++ b/GanjooRazor/Pages/PersonWindow.cshtml @@ -52,7 +52,7 @@ else {

    خویشاوندان - نمایش نمودار تبارنامه + نمایش نمودار تبارنامه @if (Model.LoggedIn) { افزودن خویشاوند جدید diff --git a/GanjooRazor/Pages/Shared/_AdminLayout.cshtml b/GanjooRazor/Pages/Shared/_AdminLayout.cshtml index db96e82c..7bf6e5a4 100644 --- a/GanjooRazor/Pages/Shared/_AdminLayout.cshtml +++ b/GanjooRazor/Pages/Shared/_AdminLayout.cshtml @@ -39,10 +39,11 @@ - @* person profile / people-explorer inline modal - see _Layout.cshtml for the same include on - the public site; needed here too since ReviewPersonEdits/ReviewPersonRelationEdits link to - a person's profile *@ + @* person profile / people-explorer / family-tree inline modals - see _Layout.cshtml for the + same includes on the public site; needed here too since ReviewPersonEdits/ + ReviewPersonRelationEdits link to a person's profile *@ + - @* person profile / people-explorer inline modal - global since a person's name can turn up - almost anywhere (poem pages, family tree, suggestion forms); peoplegraph.js is the shared - force-directed renderer both PeopleExplorer.open() and the category-scoped "شخصیت‌ها" tab use *@ + @* person profile / people-explorer / family-tree inline modals - global since a person's + name can turn up almost anywhere (poem pages, family tree, suggestion forms); peoplegraph.js + and familytree.js are the shared renderers PeopleExplorer.open()/FamilyTreeWindow.open() and + the category-scoped "شخصیت‌ها" tab use *@ + - + +