#467 ReviewCatEdits
This commit is contained in:
parent
08963054ee
commit
c6916743a3
118
GanjooRazor/Areas/Admin/Pages/ReviewCatEdits.cshtml
Normal file
118
GanjooRazor/Areas/Admin/Pages/ReviewCatEdits.cshtml
Normal file
@ -0,0 +1,118 @@
|
||||
@page
|
||||
@using DNTPersianUtils.Core
|
||||
@model GanjooRazor.Areas.Admin.Pages.ReviewCatEditsModel
|
||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||
@{
|
||||
Layout = "_AdminLayout";
|
||||
ViewData["Title"] = "ویرایشهای بخشها";
|
||||
}
|
||||
|
||||
@if (!string.IsNullOrEmpty(Model.FatalError))
|
||||
{
|
||||
<p>@Model.FatalError</p>
|
||||
return;
|
||||
}
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
پیشنهاد دهنده:
|
||||
</td>
|
||||
<td>
|
||||
<a href="/hashieha/?userid=@Model.Correction.UserId" target="_blank">@Model.Correction.UserNickname</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<a role="button" id="moderatecorrections" style="cursor:pointer;width:100%;color:white;background-color:green;display:block" onclick="moderateSectionCorrections(@Model.Correction.Id)">بررسی</a>
|
||||
</td>
|
||||
<td>
|
||||
<form method="post">
|
||||
<button type="submit" name="next" id="next" style="width:100%;color:white;background-color:orange">بعدی</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
زمان:
|
||||
</td>
|
||||
<td>
|
||||
@Model.Correction.Date.ToFriendlyPersianDateTextify()
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
تعداد کل:
|
||||
</td>
|
||||
<td>
|
||||
@Model.TotalCount
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan=2>
|
||||
<a role="button" onclick="notCorrect()" class="pagebutton">درست نیست</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
تغییرات متن
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p class="red-color" id="title-lastedit-original">@Model.Correction.OriginalDescription</p>
|
||||
</td>
|
||||
<td>
|
||||
<p class="green-color" id="title-lastedit-edited">@Model.Correction.Description</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<p id="title-lastedit-compare">@Model.Correction.OriginalDescription</p>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
compareCorrectionBlocks('title-lastedit-original', 'title-lastedit-edited', 'title-lastedit-compare');
|
||||
});
|
||||
</script>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td colspan="2"><p id="saving"> </p></td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@if (!string.IsNullOrEmpty(Model.Correction.Note))
|
||||
{
|
||||
<tr>
|
||||
<td>یادداشت:</td>
|
||||
<td>
|
||||
@Model.Correction.Note
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
<td>یادداشت بررسی:</td>
|
||||
<td><input type="text" id="review_note" name="review_note" value="" size="50" /></td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
|
||||
</table>
|
||||
93
GanjooRazor/Areas/Admin/Pages/ReviewCatEdits.cshtml.cs
Normal file
93
GanjooRazor/Areas/Admin/Pages/ReviewCatEdits.cshtml.cs
Normal file
@ -0,0 +1,93 @@
|
||||
using GanjooRazor.Utils;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using RMuseum.Models.Ganjoor.ViewModels;
|
||||
using RSecurityBackend.Models.Generic;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using System.Linq;
|
||||
|
||||
namespace GanjooRazor.Areas.Admin.Pages
|
||||
{
|
||||
[IgnoreAntiforgeryToken(Order = 1001)]
|
||||
public class ReviewCatEditsModel : PageModel
|
||||
{
|
||||
/// <summary>
|
||||
/// correction
|
||||
/// </summary>
|
||||
public GanjoorCatCorrectionViewModel Correction { get; set; }
|
||||
/// <summary>
|
||||
/// fatal error
|
||||
/// </summary>
|
||||
public string FatalError { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// skip
|
||||
/// </summary>
|
||||
public int Skip { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// total count
|
||||
/// </summary>
|
||||
public int TotalCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// page
|
||||
/// </summary>
|
||||
public GanjoorPageCompleteViewModel PageInformation { get; set; }
|
||||
public async Task<IActionResult> OnGetAsync()
|
||||
{
|
||||
if (string.IsNullOrEmpty(Request.Cookies["Token"]))
|
||||
return Redirect("/");
|
||||
|
||||
FatalError = "";
|
||||
TotalCount = 0;
|
||||
Skip = string.IsNullOrEmpty(Request.Query["skip"]) ? 0 : int.Parse(Request.Query["skip"]);
|
||||
using (HttpClient secureClient = new HttpClient())
|
||||
{
|
||||
if (await GanjoorSessionChecker.PrepareClient(secureClient, Request, Response))
|
||||
{
|
||||
var nextResponse = await secureClient.GetAsync($"{APIRoot.Url}/api/ganjoor/cat/correction/next?skip={Skip}");
|
||||
if (!nextResponse.IsSuccessStatusCode)
|
||||
{
|
||||
FatalError = JsonConvert.DeserializeObject<string>(await nextResponse.Content.ReadAsStringAsync());
|
||||
return Page();
|
||||
}
|
||||
|
||||
string paginnationMetadata = nextResponse.Headers.GetValues("paging-headers").FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(paginnationMetadata))
|
||||
{
|
||||
TotalCount = JsonConvert.DeserializeObject<PaginationMetadata>(paginnationMetadata).totalCount;
|
||||
}
|
||||
Correction = JsonConvert.DeserializeObject<GanjoorCatCorrectionViewModel>(await nextResponse.Content.ReadAsStringAsync());
|
||||
if (Correction != null)
|
||||
{
|
||||
var catQuery = await secureClient.GetAsync($"{APIRoot.Url}/api/ganjoor/cat/{Correction.CatId}");
|
||||
if (!catQuery.IsSuccessStatusCode)
|
||||
{
|
||||
FatalError = JsonConvert.DeserializeObject<string>(await catQuery.Content.ReadAsStringAsync());
|
||||
return Page();
|
||||
}
|
||||
var cat = JsonConvert.DeserializeObject<GanjoorPoetCompleteViewModel>(await catQuery.Content.ReadAsStringAsync());
|
||||
var pageQuery = await secureClient.GetAsync($"{APIRoot.Url}/api/ganjoor/page?url={cat.Cat.FullUrl}");
|
||||
if (!pageQuery.IsSuccessStatusCode)
|
||||
{
|
||||
FatalError = JsonConvert.DeserializeObject<string>(await pageQuery.Content.ReadAsStringAsync());
|
||||
return Page();
|
||||
}
|
||||
PageInformation = JObject.Parse(await pageQuery.Content.ReadAsStringAsync()).ToObject<GanjoorPageCompleteViewModel>();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalError = "لطفاً از گنجور خارج و مجددا به آن وارد شوید.";
|
||||
}
|
||||
}
|
||||
return Page();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -445,6 +445,13 @@
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="navbar-collapse collapse d-sm-inline-flex justify-content-between">
|
||||
<ul class="navbar-nav flex-grow-1">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="Admin" asp-page="ReviewCatEdits">ویرایشهای زندگینامهها</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="navbar-collapse collapse d-sm-inline-flex justify-content-between">
|
||||
<ul class="navbar-nav flex-grow-1">
|
||||
<li class="nav-item">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user