UI for displaying only user corrections

This commit is contained in:
Hamid Reza Mohammadi 2022-12-11 09:25:31 +03:30
parent c1a78f0f33
commit 8acab747c8
2 changed files with 12 additions and 2 deletions

View File

@ -191,6 +191,12 @@ else
</td>
</tr>
<tr>
<td colspan=2>
<a role="button" href="/Admin/ReviewEdits/?onlyUserCorrections=false" class="pagebutton">پیشنهادهای سیستمی</a>
</td>
</tr>
<tr>
<td colspan="2"><p id="saving">&nbsp;</p></td>
</tr>

View File

@ -38,6 +38,8 @@ namespace GanjooRazor.Areas.Admin.Pages
public PoemRelatedImage TextSourceImage { get; set; }
public bool OnlyUserCorrections { get; set; }
/// <summary>
/// page
/// </summary>
@ -57,11 +59,12 @@ namespace GanjooRazor.Areas.Admin.Pages
FatalError = "";
TotalCount = 0;
Skip = string.IsNullOrEmpty(Request.Query["skip"]) ? 0 : int.Parse(Request.Query["skip"]);
OnlyUserCorrections = string.IsNullOrEmpty(Request.Query["onlyUserCorrections"]) ? true : bool.Parse(Request.Query["onlyUserCorrections"]);
using (HttpClient secureClient = new HttpClient())
{
if (await GanjoorSessionChecker.PrepareClient(secureClient, Request, Response))
{
var nextResponse = await secureClient.GetAsync($"{APIRoot.Url}/api/ganjoor/poem/correction/next?skip={Skip}");
var nextResponse = await secureClient.GetAsync($"{APIRoot.Url}/api/ganjoor/poem/correction/next?skip={Skip}&onlyUserCorrections={OnlyUserCorrections}");
if (!nextResponse.IsSuccessStatusCode)
{
FatalError = JsonConvert.DeserializeObject<string>(await nextResponse.Content.ReadAsStringAsync());
@ -165,9 +168,10 @@ namespace GanjooRazor.Areas.Admin.Pages
public IActionResult OnPost()
{
Skip = string.IsNullOrEmpty(Request.Query["skip"]) ? 0 : int.Parse(Request.Query["skip"]);
OnlyUserCorrections = string.IsNullOrEmpty(Request.Query["onlyUserCorrections"]) ? true : bool.Parse(Request.Query["onlyUserCorrections"]);
if (Request.Form["next"].Count == 1)
{
return Redirect($"/Admin/ReviewEdits/?skip={Skip + 1}");
return Redirect($"/Admin/ReviewEdits/?skip={Skip + 1}&onlyUserCorrections={OnlyUserCorrections}");
}
return Page();
}