From f305394ad758675956fd95074a3654d453f6ca1c Mon Sep 17 00:00:00 2001 From: Hamid Reza Mohammadi Date: Wed, 30 Sep 2026 18:17:44 +0330 Subject: [PATCH] people tags #387 --- .../Admin/Pages/ReviewPersonEdits.cshtml | 2 +- .../Pages/ReviewPersonRelationEdits.cshtml | 8 +- GanjooRazor/Pages/FamilyTree.cshtml | 2 +- GanjooRazor/Pages/FamilyTree.cshtml.cs | 4 +- GanjooRazor/Pages/GanjoorPage.cshtml | 8 - .../PageTypes/_PoemPagePartial.cshtml | 2 +- .../GanjoorPage/_PersonGraphPartial.cshtml | 2 +- .../GanjoorPage/_PersonGraphPartial.cshtml.cs | 8 +- GanjooRazor/Pages/People.cshtml | 61 ------- GanjooRazor/Pages/People.cshtml.cs | 44 ----- GanjooRazor/Pages/PeopleExplorer.cshtml | 78 +++++++++ GanjooRazor/Pages/PeopleExplorer.cshtml.cs | 68 ++++++++ GanjooRazor/Pages/PeopleGraph.cshtml | 106 ------------ GanjooRazor/Pages/PeopleGraph.cshtml.cs | 54 ------ GanjooRazor/Pages/Person.cshtml | 162 ------------------ GanjooRazor/Pages/PersonWindow.cshtml | 121 +++++++++++++ ...erson.cshtml.cs => PersonWindow.cshtml.cs} | 17 +- GanjooRazor/Pages/Shared/_AdminLayout.cshtml | 5 + GanjooRazor/Pages/Shared/_Layout.cshtml | 5 + .../Pages/SuggestNewPersonRelation.cshtml | 4 +- .../Pages/SuggestNewPersonRelation.cshtml.cs | 2 +- GanjooRazor/Pages/SuggestPersonEdit.cshtml | 6 +- GanjooRazor/Pages/SuggestPersonEdit.cshtml.cs | 4 +- .../Pages/SuggestPersonRelationEdit.cshtml | 6 +- .../Pages/SuggestPersonRelationEdit.cshtml.cs | 4 +- GanjooRazor/wwwroot/js/bk.js | 2 +- GanjooRazor/wwwroot/js/familytree.js | 2 +- GanjooRazor/wwwroot/js/peoplegraph.js | 34 +++- GanjooRazor/wwwroot/js/personwindow.js | 122 +++++++++++++ .../GanjoorRelatedPersonController.cs | 3 +- .../ViewModels/GanjoorPersonGraphViewModel.cs | 3 +- RMuseum/RMuseum.xml | 9 +- .../Services/IGanjoorRelatedPersonService.cs | 3 +- 33 files changed, 475 insertions(+), 486 deletions(-) delete mode 100644 GanjooRazor/Pages/People.cshtml delete mode 100644 GanjooRazor/Pages/People.cshtml.cs create mode 100644 GanjooRazor/Pages/PeopleExplorer.cshtml create mode 100644 GanjooRazor/Pages/PeopleExplorer.cshtml.cs delete mode 100644 GanjooRazor/Pages/PeopleGraph.cshtml delete mode 100644 GanjooRazor/Pages/PeopleGraph.cshtml.cs delete mode 100644 GanjooRazor/Pages/Person.cshtml create mode 100644 GanjooRazor/Pages/PersonWindow.cshtml rename GanjooRazor/Pages/{Person.cshtml.cs => PersonWindow.cshtml.cs} (90%) create mode 100644 GanjooRazor/wwwroot/js/personwindow.js diff --git a/GanjooRazor/Areas/Admin/Pages/ReviewPersonEdits.cshtml b/GanjooRazor/Areas/Admin/Pages/ReviewPersonEdits.cshtml index 55b2c99b..df7b3f58 100644 --- a/GanjooRazor/Areas/Admin/Pages/ReviewPersonEdits.cshtml +++ b/GanjooRazor/Areas/Admin/Pages/ReviewPersonEdits.cshtml @@ -25,7 +25,7 @@ else var p = s.Person;

