{% macro list(comments, children_class = '') %}
    {% import _self as macros %}
    <ul class="comment-list {{ children_class }}">
        {% for comment in comments %}
            <li class="comment" id="comment-{{ comment.id }}" data-id="{{ comment.id }}">
                <div class="comment-body">
                    <div class="comment-author">
                        <img src="{{ asset(comment.avatar) }}" class="comment-author-avatar" alt="">
                        <span class="comment-author-name">{{ comment.name }}</span> <span class="comment-author-says">napisał(a):</span>
                    </div>
                    <div class="comment-meta">
                        <a href="{{ path('wi_front_news_show', { 'id': comment.news.id, 'slug': slugify(comment.news.title), '_fragment': 'comment-' ~ comment.id }) }}">
                            {{ macros.date(comment.dateCreated) }}
                        </a>
                    </div>
                    <p>{{ comment.content|nl2br }}</p>
                    <div class="comment-like-dislike-wrap"></div>
                    <div class="reply">
                        <a rel="nofollow" class="comment-reply-link">Odpowiedz</a>
                    </div>
                </div>

                {% if comment.children is not empty %}
                    {{ macros.list(comment.children, 'children') }}
                {% endif %}
            </li>
        {% endfor %}
    </ul>
{% endmacro %}

{% macro date(commentDate) %}
    {% set diff = date("now").diff(date(commentDate)) %}
    {% if diff.days < 2 %}
        {% if diff.days < 1 %}
            {% if diff.h < 1 %}
                {% set count = diff.i %}
                {% transchoice count %}{0} mniej niż minutę temu|{1} minutę temu|{2,3,4,22,23,24,32,33,34,42,43,44,52,53,54} %count% minuty temu |{5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,25,26,27,28,29,30,31,35,36,37,38,39,40,41,45,46,47,48,49,50,51,55,56,57,58,59} %count% minut temu{% endtranschoice %}
            {% else %}
                {% set count = diff.h %}
                {% transchoice count %}{0} |{1} godzinę temu|{2,3,4,22,23} %count% godziny temu |{5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21} %count% godzin temu{% endtranschoice %}
            {% endif %}
        {% else %}
            wczoraj
        {% endif %}
    {% elseif diff.days >= 2 %}
        {{ commentDate|date('d.m.Y') }}
    {% endif %}
{% endmacro %}

{% import _self as commentMacro %}
<div id="comment-block">
    {{ commentMacro.list(comments) }}
</div>
