{% extends 'manage/news/master.twig' %}
{% from 'macros.twig' import pagination, container_title %}

{% block manage_content %}
    <div class="container">
        {{ container_title('News Posts') }}

        <a href="{{ url('manage-news-post') }}" class="input__button">New Post</a>

        {% for post in news_posts %}
            <p>
                <a href="{{ url('manage-news-post', {'post': post.id}) }}" class="input__button">#{{ post.id }}</a>
                <a href="{{ url('manage-news-category', {'category': post.categoryId}) }}" class="input__button">Category #{{ post.categoryId }}</a>
                {{ post.title }} |
                {{ post.isFeatured ? 'Featured' : 'Normal' }} |
                User #{{ post.userId }} |
                {% if post.hasCommentsCategoryId %}Comments category #{{ post.commentsCategoryId }}{% else %}No comments category{% endif %} |
                Created {{ post.createdAt }} |
                {{ post.isPublished ? 'published' : 'Published ' ~ post.scheduledAt }} |
                {{ post.isEdited ? 'Edited ' ~ post.updatedAt : 'not edited' }} |
                {{ post.isDeleted ? 'Deleted ' ~ post.deletedAt : 'not deleted' }}
            </p>
        {% endfor %}

        {{ pagination(posts_pagination, 'manage-news-posts') }}
    </div>
{% endblock %}
