link for editing moderating sections

This commit is contained in:
Hamid Reza Mohammadi 2022-12-15 17:30:29 +03:30
parent fbac928a51
commit cbe93243e7
2 changed files with 21 additions and 5 deletions

View File

@ -9,6 +9,10 @@
<h1>@ViewData["Title"]</h1>
<a role="button" href="/Admin/ReviewPartEdits/?deletedUserSections=true" class="pagebutton">پیشنهادهای سیستمی</a>
@if (!string.IsNullOrEmpty(Model.FatalError))
{
<p>@Model.FatalError</p>
@ -342,9 +346,14 @@ else
</tr>
@if(Model.PoemSection != null)
{
<tr>
<td colspan="2">
<a role="button" href=@($"/User/Section?poemId={Model.PoemSection.PoemId}&index={Model.PoemSection.Index}") class="pagebutton" target="_blank">خودم ویرایش کنم</a>
</td>
</tr>
}
</table>
}

View File

@ -37,6 +37,11 @@ namespace GanjooRazor.Areas.Admin.Pages
/// </summary>
public int TotalCount { get; set; }
/// <summary>
/// deleted user sections
/// </summary>
public bool DeletedUserSections { get; set; }
public PoemRelatedImage TextSourceImage { get; set; }
/// <summary>
@ -91,11 +96,12 @@ namespace GanjooRazor.Areas.Admin.Pages
FatalError = "";
TotalCount = 0;
Skip = string.IsNullOrEmpty(Request.Query["skip"]) ? 0 : int.Parse(Request.Query["skip"]);
DeletedUserSections = string.IsNullOrEmpty(Request.Query["deletedUserSections"]) ? false : bool.Parse(Request.Query["deletedUserSections"]);
using (HttpClient secureClient = new HttpClient())
{
if (await GanjoorSessionChecker.PrepareClient(secureClient, Request, Response))
{
var nextResponse = await secureClient.GetAsync($"{APIRoot.Url}/api/ganjoor/section/correction/next?skip={Skip}");
var nextResponse = await secureClient.GetAsync($"{APIRoot.Url}/api/ganjoor/section/correction/next?skip={Skip}&deletedUserSections={DeletedUserSections}");
if (!nextResponse.IsSuccessStatusCode)
{
FatalError = JsonConvert.DeserializeObject<string>(await nextResponse.Content.ReadAsStringAsync());
@ -161,9 +167,10 @@ namespace GanjooRazor.Areas.Admin.Pages
public IActionResult OnPost()
{
Skip = string.IsNullOrEmpty(Request.Query["skip"]) ? 0 : int.Parse(Request.Query["skip"]);
DeletedUserSections = string.IsNullOrEmpty(Request.Query["deletedUserSections"]) ? false : bool.Parse(Request.Query["deletedUserSections"]);
if (Request.Form["next"].Count == 1)
{
return Redirect($"/Admin/ReviewPartEdits/?skip={Skip + 1}");
return Redirect($"/Admin/ReviewPartEdits/?skip={Skip + 1}&deletedUserSections={DeletedUserSections}");
}
return Page();
}