restoring transileration utilities

This commit is contained in:
Hamid Reza Mohammadi 2023-09-17 19:29:05 +03:30
parent 0b15775ef6
commit e88f66fc5b
4 changed files with 28 additions and 2 deletions

View File

@ -296,6 +296,8 @@ namespace GanjooRazor.Pages
/// </summary>
public bool KeepHistory { get; set; }
/// <summary>
/// pinterest url
/// </summary>
@ -635,6 +637,7 @@ namespace GanjooRazor.Pages
LoggedIn = !string.IsNullOrEmpty(Request.Cookies["Token"]);
CanEdit = Request.Cookies["CanEdit"] == "True";
KeepHistory = Request.Cookies["KeepHistory"] == "True";
CanTranslate = Request.Cookies["CanTranslate"] == "True";
IsPoetPage = false;
IsCatPage = false;
IsPoemPage = false;

View File

@ -44,6 +44,8 @@ namespace GanjooRazor.Pages
public string PreviousTitle { get; set; }
public bool CanTranslate { get; set; }
public List<GanjoorPoemSection> SectionsWithRelated { get; set; }
public List<GanjoorPoemSection> SectionsWithMetreAndRhymes { get; set; }
@ -81,7 +83,7 @@ namespace GanjooRazor.Pages
{
Expires = DateTime.Now.AddDays(-1)
};
foreach (var cookieName in new string[] { "UserId", "SessionId", "Token", "Username", "Name", "NickName", "CanEdit", "KeepHistory" })
foreach (var cookieName in new string[] { "UserId", "SessionId", "Token", "Username", "Name", "NickName", "CanEdit", "KeepHistory", "CanTranslate" })
{
if (Request.Cookies[cookieName] != null)
{
@ -144,6 +146,17 @@ namespace GanjooRazor.Pages
Response.Cookies.Append("CanEdit", canEditContent.ToString(), cookieOption);
bool canTranlate = false;
if (ganjoorEntity != null)
{
var op = ganjoorEntity.Operations.Where(o => o.ShortName == RMuseumSecurableItem.Translations).SingleOrDefault();
if (op != null)
{
canTranlate = op.Status;
}
}
Response.Cookies.Append("CanTranslate", canTranlate.ToString(), cookieOption);
return Redirect(Request.Path);
}

View File

@ -110,7 +110,7 @@
@if (Model.CanTranslate)
{
<a role="button" target="_blank" style="text-decoration: none; cursor: pointer; width: 100%; color: white; background-color: #300; display: block; text-align: center; border-color: #300 " href="/User/Translate?id=@Model.PoemId">من ترجمه کنم</a>
<a role="button" target="_blank" style="text-decoration: none; cursor: pointer; width: 100%; color: white; background-color: #300; display: block; text-align: center; border-color: #300 " href="/User/Translate?id=@Model.PoemId&lang=@Model.LanguageId">من ترجمه کنم</a>
}
}

View File

@ -201,6 +201,16 @@
<span class="w3tooltiptext">بعدی</span>
</a>
}
@if (Model.CanTranslate)
{
<a href="/Trans?p=@Model.GanjoorPage.Id&lang=8" role="button" class="w3tooltip cursor-pointer">
<div class="circled-number">
<i class="noindent-info-button translate-button"></i>
</div>
<span class="w3tooltiptext">واج‌نویسی</span>
</a>
}
</div>
}