This repository has been archived on 2024-06-26. You can view files and clone it, but cannot push or open issues or pull requests.
sakura/templates/yuuno/main/news.twig

57 lines
2.1 KiB
Twig
Raw Normal View History

2016-01-04 20:14:09 +00:00
{% extends 'global/master.twig' %}
{% set newsPosts = viewPost and postExists ? [news.posts[postExists]] : news.posts|batch(postsPerPage)[get.page|default(1) - 1] %}
{% if viewPost and postExists %}
{% set commentsCategory = 'news-' ~ newsPosts[0].news_category ~ '-' ~ newsPosts[0].news_id %}
{% set comments = newsPosts[0].news_comments.comments %}
{% else %}
{% set paginationPages = news.posts|batch(postsPerPage) %}
2016-03-19 15:29:47 +00:00
{% set paginationUrl %}{{ route('news.index') }}{% endset %}
{% endif %}
{% set title %}
{% if not (viewPost ? postExists : newsPosts|length) %}Post does not exist!{% elseif viewPost and postExists %}{{ newsPosts[0].news_title }}{% else %}News{% endif %}
{% endset %}
{% block title %}{{ title }}{% endblock %}
{% block css %}
<style type="text/css">
.pagination {
float: right;
}
</style>
{% endblock %}
{% block content %}
2015-04-02 13:41:05 +00:00
<div class="content">
<div class="content-column news">
2015-12-29 21:52:19 +00:00
<div class="head">{{ title }}</div>
{% if (viewPost ? postExists : newsPosts|length) %}
{% for post in newsPosts %}
2016-01-04 20:14:09 +00:00
{% include 'elements/newsPost.twig' %}
{% if viewPost and postExists %}
2016-01-04 20:14:09 +00:00
{% include 'elements/comments.twig' %}
{% endif %}
{% endfor %}
{% if not (viewPost and postExists) and news.posts|batch(postsPerPage)|length > 1 %}
2015-07-31 21:18:14 +00:00
<div>
2016-01-04 20:14:09 +00:00
{% include 'elements/pagination.twig' %}
2015-07-31 21:18:14 +00:00
<div class="clear"></div>
</div>
{% endif %}
2015-04-06 19:51:26 +00:00
{% else %}
<div style="padding: 20px;">
<h1>The requested news post does not exist!</h1>
There are a few possible reasons for this;
<ul style="margin-left: 30px;">
<li>The post may have been deleted due to irrelevancy.</li>
<li>The post never existed.</li>
</ul>
</div>
{% endif %}
2015-04-02 13:41:05 +00:00
</div>
</div>
{% endblock %}