From c03c232e7d955df0a787720726f5fdb0c000f595 Mon Sep 17 00:00:00 2001 From: Hamid Reza Mohammadi Date: Mon, 28 Mar 2022 15:14:58 +0430 Subject: [PATCH] docs: #303 support for @theodore-s-beers Theo Beers' pretty-print format for poems: --- GanjooRazor/Pages/AudioClip.cshtml | 2 +- GanjooRazor/Pages/Bp.cshtml | 2 +- GanjooRazor/Pages/Error.cshtml | 2 +- GanjooRazor/Pages/FAQ.cshtml | 2 +- GanjooRazor/Pages/Golha.cshtml | 2 +- GanjooRazor/Pages/Index.cshtml | 2 +- GanjooRazor/Pages/Login.cshtml | 2 +- GanjooRazor/Pages/Map.cshtml | 2 +- GanjooRazor/Pages/Photos.cshtml | 2 +- GanjooRazor/Pages/Pin.cshtml | 2 +- GanjooRazor/Pages/RecitationsOrder.cshtml | 2 +- GanjooRazor/Pages/ReportComment.cshtml | 2 +- GanjooRazor/Pages/ReportRecitation.cshtml | 2 +- GanjooRazor/Pages/ResetPassword.cshtml | 2 +- GanjooRazor/Pages/Search.cshtml | 2 +- GanjooRazor/Pages/Shared/_AdminLayout.cshtml | 2 +- .../Pages/Shared/_UserPanelLayout.cshtml | 2 +- GanjooRazor/Pages/SignUp.cshtml | 2 +- GanjooRazor/Pages/Spotify.cshtml | 2 +- GanjooRazor/Pages/Trans.cshtml | 2 +- GanjooRazor/Pages/_GanjoorPagePartial.cshtml | 5 + GanjooRazor/Pages/errors/404.cshtml | 2 +- GanjooRazor/Pages/errors/503.cshtml | 2 +- GanjooRazor/Pages/t6e.cshtml | 166 ++++++++++++++++++ GanjooRazor/Pages/t6e.cshtml.cs | 57 ++++++ GanjooRazor/appsettings.json | 4 +- GanjooRazor/wwwroot/css/p8.css | 4 + GanjooRazor/wwwroot/css/t6e.css | 89 ++++++++++ 28 files changed, 345 insertions(+), 24 deletions(-) create mode 100644 GanjooRazor/Pages/t6e.cshtml create mode 100644 GanjooRazor/Pages/t6e.cshtml.cs create mode 100644 GanjooRazor/wwwroot/css/t6e.css diff --git a/GanjooRazor/Pages/AudioClip.cshtml b/GanjooRazor/Pages/AudioClip.cshtml index 8ef8dffa..f090d2f0 100644 --- a/GanjooRazor/Pages/AudioClip.cshtml +++ b/GanjooRazor/Pages/AudioClip.cshtml @@ -15,7 +15,7 @@ گنجور » نمایش خوانش - + diff --git a/GanjooRazor/Pages/Error.cshtml b/GanjooRazor/Pages/Error.cshtml index e89f2eb4..9d175f92 100644 --- a/GanjooRazor/Pages/Error.cshtml +++ b/GanjooRazor/Pages/Error.cshtml @@ -14,7 +14,7 @@ @ViewData["Title"] - + diff --git a/GanjooRazor/Pages/FAQ.cshtml b/GanjooRazor/Pages/FAQ.cshtml index 82b29971..2e9ed7b7 100644 --- a/GanjooRazor/Pages/FAQ.cshtml +++ b/GanjooRazor/Pages/FAQ.cshtml @@ -12,7 +12,7 @@ @ViewData["Title"] - + diff --git a/GanjooRazor/Pages/Golha.cshtml b/GanjooRazor/Pages/Golha.cshtml index c2fd386d..56a758d2 100644 --- a/GanjooRazor/Pages/Golha.cshtml +++ b/GanjooRazor/Pages/Golha.cshtml @@ -10,7 +10,7 @@ انتخاب قطعه‌ای از برنامهٔ گلها مرتبط با این شعر - + diff --git a/GanjooRazor/Pages/Index.cshtml b/GanjooRazor/Pages/Index.cshtml index 78185856..65d04279 100644 --- a/GanjooRazor/Pages/Index.cshtml +++ b/GanjooRazor/Pages/Index.cshtml @@ -12,7 +12,7 @@ @Html.Raw(ViewData["Title"]) - + diff --git a/GanjooRazor/Pages/Login.cshtml b/GanjooRazor/Pages/Login.cshtml index ab04c859..66952d24 100644 --- a/GanjooRazor/Pages/Login.cshtml +++ b/GanjooRazor/Pages/Login.cshtml @@ -13,7 +13,7 @@ - +
diff --git a/GanjooRazor/Pages/Map.cshtml b/GanjooRazor/Pages/Map.cshtml index 4fca77e2..dfa8e92b 100644 --- a/GanjooRazor/Pages/Map.cshtml +++ b/GanjooRazor/Pages/Map.cshtml @@ -12,7 +12,7 @@ - + + + + + + + @if (!string.IsNullOrEmpty(Model.LastError)) + { + @Html.Raw(Model.LastError) + } + else + { +
+

@Model.Poem.FullTitle

+
+ + @Html.Raw(Model.Poem.HtmlText) + + + + + } + + diff --git a/GanjooRazor/Pages/t6e.cshtml.cs b/GanjooRazor/Pages/t6e.cshtml.cs new file mode 100644 index 00000000..62c108c4 --- /dev/null +++ b/GanjooRazor/Pages/t6e.cshtml.cs @@ -0,0 +1,57 @@ +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.RazorPages; + +using System.Net.Http; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.RazorPages; +using Microsoft.Extensions.Configuration; +using Newtonsoft.Json; +using RMuseum.Models.Ganjoor.ViewModels; +using RMuseum.Models.GanjoorAudio.ViewModels; + +namespace GanjooRazor.Pages +{ + public class t6eModel : PageModel + { + /// + /// poem + /// + public GanjoorPoemCompleteViewModel Poem { get; set; } + + /// + /// last error + /// + public string LastError { get; set; } + + public async Task OnGetAsync() + { + var responsePoem = await _httpClient.GetAsync($"{APIRoot.Url}/api/ganjoor/poem/{Request.Query["p"]}?verseDetails=true&catInfo=false&rhymes=false&recitations=false&images=false&songs=false&comments=false&navigation=false"); + if (!responsePoem.IsSuccessStatusCode) + { + LastError = JsonConvert.DeserializeObject(await responsePoem.Content.ReadAsStringAsync()); + return Page(); + } + + Poem = JsonConvert.DeserializeObject(await responsePoem.Content.ReadAsStringAsync()); + return Page(); + } + + /// + /// HttpClient instance + /// + private readonly HttpClient _httpClient; + + + + /// + /// constructor + /// + /// + /// + public t6eModel(HttpClient httpClient) + { + _httpClient = httpClient; + } + } +} diff --git a/GanjooRazor/appsettings.json b/GanjooRazor/appsettings.json index b1b54c37..26ef2dbd 100644 --- a/GanjooRazor/appsettings.json +++ b/GanjooRazor/appsettings.json @@ -8,8 +8,8 @@ }, "AllowedHosts": "*", "GoogleAnalyticsCode": "", - "APIRoot": "http://localhost:3439", - "GlobalAPIRoot": "http://localhost:3439", + "APIRoot": "https://api.ganjoor.net", + "GlobalAPIRoot": "https://api.ganjoor.net", "SiteUrl": "http://localhost:33081", "MockSpotify": "False", "Spotify": { diff --git a/GanjooRazor/wwwroot/css/p8.css b/GanjooRazor/wwwroot/css/p8.css index 7f14a83e..09575a99 100644 --- a/GanjooRazor/wwwroot/css/p8.css +++ b/GanjooRazor/wwwroot/css/p8.css @@ -1603,6 +1603,10 @@ audio { content: 'delete' } +.menu-book::after { + content: 'menu_book' +} + .visible-notification-badge { position: absolute; diff --git a/GanjooRazor/wwwroot/css/t6e.css b/GanjooRazor/wwwroot/css/t6e.css new file mode 100644 index 00000000..13529952 --- /dev/null +++ b/GanjooRazor/wwwroot/css/t6e.css @@ -0,0 +1,89 @@ +:root { + --hemistich-width: auto; +} + +body { + margin: auto; + max-width: calc((var(--hemistich-width) * 2) + 10ch); + padding: 2ch 1ch; +} + +p { + font-family: "Scheherazade", serif; + font-size: x-large; + margin: 0; + text-align-last: justify; +} + +.b { + display: flex; + flex-flow: row wrap; +} + +.final-line { + align-items: center; + display: flex; + flex-flow: column nowrap; + margin-right: 5.5ch; + margin-top: 0.4rem; +} + +.line-number { + width: 5.5ch; +} + +.m1, +.m2 { + width: var(--hemistich-width); +} + +.separator { + width: 4.5ch; +} + +#title-block-header { + display: none; +} + +@media screen and (max-width: 767px) { + p { + text-align-last: auto; + } + + .b, + .final-line { + display: block; + } + + .final-line { + margin: 0; + } + + .line-number { + display: none; + } + + .m1, + .m2 { + width: auto; + } + + .m2 { + background-color: #e8e8e8; + border-radius: 4px; + padding-right: 2ch; + } + + .separator { + display: none; + } +} + +#t6e-footer { + margin-left: auto; + margin-right: auto; + margin-bottom: 5px; + margin-top: 50px; + border-top: 1px dotted #000; + font-size: small; +}