docs: #319 section editor
This commit is contained in:
parent
fde4d9f8a7
commit
be63f176bf
@ -20,7 +20,7 @@ else
|
||||
@Html.Raw(Model.PoemSection.HtmlText)
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<tr>
|
||||
<td>
|
||||
وزن فعلی:
|
||||
</td>
|
||||
@ -106,5 +106,27 @@ else
|
||||
<a role="button" onclick="newRhythm()" class="pagebutton">پیشنهاد وزن جدید</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
شکستن به اشعار مجزا
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@foreach (var verse in Model.Verses)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
<p id="original-@($"{verse.VOrder}")">@verse.Text</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<a role="button" id="breakpoem-@verse.VOrder" style="cursor:pointer;width:100%;color:white;background-color:red;display:block" onclick="#">از اینجا به بعد شعر جداگانهایست</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
}
|
||||
</table>
|
||||
}
|
||||
|
||||
@ -10,6 +10,7 @@ using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using RMuseum.Models.Ganjoor;
|
||||
using RMuseum.Models.Ganjoor.ViewModels;
|
||||
using RMuseum.Services.Implementation;
|
||||
|
||||
namespace GanjooRazor.Areas.User.Pages
|
||||
{
|
||||
@ -46,6 +47,39 @@ namespace GanjooRazor.Areas.User.Pages
|
||||
/// </summary>
|
||||
public GanjoorPoemCorrectionViewModel MyLastEdit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// verses
|
||||
/// </summary>
|
||||
public List<GanjoorVerseViewModel> Verses { get; set; }
|
||||
|
||||
private List<GanjoorVerseViewModel> _FilterSectionVerses(GanjoorPoemSection section, GanjoorVerseViewModel[] verses)
|
||||
{
|
||||
List<GanjoorVerseViewModel> sectionVerses = new List<GanjoorVerseViewModel>();
|
||||
foreach (GanjoorVerseViewModel verse in verses)
|
||||
{
|
||||
switch (section.VerseType)
|
||||
{
|
||||
case VersePoemSectionType.First:
|
||||
if (verse.SectionIndex1 == section.Index)
|
||||
sectionVerses.Add(verse);
|
||||
break;
|
||||
case VersePoemSectionType.Second:
|
||||
if (verse.SectionIndex2 == section.Index)
|
||||
sectionVerses.Add(verse);
|
||||
break;
|
||||
case VersePoemSectionType.Third:
|
||||
if (verse.SectionIndex3 == section.Index)
|
||||
sectionVerses.Add(verse);
|
||||
break;
|
||||
default:
|
||||
if (verse.SectionIndex4 == section.Index)
|
||||
sectionVerses.Add(verse);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return sectionVerses;
|
||||
}
|
||||
|
||||
public async Task<IActionResult> OnGetAsync()
|
||||
{
|
||||
if (string.IsNullOrEmpty(Request.Cookies["Token"]))
|
||||
@ -93,6 +127,8 @@ namespace GanjooRazor.Areas.User.Pages
|
||||
RhythmsAlphabetically = rhythmsByVerseCount.ToArray();
|
||||
|
||||
PoemSection = PageInformation.Poem.Sections.Where(s => s.Index == int.Parse(Request.Query["index"])).Single();
|
||||
|
||||
Verses = _FilterSectionVerses(PoemSection, PageInformation.Poem.Verses);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user