#231 fixed
This commit is contained in:
parent
1710634751
commit
dd60a78d4e
@ -143,7 +143,7 @@
|
||||
</p>
|
||||
|
||||
<script src="~/lib/jquery/dist/jquery.min.js"></script>
|
||||
<script src="~/js/bk.js?version=7"></script>
|
||||
<script src="~/js/bk.js?version=8"></script>
|
||||
<script src="~/js/vaabd.js"></script>
|
||||
<script src="~/dist/jplayer/jquery.jplayer.min.js"></script>
|
||||
<script src="~/dist/add-on/jplayer.playlist.min.js"></script>
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
<script>
|
||||
var playerScrollLock = false;
|
||||
</script>
|
||||
<script src="/js/bk.js?version=7"></script>
|
||||
<script src="/js/bk.js?version=8"></script>
|
||||
|
||||
@if (Model.IsHomePage)
|
||||
{
|
||||
|
||||
@ -478,6 +478,21 @@ namespace GanjooRazor.Pages
|
||||
Poets = poets;
|
||||
}
|
||||
|
||||
public async Task<IActionResult> OnGetPoetInformationAsync(int id)
|
||||
{
|
||||
if (id == 0)
|
||||
return new OkObjectResult(null);
|
||||
var cacheKey = $"/api/ganjoor/poet/{id}";
|
||||
if (!_memoryCache.TryGetValue(cacheKey, out GanjoorPoetCompleteViewModel poet))
|
||||
{
|
||||
var poetResponse = await _httpClient.GetAsync($"{APIRoot.Url}/api/ganjoor/poet/{id}");
|
||||
poetResponse.EnsureSuccessStatusCode();
|
||||
poet = JObject.Parse(await poetResponse.Content.ReadAsStringAsync()).ToObject<GanjoorPoetCompleteViewModel>();
|
||||
_memoryCache.Set(cacheKey, poet);
|
||||
}
|
||||
return new OkObjectResult(poet);
|
||||
}
|
||||
|
||||
private async Task _PreparePoetGroups()
|
||||
{
|
||||
var response = await _httpClient.GetAsync($"{APIRoot.Url}/api/ganjoor/centuries");
|
||||
|
||||
@ -22,22 +22,21 @@
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="hdr2" class="clearfix">
|
||||
<h1><a href="/" title="گنجور"><img src="/image/ganjadabk.gif" alt="گنجور" /></a></h1>
|
||||
<div class="actionbox">
|
||||
<form action="/search" method="get" id="searchform">
|
||||
<input type="text" name="s" id="s" class="inputText" value="@Model.Query" placeholder="جستجو" />
|
||||
<select name="author" id="author">
|
||||
<select name="author" id="author" onchange="onSelectedPoetChanged()">
|
||||
|
||||
@{
|
||||
if (Model.PoetId != 0)
|
||||
{
|
||||
<option value="0">در آثار همه شاعران</option>
|
||||
<option value="0">در آثار همهٔ شاعران</option>
|
||||
}
|
||||
else
|
||||
{
|
||||
<option value="0" selected>در آثار همه شاعران</option>
|
||||
<option value="0" selected>در آثار همهٔ شاعران</option>
|
||||
}
|
||||
|
||||
if (Model.Poets != null)
|
||||
@ -63,11 +62,11 @@
|
||||
<select name="cat" id="cat" style="width:150px">
|
||||
@if (Model.CatId == 0)
|
||||
{
|
||||
<option value="0" selected>در همه بخشها</option>
|
||||
<option value="0" selected>در همهٔ بخشها</option>
|
||||
}
|
||||
else
|
||||
{
|
||||
<option value="0">در همه بخشها</option>
|
||||
<option value="0">در همهٔ بخشها</option>
|
||||
}
|
||||
|
||||
@{
|
||||
@ -181,7 +180,7 @@
|
||||
</div>
|
||||
|
||||
<script src="/lib/jquery/dist/jquery.min.js"></script>
|
||||
<script src="/js/bk.js?version=7"></script>
|
||||
<script src="/js/bk.js?version=8"></script>
|
||||
<script src="/js/vaabd.js"></script>
|
||||
|
||||
@if (!string.IsNullOrEmpty(ViewData["GoogleAnalyticsCode"].ToString()))
|
||||
|
||||
@ -102,6 +102,21 @@ namespace GanjooRazor.Pages
|
||||
Poet = poet;
|
||||
}
|
||||
|
||||
public async Task<IActionResult> OnGetPoetInformationAsync(int id)
|
||||
{
|
||||
if(id == 0)
|
||||
return new OkObjectResult(null);
|
||||
var cacheKey = $"/api/ganjoor/poet/{id}";
|
||||
if (!_memoryCache.TryGetValue(cacheKey, out GanjoorPoetCompleteViewModel poet))
|
||||
{
|
||||
var poetResponse = await _httpClient.GetAsync($"{APIRoot.Url}/api/ganjoor/poet/{id}");
|
||||
poetResponse.EnsureSuccessStatusCode();
|
||||
poet = JObject.Parse(await poetResponse.Content.ReadAsStringAsync()).ToObject<GanjoorPoetCompleteViewModel>();
|
||||
_memoryCache.Set(cacheKey, poet);
|
||||
}
|
||||
return new OkObjectResult(poet);
|
||||
}
|
||||
|
||||
public async Task<IActionResult> OnGetAsync()
|
||||
{
|
||||
LoggedIn = !string.IsNullOrEmpty(Request.Cookies["Token"]);
|
||||
|
||||
@ -6,16 +6,16 @@
|
||||
<div class="actionbox">
|
||||
<form action="/search" method="get" id="searchform">
|
||||
<input type="text" name="s" id="s" class="inputText" value="" placeholder="جستجو" />
|
||||
<select name="author" id="author">
|
||||
<select name="author" id="author" onchange="onSelectedPoetChanged()">
|
||||
|
||||
@{
|
||||
if (Model.GanjoorPage != null && Model.GanjoorPage.PoetOrCat != null)
|
||||
{
|
||||
<option value="0">در آثار همه شاعران</option>
|
||||
<option value="0">در آثار همهٔ شاعران</option>
|
||||
}
|
||||
else
|
||||
{
|
||||
<option value="0" selected>در آثار همه شاعران</option>
|
||||
<option value="0" selected>در آثار همهٔ شاعران</option>
|
||||
}
|
||||
|
||||
if (Model.Poets != null)
|
||||
@ -39,7 +39,7 @@
|
||||
if (!Model.IsPoetPage && Model.GanjoorPage != null && Model.GanjoorPage.PoetOrCat != null)
|
||||
{
|
||||
<select name="cat" id="cat" style="width:150px">
|
||||
<option value="0">در همه بخشها</option>
|
||||
<option value="0">در همهٔ بخشها</option>
|
||||
@{
|
||||
foreach (var gran in Model.GanjoorPage.PoetOrCat.Cat.Ancestors)
|
||||
{
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
<form action="/search" method="get" id="searchhorm">
|
||||
<input type="text" name="s" id="s" placeholder="جستجو" class="inputText" size="35" value="" />
|
||||
<select name="author" id="author">
|
||||
<option value="0" selected>در آثار همه شاعران</option>
|
||||
<option value="0" selected>در آثار همهٔ شاعران</option>
|
||||
@{
|
||||
foreach (RMuseum.Models.Ganjoor.ViewModels.GanjoorPoetViewModel poet in Model.Poets)
|
||||
{
|
||||
|
||||
@ -819,4 +819,37 @@ function copyCommentUrl(commentId, divSuffix) {
|
||||
navigator.clipboard.writeText(url);
|
||||
var tooltip = document.getElementById("copycommentlink-tooltip-" + String(commentId) + divSuffix);
|
||||
tooltip.innerHTML = "نشانی در حافظه رونوشت شد: " + url;
|
||||
}
|
||||
|
||||
function onSelectedPoetChanged() {
|
||||
if (document.getElementById('cat') != null) {
|
||||
var id = document.getElementById('author').value;
|
||||
if (id == 0) return;
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: '?handler=PoetInformation',
|
||||
data: {
|
||||
id: id
|
||||
},
|
||||
success: function (poet) {
|
||||
if (poet == null)
|
||||
return;
|
||||
var select = document.getElementById("cat");
|
||||
var length = select.options.length;
|
||||
for (var i = length - 1; i >= 0; i--) {
|
||||
select.options[i] = null;
|
||||
}
|
||||
option = document.createElement('option');
|
||||
option.setAttribute('value', 0);
|
||||
option.appendChild(document.createTextNode('در همهٔ بخشها'));
|
||||
select.appendChild(option);
|
||||
for (var i = 0; i < poet.cat.children.length; i++) {
|
||||
option = document.createElement('option');
|
||||
option.setAttribute('value', poet.cat.children[i].id);
|
||||
option.appendChild(document.createTextNode(poet.cat.children[i].title));
|
||||
select.appendChild(option);
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user