80 lines
3.0 KiB
HTML
80 lines
3.0 KiB
HTML
|
|
[viewBag]
|
||
|
|
==
|
||
|
|
{% put scripts %}
|
||
|
|
<script>
|
||
|
|
getPosts('{{query}}');
|
||
|
|
// console.log("qqq");
|
||
|
|
function getPosts(query, limit) {
|
||
|
|
//console.log(query.html());
|
||
|
|
var converted = query.replaceAll('&', '&');
|
||
|
|
$(document).ready(function () {
|
||
|
|
$.ajax({
|
||
|
|
url: `https://orient.tm/{{activeLocale}}/api/posts?`+converted,
|
||
|
|
type: 'GET',
|
||
|
|
dataType: 'json',
|
||
|
|
success: function (data, textStatus, xhr) {
|
||
|
|
|
||
|
|
var posts = data.data.data;
|
||
|
|
|
||
|
|
|
||
|
|
$('#{{id}}').append(`
|
||
|
|
|
||
|
|
<a href="/post/`+posts[0].id+`/`+posts[0].slug+`" class="main-news-lead">
|
||
|
|
<div class="main-news-bg">
|
||
|
|
<img src="`+posts[0].main_image+`" alt="{{posts[0].title}}" />
|
||
|
|
</div>
|
||
|
|
<div class="main-news-overlay"></div>
|
||
|
|
<div class="main-news-info">
|
||
|
|
<div class="main-news-info-title">
|
||
|
|
<h3> `+posts[0].categories[0].name+`</h3>
|
||
|
|
<span>|</span>
|
||
|
|
<h4>`+posts[0].published_at+`</h4>
|
||
|
|
<span>|</span>
|
||
|
|
<h4>`+posts[0].published_at+`</h4>
|
||
|
|
</div>
|
||
|
|
<p class="main-news-info-content">
|
||
|
|
`+posts[0].title+`
|
||
|
|
</p>
|
||
|
|
</div>
|
||
|
|
</a>
|
||
|
|
|
||
|
|
<div class="main-news-min" id="featured_small">
|
||
|
|
</div>
|
||
|
|
`);
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
var i = 1;
|
||
|
|
for (var post of posts) {
|
||
|
|
console.log(post);
|
||
|
|
$('#featured_small').append(`
|
||
|
|
|
||
|
|
|
||
|
|
<a href="/post/`+posts[i].id+`/`+posts[i].slug+`" class="main-news-min-item">
|
||
|
|
<div class="main-news-min-bg">
|
||
|
|
<img src="`+posts[i].main_image+`" alt="{{posts[i].title}}" />
|
||
|
|
<div class="main-news-overlay"></div>
|
||
|
|
<p class="main-news-min-info">
|
||
|
|
`+posts[i].title+`
|
||
|
|
</p>
|
||
|
|
</div>
|
||
|
|
</a>
|
||
|
|
|
||
|
|
`);
|
||
|
|
|
||
|
|
i++;
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
},
|
||
|
|
error: function (xhr, textStatus, errorThrown) {
|
||
|
|
console.log('Error in Operation');
|
||
|
|
}
|
||
|
|
});
|
||
|
|
});
|
||
|
|
}
|
||
|
|
</script>
|
||
|
|
|
||
|
|
{% endput %}
|