#284 adding UI
This commit is contained in:
parent
0524748e6a
commit
50610cfc04
@ -42,6 +42,13 @@ else
|
||||
<td colspan="3"><a href="/?p=@correction.PoemId" target="_blank">مشاهدهٔ متن شعر یا بخش</a></td>
|
||||
</tr>
|
||||
|
||||
@if(Model.AllUsersEdits)
|
||||
{
|
||||
<tr>
|
||||
<td colspan="3"><a href="/hashieha/?userid=@correction.UserId" target="_blank">@correction.UserNickname</a></td>
|
||||
</tr>
|
||||
}
|
||||
|
||||
<tr>
|
||||
<td>متن اولیه</td>
|
||||
<td>تغییرات من</td>
|
||||
@ -63,7 +70,7 @@ else
|
||||
<p style="color:blue">@CorrectionReviewResultConvertor.GetString(correction.Result)</p>
|
||||
}
|
||||
else
|
||||
@if (correction.Result == CorrectionReviewResult.Approved)
|
||||
@if (correction.Result == CorrectionReviewResult.Approved)
|
||||
{
|
||||
<p style="color:green">@CorrectionReviewResultConvertor.GetString(correction.Result)</p>
|
||||
}
|
||||
@ -97,7 +104,7 @@ else
|
||||
<p style="color:blue">@CorrectionReviewResultConvertor.GetString(correction.RhythmResult)</p>
|
||||
}
|
||||
else
|
||||
@if (correction.RhythmResult == CorrectionReviewResult.Approved)
|
||||
@if (correction.RhythmResult == CorrectionReviewResult.Approved)
|
||||
{
|
||||
<p style="color:green">@CorrectionReviewResultConvertor.GetString(correction.RhythmResult)</p>
|
||||
}
|
||||
@ -132,7 +139,7 @@ else
|
||||
<p style="color:blue">@CorrectionReviewResultConvertor.GetString(verse.Result)</p>
|
||||
}
|
||||
else
|
||||
@if (verse.Result == CorrectionReviewResult.Approved)
|
||||
if (verse.Result == CorrectionReviewResult.Approved)
|
||||
{
|
||||
<p style="color:green">@CorrectionReviewResultConvertor.GetString(verse.Result)</p>
|
||||
}
|
||||
@ -197,4 +204,14 @@ else
|
||||
</p>
|
||||
|
||||
|
||||
if (@Model.CanEdit)
|
||||
{
|
||||
<div class="clear-both">
|
||||
<p>
|
||||
<a role="button" href="/User/Edits?AllUsers=1" class="pagebutton">همهٔ ویرایشها</a>
|
||||
</p>
|
||||
</div>
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -27,6 +27,16 @@ namespace GanjooRazor.Areas.User.Pages
|
||||
/// </summary>
|
||||
public List<NameIdUrlImage> PaginationLinks { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// can edit
|
||||
/// </summary>
|
||||
public bool CanEdit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// all users edits
|
||||
/// </summary>
|
||||
public bool AllUsersEdits { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Corrections
|
||||
/// </summary>
|
||||
@ -35,18 +45,28 @@ namespace GanjooRazor.Areas.User.Pages
|
||||
{
|
||||
if (string.IsNullOrEmpty(Request.Cookies["Token"]))
|
||||
return Redirect("/");
|
||||
|
||||
CanEdit = Request.Cookies["CanEdit"] == "True";
|
||||
AllUsersEdits = false;
|
||||
LastError = "";
|
||||
using (HttpClient secureClient = new HttpClient())
|
||||
if (await GanjoorSessionChecker.PrepareClient(secureClient, Request, Response))
|
||||
{
|
||||
{
|
||||
int pageNumber = 1;
|
||||
string url = $"{APIRoot.Url}/api/ganjoor/corrections/mine?PageNumber={pageNumber}&PageSize=20";
|
||||
if (!string.IsNullOrEmpty(Request.Query["page"]))
|
||||
{
|
||||
pageNumber = int.Parse(Request.Query["page"]);
|
||||
}
|
||||
var response = await secureClient.GetAsync($"{APIRoot.Url}/api/ganjoor/corrections/mine?PageNumber={pageNumber}&PageSize=20");
|
||||
if (CanEdit)
|
||||
{
|
||||
AllUsersEdits = Request.Query["AllUsers"] == "1";
|
||||
if (AllUsersEdits)
|
||||
{
|
||||
url = $"{APIRoot.Url}/api/ganjoor/corrections/all?PageNumber={pageNumber}&PageSize=20";
|
||||
}
|
||||
}
|
||||
var response = await secureClient.GetAsync(url);
|
||||
if (!response.IsSuccessStatusCode)
|
||||
{
|
||||
LastError = JsonConvert.DeserializeObject<string>(await response.Content.ReadAsStringAsync());
|
||||
@ -69,7 +89,7 @@ namespace GanjooRazor.Areas.User.Pages
|
||||
new NameIdUrlImage()
|
||||
{
|
||||
Name = "صفحهٔ اول",
|
||||
Url = "/User/Edits/?page=1"
|
||||
Url = AllUsersEdits ? "/User/Edits/?page=1&AllUsers=1" : "/User/Edits/?page=1"
|
||||
}
|
||||
);
|
||||
}
|
||||
@ -96,7 +116,7 @@ namespace GanjooRazor.Areas.User.Pages
|
||||
new NameIdUrlImage()
|
||||
{
|
||||
Name = i.ToPersianNumbers(),
|
||||
Url = $"/User/Edits/?page={i}"
|
||||
Url = AllUsersEdits ? $"/User/Edits/?page={i}&AllUsers=1" : $"/User/Edits/?page={i}"
|
||||
}
|
||||
);
|
||||
}
|
||||
@ -118,7 +138,7 @@ namespace GanjooRazor.Areas.User.Pages
|
||||
new NameIdUrlImage()
|
||||
{
|
||||
Name = "صفحهٔ آخر",
|
||||
Url = $"/User/Edits/?page={paginationMetadata.totalPages}"
|
||||
Url = AllUsersEdits ? $"/User/Edits/?page={paginationMetadata.totalPages}&AllUsers=1" : $"/User/Edits/?page={paginationMetadata.totalPages}"
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user