- @p.Name + @p.Name

diff --git a/GanjooRazor/Areas/Admin/Pages/ReviewPersonRelationEdits.cshtml b/GanjooRazor/Areas/Admin/Pages/ReviewPersonRelationEdits.cshtml index 74ec901f..37c48e6f 100644 --- a/GanjooRazor/Areas/Admin/Pages/ReviewPersonRelationEdits.cshtml +++ b/GanjooRazor/Areas/Admin/Pages/ReviewPersonRelationEdits.cshtml @@ -90,24 +90,24 @@ else @if (s.Action == PersonRelationSuggestionAction.Modify) { } @if (s.Action == PersonRelationSuggestionAction.Modify) { } diff --git a/GanjooRazor/Pages/FamilyTree.cshtml b/GanjooRazor/Pages/FamilyTree.cshtml index 222306ac..8b8240e7 100644 --- a/GanjooRazor/Pages/FamilyTree.cshtml +++ b/GanjooRazor/Pages/FamilyTree.cshtml @@ -25,7 +25,7 @@ else

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

برای مشاهدهٔ توضیحات هر شخصیت، روی آن کلیک کنید. برای پیمایش نمودار آن را با ماوس بکشید و با غلتک ماوس بزرگ/کوچک کنید. diff --git a/GanjooRazor/Pages/FamilyTree.cshtml.cs b/GanjooRazor/Pages/FamilyTree.cshtml.cs index 1a884ed0..d64b5de5 100644 --- a/GanjooRazor/Pages/FamilyTree.cshtml.cs +++ b/GanjooRazor/Pages/FamilyTree.cshtml.cs @@ -11,8 +11,8 @@ 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 Person.cshtml's plain relatives list, reachable from - /// there and from People.cshtml's family-tree index. + /// 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. /// public class FamilyTreeModel : LoginPartialEnabledPageModel { diff --git a/GanjooRazor/Pages/GanjoorPage.cshtml b/GanjooRazor/Pages/GanjoorPage.cshtml index 36fa309b..70f52bfe 100644 --- a/GanjooRazor/Pages/GanjoorPage.cshtml +++ b/GanjooRazor/Pages/GanjoorPage.cshtml @@ -86,14 +86,6 @@ } } - - @if (Model.IsCatPage || Model.IsPoetPage) - { - @* the on-demand "شخصیت‌ها" tab (_CatPagePartial.cshtml / _PoetPagePartial.cshtml) can be - clicked at any time on any cat/poet page, so this is loaded unconditionally here (unlike - the leaflet.js block above, which only loads when geo tags are already known to exist) *@ - - } } @if (Model.OfflineMode) diff --git a/GanjooRazor/Pages/Partials/GanjoorPage/PageTypes/_PoemPagePartial.cshtml b/GanjooRazor/Pages/Partials/GanjoorPage/PageTypes/_PoemPagePartial.cshtml index 177a6597..65204bc4 100644 --- a/GanjooRazor/Pages/Partials/GanjoorPage/PageTypes/_PoemPagePartial.cshtml +++ b/GanjooRazor/Pages/Partials/GanjoorPage/PageTypes/_PoemPagePartial.cshtml @@ -460,7 +460,7 @@

@foreach (var taggedPerson in poemTaggedPersons) { - @taggedPerson.Name + @taggedPerson.Name }

