#386 category and poet page shortcuts

This commit is contained in:
Hamid Reza Mohammadi 2023-06-16 14:31:32 +03:30
parent fd54db4fe4
commit f424319edb
3 changed files with 98 additions and 47 deletions

View File

@ -707,20 +707,23 @@ namespace GanjooRazor.Pages
break;
case GanjoorPageType.CatPage:
_prepareNextPre();
{
var catTop1RecitationsQuery = await _httpClient.GetAsync($"{APIRoot.Url}/api/audio/cattop1/{GanjoorPage.PoetOrCat.Cat.Id}?includePoemText=false");
if (!catTop1RecitationsQuery.IsSuccessStatusCode)
{
LastError = JsonConvert.DeserializeObject<string>(await catTop1RecitationsQuery.Content.ReadAsStringAsync());
return Page();
}
CategoryTop1Recitations = JsonConvert.DeserializeObject<PublicRecitationViewModel[]>(await catTop1RecitationsQuery.Content.ReadAsStringAsync());
}
IsCatPage = true;
break;
}
if(IsPoetPage || IsCatPage)
{
var catTop1RecitationsQuery = await _httpClient.GetAsync($"{APIRoot.Url}/api/audio/cattop1/{GanjoorPage.PoetOrCat.Cat.Id}?includePoemText=false");
if (!catTop1RecitationsQuery.IsSuccessStatusCode)
{
LastError = JsonConvert.DeserializeObject<string>(await catTop1RecitationsQuery.Content.ReadAsStringAsync());
return Page();
}
CategoryTop1Recitations = JsonConvert.DeserializeObject<PublicRecitationViewModel[]>(await catTop1RecitationsQuery.Content.ReadAsStringAsync());
}
if (IsPoemPage)
{
HtmlLanguage = string.IsNullOrEmpty(GanjoorPage.Poem.Language) ? "fa-IR" : GanjoorPage.Poem.Language;

View File

@ -214,7 +214,7 @@
(Model.IsPoemPage && Model.GanjoorPage.Poem.GeoDateTags.Length > 0)
)
{
<div class="comments-like-div">
<div class="comments-like-div" id="map-section">
@if (!string.IsNullOrEmpty(Model.GanjoorPage.PoetOrCat.Cat.MapName))
{
<div class="century">
@ -375,15 +375,17 @@
</div>
</nav>
@if (Model.CategoryTop1Recitations.Length > 0)
{
<div class="spacer">&nbsp;</div>
<div class="related-images-frame" id="recitations">
<div id="recitations-section">
<partial name="_AudioPlayerPartial" model=@Model.GetRecitationsModel(Model.CategoryTop1Recitations, true) />
</div>
}
@if ((Model.IsCatPage || Model.IsPoetPage) && Model.CategoryTop1Recitations.Length > 0)
{
<div class="spacer">&nbsp;</div>
<div class="related-images-frame" id="recitations">
<div id="recitations-section">
<partial name="_AudioPlayerPartial" model=@Model.GetRecitationsModel(Model.CategoryTop1Recitations, true) />
</div>
}
</div>
}
@if (Model.CanEdit && !Model.IsPoemPage)

View File

@ -2,7 +2,18 @@
@using DNTPersianUtils.Core
<div id="utils-navbar">
@if (Model.GanjoorPage != null && Model.GanjoorPage.Poem != null)
@if (Model.GanjoorPage != null
&&
(
Model.GanjoorPage.Poem != null
||
!string.IsNullOrEmpty(Model.PreviousUrl) || !string.IsNullOrEmpty(Model.NextUrl)
||
(Model.CategoryPoemGeoDateTags != null && Model.CategoryPoemGeoDateTags.Length > 0)
||
(Model.CategoryTop1Recitations != null && Model.CategoryTop1Recitations.Length > 0)
)
)
{
<div class="clear-both utilbar">
@if (Model.GanjoorPage.Poem != null)
@ -98,15 +109,7 @@
</a>
}
@if (Model.GanjoorPage.Poem.Recitations.Length > 0)
{
<a href="#recitations" role="button" class="w3tooltip cursor-pointer">
<div class="circled-number">
<i class="noindent-info-button recitation-listen"></i>
</div>
<span class="w3tooltiptext">خوانش‌ها</span>
</a>
}
@if (Model.SectionsWithMetreAndRhymes != null)
{
@ -134,26 +137,69 @@
}
}
}
}
@if (!string.IsNullOrEmpty(Model.PreviousUrl))
{
<a href="@Html.Raw(Model.PreviousUrl)" role="button" class="w3tooltip cursor-pointer">
<div class="circled-number">
<i class="noindent-info-button right-btn"></i>
</div>
<span class="w3tooltiptext">قبلی</span>
</a>
}
@if
(
(Model.GanjoorPage != null && Model.GanjoorPage.Poem != null && Model.GanjoorPage.Poem.Recitations.Length > 0)
||
(Model.CategoryTop1Recitations != null && Model.CategoryTop1Recitations.Length > 0)
)
{
<a href="#recitations" role="button" class="w3tooltip cursor-pointer">
<div class="circled-number">
<i class="noindent-info-button recitation-listen"></i>
</div>
<span class="w3tooltiptext">خوانش‌ها</span>
</a>
}
@if (!string.IsNullOrEmpty(Model.NextUrl))
{
<a href="@Html.Raw(Model.NextUrl)" role="button" class="w3tooltip cursor-pointer">
<div class="circled-number">
<i class="noindent-info-button left-btn"></i>
</div>
<span class="w3tooltiptext">بعدی</span>
</a>
}
@if
(
(Model.CategoryPoemGeoDateTags != null && Model.CategoryPoemGeoDateTags.Length > 0)
||
(Model.GanjoorPage != null && Model.GanjoorPage.Poem != null && Model.GanjoorPage.Poem.GeoDateTags.Length > 0)
)
{
<a href="#map-section" role="button" class="w3tooltip cursor-pointer">
<div class="circled-number">
<i class="noindent-info-button map-icon"></i>
</div>
<span class="w3tooltiptext">
@if (!string.IsNullOrEmpty(Model.GanjoorPage.PoetOrCat.Cat.MapName))
{
<text>
@Model.GanjoorPage.PoetOrCat.Cat.MapName
</text>
}
else
{
<text>
مکان‌های نامبرده شده
</text>
}
</span>
</a>
}
@if (!string.IsNullOrEmpty(Model.PreviousUrl))
{
<a href="@Html.Raw(Model.PreviousUrl)" role="button" class="w3tooltip cursor-pointer">
<div class="circled-number">
<i class="noindent-info-button right-btn"></i>
</div>
<span class="w3tooltiptext">قبلی</span>
</a>
}
@if (!string.IsNullOrEmpty(Model.NextUrl))
{
<a href="@Html.Raw(Model.NextUrl)" role="button" class="w3tooltip cursor-pointer">
<div class="circled-number">
<i class="noindent-info-button left-btn"></i>
</div>
<span class="w3tooltiptext">بعدی</span>
</a>
}
</div>
}