#241 removing AJAX call for finding similar poems and using cached related poems to fix jumpy nature of ajax manipulation of pages on load
This commit is contained in:
parent
cb1e6f8a00
commit
258748a8a4
@ -40,12 +40,6 @@
|
||||
checkWebShareSupport();
|
||||
btshmr(@Model.GanjoorPage.Id);
|
||||
checkIfBookmarked(@Model.GanjoorPage.Id);
|
||||
@if (Model.GanjoorPage.Poem.GanjoorMetre != null && !string.IsNullOrEmpty(Model.GanjoorPage.Poem.RhymeLetters))
|
||||
{
|
||||
<text>
|
||||
loadSimilarPoems(@Model.GanjoorPage.Id, '@Model.GanjoorPage.Poem.GanjoorMetre.Rhythm', '@Model.GanjoorPage.Poem.RhymeLetters');
|
||||
</text>
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@ -362,16 +362,6 @@ if (Model.GanjoorPage.Poem.Category.Cat.Previous != null)
|
||||
<a role="button" id="bookmark" class="pagebutton" onclick="switchBookmark(@Model.GanjoorPage.Id, 0)">نشانهگذاری / حذف نشانه<i class="info-buttons" id="bookmark-icon">star_border</i></a>
|
||||
</text>
|
||||
}
|
||||
@if (Model.GanjoorPage.Poem.GanjoorMetre != null)
|
||||
{
|
||||
|
||||
@if (!string.IsNullOrEmpty(Model.GanjoorPage.Poem.RhymeLetters))
|
||||
{
|
||||
<text>
|
||||
<a role="button" class="pagebutton" id="similar-poems-button" href="@Html.Raw($"/simi/?v={Uri.EscapeUriString(Model.GanjoorPage.Poem.GanjoorMetre.Rhythm)}&g={Uri.EscapeUriString(Model.GanjoorPage.Poem.RhymeLetters)}")">شعرهای هم آهنگ<i class="info-buttons">search</i></a>
|
||||
</text>
|
||||
}
|
||||
}
|
||||
<span id="copylink_span" class="w3tooltip">
|
||||
<a role="button" id="copylink" class="pagebutton" onclick="copyPoemLink()">رونوشت نشانی<i class="info-buttons" id="copylink-icon">link</i></a>
|
||||
<span class="w3tooltiptext" id="copylink-tooltip">رونوشت نشانی</span>
|
||||
@ -403,7 +393,46 @@ if (Model.GanjoorPage.Poem.Category.Cat.Previous != null)
|
||||
|
||||
@if (Model.GanjoorPage.Poem.GanjoorMetre != null && !string.IsNullOrEmpty(Model.GanjoorPage.Poem.RhymeLetters))
|
||||
{
|
||||
<div id="similar-poems-placesholder"></div>
|
||||
<div class="related-images-frame">
|
||||
@if (Model.GanjoorPage.Poem.Top6RelatedPoems.Length == 0)
|
||||
{
|
||||
<p>
|
||||
<a role="button" class="pagebutton" href="@Html.Raw($"/simi/?v={Uri.EscapeUriString(Model.GanjoorPage.Poem.GanjoorMetre.Rhythm)}&g={Uri.EscapeUriString(Model.GanjoorPage.Poem.RhymeLetters)}")">شعرهای هم آهنگ<i class="info-buttons">search</i></a>
|
||||
</p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="century">
|
||||
شعرهای هم آهنگ
|
||||
</div>
|
||||
|
||||
@for (int i = 0; i < Model.GanjoorPage.Poem.Top6RelatedPoems.Length; i++)
|
||||
{
|
||||
<div class="inlinesimi">
|
||||
<div class="poet-pic-wrap">
|
||||
<a href="@Html.Raw(Model.GanjoorPage.Poem.Top6RelatedPoems[i].FullUrl)"><img src="@(GanjooRazor.APIRoot.InternetUrl + Model.GanjoorPage.Poem.Top6RelatedPoems[i].PoetImageUrl)" alt="@Model.GanjoorPage.Poem.Top6RelatedPoems[i].PoetName" /></a>
|
||||
</div>
|
||||
<div class="inlinesimi-poem-title">
|
||||
<a href="@Html.Raw(Model.GanjoorPage.Poem.Top6RelatedPoems[i].FullUrl)">@Model.GanjoorPage.Poem.Top6RelatedPoems[i].FullTitle</a><span></span>
|
||||
</div>
|
||||
<div class="simitext">
|
||||
@Html.Raw(Model.GanjoorPage.Poem.Top6RelatedPoems[i].HtmlExcerpt)
|
||||
</div>
|
||||
|
||||
@if (Model.GanjoorPage.Poem.Top6RelatedPoems[i].PoetMorePoemsLikeThisCount > 0)
|
||||
{
|
||||
<div class="inlinesimi-poem-more">
|
||||
* @Model.GanjoorPage.Poem.Top6RelatedPoems[i].PoetName <a href="@Html.Raw($"/simi/?v={Uri.EscapeUriString(Model.GanjoorPage.Poem.GanjoorMetre.Rhythm)}&g={Uri.EscapeUriString(Model.GanjoorPage.Poem.RhymeLetters)}&a={Model.GanjoorPage.Poem.Top6RelatedPoems[i].PoetId}")">@Model.GanjoorPage.Poem.Top6RelatedPoems[i].PoetMorePoemsLikeThisCount.ToPersianNumbers() شعر هم آهنگ دیگر</a> نیز دارد.
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
|
||||
<p>
|
||||
<a role="button" class="pagebutton" href="@Html.Raw($"/simi/?v={Uri.EscapeUriString(Model.GanjoorPage.Poem.GanjoorMetre.Rhythm)}&g={Uri.EscapeUriString(Model.GanjoorPage.Poem.RhymeLetters)}")">همهٔ شعرهای هم آهنگ<i class="info-buttons">search</i></a>
|
||||
</p>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (Model.GanjoorPage.Poem.Songs.Length == 0)
|
||||
|
||||
@ -104,7 +104,7 @@ namespace RMuseum.Services.Implementation
|
||||
PoetName = relatedPoem.Cat.Poet.Nickname,
|
||||
PoetImageUrl = $"/api/ganjoor/poet/image{(await context.GanjoorCategories.Where(c => c.ParentId == null && c.PoetId == relatedPoem.Cat.PoetId).AsNoTracking().SingleAsync()).FullUrl}.gif",
|
||||
FullTitle = relatedPoem.FullTitle,
|
||||
FullUrl = relatedPoem.FullTitle,
|
||||
FullUrl = relatedPoem.FullUrl,
|
||||
PoetMorePoemsLikeThisCount = 0,
|
||||
HtmlExcerpt = GetPoemHtmlExcerpt(relatedPoem.HtmlText)
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user