home ยป zplus/freepost.git
ID: 6b40fbc26c68bc2986991a394c57b4d6c161fefc
40 lines โ€” 1K โ€” View raw


{% if comments[parent_id] %}
    {% for comment in comments[parent_id] %}
        
        <div class="comment" style="padding-left:{{ depth * 2 }}em">
            {# Add an anchor link for this comment #}
            <a id="comment-{{ comment.hashId }}"></a>
            
            <div class="info">
                {# Username #}
                <span class="username {{ post.userId == comment.userId ? 'op' }}">
                    <a href="{{ ('user/' ~ comment.username)|docroot }}">{{ comment.username }}</a>
                </span>
                
                {# DateTime #}
                <a href="{{ ('post/' ~ post.hashId ~ '#comment-' ~ comment.hashId)|docroot }}"><em>{{ comment.created|ago }}</em></a>
                
                โ€”
                
                {# Reply #}
                <a href="../reply?comment={{ comment.hashId }}">Reply</a>
                
                {# Edit #}
                {% if user and comment.userId == user.id %}
                    <a href="../edit?comment={{ comment.hashId }}">Edit</a>
                {% endif %}
            </div>
            
            {{ comment.text|markdown|raw }}
        </div>
        
        {# Add replies #}
        
        {% include 'comment.twig' with {
            'post': post,
            'comments': comments,
            'parent_id': comment.id,
            'depth': depth + 1
        } %}
        
    {% endfor %}
{% endif %}