#383 poem format in poem editor

This commit is contained in:
Hamid Reza Mohammadi 2023-06-02 08:58:31 +03:30
parent 0f7d04f929
commit bb3e9f5adc
2 changed files with 57 additions and 2 deletions

View File

@ -77,8 +77,13 @@
rhythm_new2 = null;
}
var section_format = $('#poemformat').val();
if (section_format == $('#poemformat-old').text()) {
section_format = null;
}
if (verseOrderText.length == 0 && verseOrderSummaries.length == 0) {
if (rhythm_new == null && rhythm_new2 == null && rhyme_letters == null) {
if (rhythm_new == null && rhythm_new2 == null && rhyme_letters == null && section_format == null) {
alert('شما هیچ تغییری در اطلاعات نداده‌اید!');
return;
}
@ -102,6 +107,7 @@
rhythm: rhythm_new,
rhythm2: rhythm_new2,
rhyme: rhyme_letters,
format: section_format,
verseOrderSummaries: verseOrderSummaries,
verseLanguages: verseLanguages,
note: $('#note').val(),
@ -1137,6 +1143,44 @@ else
</td>
</tr>
<tr>
<td>
قالب شعری فعلی:
</td>
</tr>
<tr>
<td>
@RMuseum.Services.Implementation.GanjoorPoemFormatConvertor.GetString((RMuseum.Models.Ganjoor.GanjoorPoemFormat)Model.PoemFormat)
<div id="poemformat-old" class="hidden-recitation">@Model.PoemFormat</div>
</td>
</tr>
<tr>
<td>
<label for="">قالب شعری:</label>
<br />
<select id="poemformat">
@foreach (var poemFormat in System.Enum.GetValues(typeof(RMuseum.Models.Ganjoor.GanjoorPoemFormat)))
{
@if (Model.MyLastEdit != null && (Model.MyLastEdit.PoemFormat == (RMuseum.Models.Ganjoor.GanjoorPoemFormat)poemFormat))
{
<option value="@poemFormat" selected>@RMuseum.Services.Implementation.GanjoorPoemFormatConvertor.GetString((RMuseum.Models.Ganjoor.GanjoorPoemFormat)poemFormat)</option>
}
else if (Model.PoemFormat == (RMuseum.Models.Ganjoor.GanjoorPoemFormat)poemFormat)
{
<option value="@poemFormat" selected>@RMuseum.Services.Implementation.GanjoorPoemFormatConvertor.GetString((RMuseum.Models.Ganjoor.GanjoorPoemFormat)poemFormat)</option>
}
else
{
<option value="@poemFormat">@RMuseum.Services.Implementation.GanjoorPoemFormatConvertor.GetString((RMuseum.Models.Ganjoor.GanjoorPoemFormat)poemFormat)</option>
}
}
</select>
</td>
</tr>
}

View File

@ -81,6 +81,11 @@ namespace GanjooRazor.Areas.User.Pages
public string RhymeLetters { get; set; }
/// <summary>
/// valid for whole poem sections
/// </summary>
public GanjoorPoemFormat? PoemFormat { get; set; }
/// <summary>
/// can edit
/// </summary>
@ -200,6 +205,11 @@ namespace GanjooRazor.Areas.User.Pages
}
}
if (PageInformation.Poem.Sections.Where(s => s.SectionType == PoemSectionType.WholePoem && s.PoemFormat != null).Any())
{
PoemFormat = PageInformation.Poem.Sections.Where(s => s.SectionType == PoemSectionType.WholePoem && s.PoemFormat != null).OrderBy(s => s.VerseType).First().PoemFormat;
}
if (PageInformation.Poem.Images.Where(i => i.IsTextOriginalSource).Any())
{
TextSourceImage = PageInformation.Poem.Images.Where(i => i.IsTextOriginalSource).First();
@ -283,7 +293,7 @@ namespace GanjooRazor.Areas.User.Pages
return new BadRequestObjectResult("لطفاً از گنجور خارج و مجددا به آن وارد شوید.");
}
public async Task<IActionResult> OnPostSendPoemCorrectionsAsync(int poemid, string[] verseOrderText, int[] verseOrderMarkedForDelete, VersePosition[] versePositions, string rhythm, string rhythm2, string rhyme, string[] verseOrderSummaries, int[] verseLanguages, string note, bool hideMyName)
public async Task<IActionResult> OnPostSendPoemCorrectionsAsync(int poemid, string[] verseOrderText, int[] verseOrderMarkedForDelete, VersePosition[] versePositions, string rhythm, string rhythm2, string rhyme, GanjoorPoemFormat? format, string[] verseOrderSummaries, int[] verseLanguages, string note, bool hideMyName)
{
using (HttpClient secureClient = new HttpClient())
{
@ -399,6 +409,7 @@ namespace GanjooRazor.Areas.User.Pages
Rhythm = rhythm,
Rhythm2 = rhythm2,
RhymeLetters = rhyme,
PoemFormat = format,
PoemSummary = poemSummary,
Note = note,
HideMyName = hideMyName