docs: #373 display couplet summary in couplet partial view

This commit is contained in:
Hamid Reza Mohammadi 2023-03-31 15:26:45 +03:30
parent 3f6ece3b3e
commit 7fa44624b8
3 changed files with 30 additions and 0 deletions

View File

@ -845,6 +845,12 @@ namespace GanjooRazor.Pages
{
return BadRequest(JsonConvert.DeserializeObject<string>(await responseCoupletSections.Content.ReadAsStringAsync()));
}
var responsePoem = await _httpClient.GetAsync($"{APIRoot.Url}/api/ganjoor/poem/{poemId}??catInfo=false&catPoems=false&rhymes=false&recitations=false&images=false&songs=false&comments=false&verseDetails=true&navigation=false&relatedpoems=false");
if (!responsePoem.IsSuccessStatusCode)
{
return BadRequest(JsonConvert.DeserializeObject<string>(await responsePoem.Content.ReadAsStringAsync()));
}
var poem = JObject.Parse(await responsePoem.Content.ReadAsStringAsync()).ToObject<GanjoorPoemCompleteViewModel>();
var sections = JArray.Parse(await responseCoupletSections.Content.ReadAsStringAsync()).ToObject<List<GanjoorPoemSection>>();
var sectionsWithMetreAndRhymes = new List<GanjoorPoemSection>();
foreach (var section in sections)
@ -904,6 +910,7 @@ namespace GanjooRazor.Pages
Numbers = numbers,
Sections = sections,
SectionsWithMetreAndRhymes = sectionsWithMetreAndRhymes,
Verses = poem.Verses.Where(v => v.CoupletIndex == coupletIndex).ToList(),
}
}
};

View File

@ -35,6 +35,24 @@
}
</table>
@foreach(var verse in Model.Verses.Where(v => !string.IsNullOrEmpty(v.CoupletSummary)).ToList())
{
<div id="summary-block-@Model.CoupletIndex-@verse.VOrder" class="width-100per">
<div class="notice">
<p>@verse.CoupletSummary</p>
@if (Model.LoggedIn)
{
<a href="@($"/User/Editor?id={Model.PoemId}#summary-{verse.VOrder}")" role="button" class="w3tooltip cursor-pointer">
<div class="circled-number">
<i class="noindent-info-button edit-poem-button"></i>
</div>
<span class="w3tooltiptext">ویرایش</span>
</a>
}
</div>
</div>
}
<div id="play-block-@Model.CoupletIndex" class="width-100per">
<select id="narrators-@Model.CoupletIndex" class="bnum-partial-narrators"></select>
<a role="button" id="listen-@Model.CoupletIndex" class="bnum-partial-narrate-btn" onclick="playCouplet(@Model.CoupletIndex)">از اینجا بخواند</a>

View File

@ -70,6 +70,11 @@ namespace GanjooRazor.Pages
/// </summary>
public List<GanjoorPoemSection> SectionsWithMetreAndRhymes { get; set; }
/// <summary>
/// verses
/// </summary>
public List<GanjoorVerseViewModel> Verses { get; set; }
public _CommentPartialModel GetCommentModel(GanjoorCommentSummaryViewModel comment)
{
return new _CommentPartialModel()