diff --git a/GanjooRazor/Pages/Partials/GanjoorPage/_PersonGraphPartial.cshtml b/GanjooRazor/Pages/Partials/GanjoorPage/_PersonGraphPartial.cshtml index 127b0da3..af5c667e 100644 --- a/GanjooRazor/Pages/Partials/GanjoorPage/_PersonGraphPartial.cshtml +++ b/GanjooRazor/Pages/Partials/GanjoorPage/_PersonGraphPartial.cshtml @@ -19,7 +19,7 @@ else
نمایش همه - نمایش شبکهٔ کامل شخصیت‌ها + نمایش شبکهٔ کامل شخصیت‌ها
diff --git a/GanjooRazor/Pages/Partials/GanjoorPage/_PersonGraphPartial.cshtml.cs b/GanjooRazor/Pages/Partials/GanjoorPage/_PersonGraphPartial.cshtml.cs index 38fa61f8..fce785c1 100644 --- a/GanjooRazor/Pages/Partials/GanjoorPage/_PersonGraphPartial.cshtml.cs +++ b/GanjooRazor/Pages/Partials/GanjoorPage/_PersonGraphPartial.cshtml.cs @@ -7,10 +7,10 @@ namespace GanjooRazor.Pages { /// /// model for the on-demand "شخصیت‌ها" (characters) tab shown on a poet/category page - renders - /// the same force-directed graph as PeopleGraph.cshtml/peoplegraph.js, but scoped to one - /// work/category (see GanjoorRelatedPersonService.GetCatPersonGraphAsync) instead of the whole - /// site. Element ids are prefixed "pg-cat-" so this partial can sit on the same page as (and not - /// collide with) any other graph instance. + /// the same force-directed graph as the PeopleExplorer.open() modal/peoplegraph.js, but scoped + /// to one work/category (see GanjoorRelatedPersonService.GetCatPersonGraphAsync) instead of the + /// whole site. Element ids are prefixed "pg-cat-" so this partial can sit on the same page as + /// (and not collide with) any other graph instance. /// public class _PersonGraphPartialModel : PageModel { diff --git a/GanjooRazor/Pages/People.cshtml b/GanjooRazor/Pages/People.cshtml deleted file mode 100644 index 2f0256de..00000000 --- a/GanjooRazor/Pages/People.cshtml +++ /dev/null @@ -1,61 +0,0 @@ -@page -@model GanjooRazor.Pages.PeopleModel -@{ - Layout = "_Layout"; -} -@section Head { - -} -@if (!string.IsNullOrEmpty(Model.LastError)) -{ - @Model.LastError -} -else -{ - - -
- -
- - - -
 
- -
-

- شجره‌نامه‌ها - نمایش شبکهٔ روابط همهٔ شخصیت‌ها -

- @if (Model.FamilyTreeRoots == null || Model.FamilyTreeRoots.Count == 0) - { -

هنوز شجره‌نامه‌ای ثبت نشده است.

- } - else - { - - } -
- -
 
- -
- - - -
- - @if (ViewData["TrackingScript"] != null && !string.IsNullOrEmpty(ViewData["TrackingScript"].ToString())) - { - @Html.Raw(ViewData["TrackingScript"]) - } -} diff --git a/GanjooRazor/Pages/People.cshtml.cs b/GanjooRazor/Pages/People.cshtml.cs deleted file mode 100644 index 08a23c5d..00000000 --- a/GanjooRazor/Pages/People.cshtml.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System.Collections.Generic; -using System.Net.Http; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.Configuration; -using Newtonsoft.Json; -using RMuseum.Models.Ganjoor; - -namespace GanjooRazor.Pages -{ - /// - /// entry point for browsing family trees - lists every person that captions a tree - /// (GanjoorRelatedPerson.FamilyTreeCaption not empty), grouped under that caption. A person - /// with no caption of their own still shows up via their relatives on that person's own page - /// (see Person.cshtml) - this index is only for jumping straight to a named tree's root(s). - /// - public class PeopleModel : LoginPartialEnabledPageModel - { - public PeopleModel(HttpClient httpClient, IConfiguration configuration) : base(httpClient, configuration) - { - } - - public string LastError { get; set; } - - public List FamilyTreeRoots { get; set; } - - public async Task OnGetAsync() - { - InitializeCommonPageState(); - - ViewData["Title"] = "گنجور » شجره‌نامه‌ها"; - - var response = await _httpClient.GetAsync($"{APIRoot.Url}/api/people/familytrees"); - if (!response.IsSuccessStatusCode) - { - LastError = await ReadErrorMessageAsync(response); - return Page(); - } - FamilyTreeRoots = JsonConvert.DeserializeObject>(await response.Content.ReadAsStringAsync()); - - return Page(); - } - } -} diff --git a/GanjooRazor/Pages/PeopleExplorer.cshtml b/GanjooRazor/Pages/PeopleExplorer.cshtml new file mode 100644 index 00000000..ebe4ce83 --- /dev/null +++ b/GanjooRazor/Pages/PeopleExplorer.cshtml @@ -0,0 +1,78 @@ +@page +@model GanjooRazor.Pages.PeopleExplorerModel +@{ + Layout = null; +} +@if (!string.IsNullOrEmpty(Model.LastError)) +{ +

@Model.LastError

+} +else +{ +
+

کاوش در شخصیت‌ها

+ + @if (Model.FamilyTreeRoots != null && Model.FamilyTreeRoots.Count > 0) + { +

شجره‌نامه‌ها

+ + } + +

شبکهٔ روابط همهٔ شخصیت‌ها

+

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

+ + + +
+ +
+ +
+ +
 
+ +
+
طرف اول - @(s.Person1 != null ? s.Person1.Name : s.Person1Id.ToString()) + @(s.Person1 != null ? s.Person1.Name : s.Person1Id.ToString()) - @(s.Person1 != null ? s.Person1.Name : s.Person1Id.ToString()) + @(s.Person1 != null ? s.Person1.Name : s.Person1Id.ToString())
طرف دوم - @(s.Person2 != null ? s.Person2.Name : s.Person2Id.ToString()) + @(s.Person2 != null ? s.Person2.Name : s.Person2Id.ToString()) - @(s.Person2 != null ? s.Person2.Name : s.Person2Id.ToString()) + @(s.Person2 != null ? s.Person2.Name : s.Person2Id.ToString())
+ + + + + + + + + +
شخص اولنوع ارتباطشخص دومیادداشت
+ + + + + @* not an executable script - just a data holder, parsed and rendered explicitly by + PeopleExplorer.open()'s onReady callback in personwindow.js once this fragment has been + injected into the modal body *@ + + +} diff --git a/GanjooRazor/Pages/PeopleExplorer.cshtml.cs b/GanjooRazor/Pages/PeopleExplorer.cshtml.cs new file mode 100644 index 00000000..92d17173 --- /dev/null +++ b/GanjooRazor/Pages/PeopleExplorer.cshtml.cs @@ -0,0 +1,68 @@ +using System.Collections.Generic; +using System.Net.Http; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Configuration; +using Newtonsoft.Json; +using Newtonsoft.Json.Serialization; +using RMuseum.Models.Ganjoor; +using RMuseum.Models.Ganjoor.ViewModels; + +namespace GanjooRazor.Pages +{ + /// + /// the "explore all characters" modal - the whole-site force-directed relationship graph + /// (formerly the standalone page PeopleGraph.cshtml) plus the family-tree-roots index + /// (formerly the standalone page People.cshtml), merged into one bare fragment (Layout = null) + /// and opened via PeopleExplorer.open() in personwindow.js. Neither of those two pages had an + /// entry point in the site's own navigation, so folding them together here loses nothing - + /// it's reachable from inside PersonWindow and from the category-scoped "شخصیت‌ها" tab's + /// "نمایش شبکهٔ کامل شخصیت‌ها" link. + /// + public class PeopleExplorerModel : LoginPartialEnabledPageModel + { + public PeopleExplorerModel(HttpClient httpClient, IConfiguration configuration) : base(httpClient, configuration) + { + } + + public string LastError { get; set; } + + public List FamilyTreeRoots { get; set; } + + public GanjoorPersonGraphViewModel Graph { get; set; } + + /// + /// Graph, re-serialized with an explicit camelCase contract (same convention + /// PeopleGraphModel/_PersonGraphPartialModel used) so peoplegraph.js has a predictable + /// shape to parse + /// + public string GraphDataJson => + JsonConvert.SerializeObject( + Graph, + new JsonSerializerSettings { ContractResolver = new CamelCasePropertyNamesContractResolver() } + ); + + public async Task OnGetAsync() + { + InitializeCommonPageState(); + + var treesResponse = await _httpClient.GetAsync($"{APIRoot.Url}/api/people/familytrees"); + if (!treesResponse.IsSuccessStatusCode) + { + LastError = await ReadErrorMessageAsync(treesResponse); + return Page(); + } + FamilyTreeRoots = JsonConvert.DeserializeObject>(await treesResponse.Content.ReadAsStringAsync()); + + var graphResponse = await _httpClient.GetAsync($"{APIRoot.Url}/api/people/graph"); + if (!graphResponse.IsSuccessStatusCode) + { + LastError = await ReadErrorMessageAsync(graphResponse); + return Page(); + } + Graph = JsonConvert.DeserializeObject(await graphResponse.Content.ReadAsStringAsync()); + + return Page(); + } + } +} diff --git a/GanjooRazor/Pages/PeopleGraph.cshtml b/GanjooRazor/Pages/PeopleGraph.cshtml deleted file mode 100644 index 45cee28c..00000000 --- a/GanjooRazor/Pages/PeopleGraph.cshtml +++ /dev/null @@ -1,106 +0,0 @@ -@page -@model GanjooRazor.Pages.PeopleGraphModel -@{ - Layout = "_Layout"; -} -@section Head { - -} -@if (!string.IsNullOrEmpty(Model.LastError)) -{ - @Model.LastError -} -else -{ - - -
- -
- - - -
 
- -
-

- شبکهٔ روابط شخصیت‌ها - فهرست شجره‌نامه‌ها -

-

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

- - - -
- -
- -
- -
 
- -

فهرست ارتباط‌ها

-
- - - - - - - - - - -
شخص اولنوع ارتباطشخص دومیادداشت
-
-
- -
 
- -
- - - -
- - - - - - - - @if (ViewData["TrackingScript"] != null && !string.IsNullOrEmpty(ViewData["TrackingScript"].ToString())) - { - @Html.Raw(ViewData["TrackingScript"]) - } -} diff --git a/GanjooRazor/Pages/PeopleGraph.cshtml.cs b/GanjooRazor/Pages/PeopleGraph.cshtml.cs deleted file mode 100644 index 15869386..00000000 --- a/GanjooRazor/Pages/PeopleGraph.cshtml.cs +++ /dev/null @@ -1,54 +0,0 @@ -using System.Net.Http; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.Configuration; -using Newtonsoft.Json; -using RMuseum.Models.Ganjoor.ViewModels; - -namespace GanjooRazor.Pages -{ - /// - /// force-directed "ontology" explorer over the whole known people network (kinship edges and - /// non-family ties together), drawn client-side (vanilla JS/SVG - see the <script> block in - /// PeopleGraph.cshtml) from what GET api/people/graph returns. The nowruzgan-style counterpart of - /// the strict-tree /FamilyTree/{id} view: not limited to one family, shows every recorded - /// relationship at once with a synced data table and click-to-focus ego network. - /// - public class PeopleGraphModel : LoginPartialEnabledPageModel - { - public PeopleGraphModel(HttpClient httpClient, IConfiguration configuration) : base(httpClient, configuration) - { - } - - public string LastError { get; set; } - - public GanjoorPersonGraphViewModel Graph { get; set; } - - /// - /// Graph, re-serialized with an explicit camelCase contract (same convention FamilyTree.cshtml.cs - /// uses for TreeDataJson) so the client-side layout script has a predictable shape to parse - /// - public string GraphDataJson => - JsonConvert.SerializeObject( - Graph, - new JsonSerializerSettings { ContractResolver = new Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver() } - ); - - public async Task OnGetAsync() - { - InitializeCommonPageState(); - - ViewData["Title"] = "گنجور » شبکهٔ روابط شخصیت‌ها"; - - var response = await _httpClient.GetAsync($"{APIRoot.Url}/api/people/graph"); - if (!response.IsSuccessStatusCode) - { - LastError = await ReadErrorMessageAsync(response); - return Page(); - } - Graph = JsonConvert.DeserializeObject(await response.Content.ReadAsStringAsync()); - - return Page(); - } - } -} diff --git a/GanjooRazor/Pages/Person.cshtml b/GanjooRazor/Pages/Person.cshtml deleted file mode 100644 index 1b92d03a..00000000 --- a/GanjooRazor/Pages/Person.cshtml +++ /dev/null @@ -1,162 +0,0 @@ -@page "{id:int}" -@model GanjooRazor.Pages.PersonModel -@using DNTPersianUtils.Core -@{ - Layout = "_Layout"; -} -@section Head { - -} -@if (!string.IsNullOrEmpty(Model.LastError)) -{ - @Model.LastError -} -else -{ - - -
- -
- - - -
 
- -
-

- @Model.Person.Name - @if (Model.LoggedIn) - { - ✎ - } -

- - @if (!string.IsNullOrEmpty(Model.Person.FamilyTreeCaption)) - { -

شجره‌نامه: @Model.Person.FamilyTreeCaption

- } - - @if (Model.Person.BirthYearInLHijri != 0 || Model.Person.DeathYearInLHijri != 0) - { -

- @if (Model.Person.BirthYearInLHijri != 0) - { - تولد: @Model.Person.BirthYearInLHijri.ToPersianNumbers() (قمری) @(Model.Person.ValidBirthDate ? "" : "- تخمینی") - } - @if (Model.Person.DeathYearInLHijri != 0) - { - — وفات: @Model.Person.DeathYearInLHijri.ToPersianNumbers() (قمری) @(Model.Person.ValidDeathDate ? "" : "- تخمینی") - } -

- } - - @if (!string.IsNullOrEmpty(Model.Person.Description)) - { -

@Model.Person.Description

- } - - @if (!string.IsNullOrEmpty(Model.Person.WikiUrl)) - { -

صفحهٔ ویکی‌پدیا

- } -
- - @if (Model.RelationRows.Count > 0) - { -
 
-
-

- خویشاوندان - نمایش نمودار شجره‌نامه - @if (Model.LoggedIn) - { - افزودن خویشاوند جدید - } -

-
    - @foreach (var row in Model.RelationRows) - { -
  • - @row.Label — @row.OtherPersonName - @if (!string.IsNullOrEmpty(row.Note)) - { - (@row.Note) - } - @if (Model.LoggedIn) - { - ✎ - } -
  • - } -
-
- } - else if (Model.LoggedIn) - { -
 
-
-

- خویشاوندان - افزودن خویشاوند جدید -

-
- } - - @if (Model.AffiliationRows.Count > 0) - { -
 
-
-

وابستگی‌های غیرخویشاوندی

-
    - @foreach (var row in Model.AffiliationRows) - { -
  • - @row.SentenceBeforeOtherName@row.OtherPersonName@row.SentenceAfterOtherName - @if (!string.IsNullOrEmpty(row.Note)) - { - (@row.Note) - } -
  • - } -
-
- } - - @if (Model.Poems != null && Model.Poems.Length > 0) - { -
 
-
-

اشعار برچسب‌خورده با این شخصیت

-
    - @foreach (var tag in Model.Poems) - { - if (tag.Poem != null) - { -
  • @tag.Poem.FullTitle
  • - } - } -
-
- } - else - { -
 
-
-

هنوز شعری با این شخصیت برچسب‌گذاری نشده است.

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

@Model.LastError

+} +else +{ +
+

+ @Model.Person.Name + @if (Model.LoggedIn) + { + ✎ + } +

+ + @if (!string.IsNullOrEmpty(Model.Person.FamilyTreeCaption)) + { +

شجره‌نامه: @Model.Person.FamilyTreeCaption

+ } + + @if (Model.Person.BirthYearInLHijri != 0 || Model.Person.DeathYearInLHijri != 0) + { +

+ @if (Model.Person.BirthYearInLHijri != 0) + { + تولد: @Model.Person.BirthYearInLHijri.ToPersianNumbers() (قمری) @(Model.Person.ValidBirthDate ? "" : "- تخمینی") + } + @if (Model.Person.DeathYearInLHijri != 0) + { + — وفات: @Model.Person.DeathYearInLHijri.ToPersianNumbers() (قمری) @(Model.Person.ValidDeathDate ? "" : "- تخمینی") + } +

+ } + + @if (!string.IsNullOrEmpty(Model.Person.Description)) + { +

@Model.Person.Description

+ } + + @if (!string.IsNullOrEmpty(Model.Person.WikiUrl)) + { +

صفحهٔ ویکی‌پدیا

+ } + + @if (Model.RelationRows.Count > 0) + { +

+ خویشاوندان + نمایش نمودار شجره‌نامه + @if (Model.LoggedIn) + { + افزودن خویشاوند جدید + } +

+
    + @foreach (var row in Model.RelationRows) + { +
  • + @row.Label — @row.OtherPersonName + @if (!string.IsNullOrEmpty(row.Note)) + { + (@row.Note) + } + @if (Model.LoggedIn) + { + ✎ + } +
  • + } +
+ } + else if (Model.LoggedIn) + { +

+ خویشاوندان + افزودن خویشاوند جدید +

+ } + + @if (Model.AffiliationRows.Count > 0) + { +

وابستگی‌های غیرخویشاوندی

+
    + @foreach (var row in Model.AffiliationRows) + { +
  • + @row.SentenceBeforeOtherName@row.OtherPersonName@row.SentenceAfterOtherName + @if (!string.IsNullOrEmpty(row.Note)) + { + (@row.Note) + } +
  • + } +
+ } + + @if (Model.Poems != null && Model.Poems.Length > 0) + { +

اشعار برچسب‌خورده با این شخصیت

+
    + @foreach (var tag in Model.Poems) + { + if (tag.Poem != null) + { +
  • @tag.Poem.FullTitle
  • + } + } +
+ } + else + { +

هنوز شعری با این شخصیت برچسب‌گذاری نشده است.

+ } +
+} diff --git a/GanjooRazor/Pages/Person.cshtml.cs b/GanjooRazor/Pages/PersonWindow.cshtml.cs similarity index 90% rename from GanjooRazor/Pages/Person.cshtml.cs rename to GanjooRazor/Pages/PersonWindow.cshtml.cs index 6a8d7fcc..095a1de0 100644 --- a/GanjooRazor/Pages/Person.cshtml.cs +++ b/GanjooRazor/Pages/PersonWindow.cshtml.cs @@ -11,14 +11,17 @@ using RMuseum.Models.Ganjoor.ViewModels; namespace GanjooRazor.Pages { /// - /// read-only person/family-tree browsing page - shows one GanjoorRelatedPerson, their kinship - /// and non-family ties (see GanjoorPersonRelation/GanjoorPersonAffiliation), and the poems - /// tagged with them. Public counterpart of the Editor.cshtml suggestion form and - /// ReviewEdits.cshtml moderation view for the same data, once it's approved and materialized. + /// one person's bio, kinship/affiliation ties and tagged poems, rendered as a bare fragment + /// (Layout = null - no header, footer or site chrome) and opened as an inline modal via + /// PersonWindow.open(id) in personwindow.js, from wherever a person is referenced: a poem's + /// tagged-persons list, the category/whole-site graph, the family-tree chart, the + /// suggestion/moderation forms. This used to be the standalone page Person.cshtml; it has no + /// entry point of its own any more; every "view this person" link on the site now calls + /// PersonWindow.open(id) instead of navigating here. /// - public class PersonModel : LoginPartialEnabledPageModel + public class PersonWindowModel : LoginPartialEnabledPageModel { - public PersonModel(HttpClient httpClient, IConfiguration configuration) : base(httpClient, configuration) + public PersonWindowModel(HttpClient httpClient, IConfiguration configuration) : base(httpClient, configuration) { } @@ -127,8 +130,6 @@ namespace GanjooRazor.Pages return Page(); } - ViewData["Title"] = $"گنجور » {Person.Name}"; - var relationsResponse = await _httpClient.GetAsync($"{APIRoot.Url}/api/people/{id}/relations"); if (!relationsResponse.IsSuccessStatusCode) { diff --git a/GanjooRazor/Pages/Shared/_AdminLayout.cshtml b/GanjooRazor/Pages/Shared/_AdminLayout.cshtml index 00ced0bf..db96e82c 100644 --- a/GanjooRazor/Pages/Shared/_AdminLayout.cshtml +++ b/GanjooRazor/Pages/Shared/_AdminLayout.cshtml @@ -39,6 +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 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 *@ + +