{#
comment - dict
#}

<div class="comment comment-state-{{ comment.state }}">
    <div class="comment-heading">
        <div class="comment-authored">
            <div class="author-avatar">
                {{ h.user_image(comment.author.name, size=26) }}
            </div>

            <div class="comment-meta">
                <div class="author-name">
                    {{ comment.author.fullname or comment.author.name }}
                </div>
                <div class="comment-date">
                    {{ h.time_ago_from_timestamp(comment.modified_at or comment.created_at) }}
                </div>
            </div>
        </div>
        <div class="comment-actions">
            {% if h.check_access('comments_reply_create', {reply_to_id: comment.id}) %}
                <button title="{{ _('Reply') }}" class="btn btn-default comment-action reply-to-comment" data-id="{{ comment.id }}">
                    <i class="fa fa-mail-reply"></i>
                    <span class="text">{{ _('Reply') }}</span>
                </button>
            {% endif %}

            {% if not comment.approved and h.check_access('comments_comment_approve', {id: comment.id}) %}
                <button title="{{ _('Approve') }}" class="btn btn-success comment-action approve-comment" data-id="{{ comment.id }}">
                    <i class="fa fa-check"></i>
                    <span class="text">{{ _('Approve') }}</span>
                </button>
            {% endif %}
            {% if h.check_access('comments_comment_update', comment) %}
                <button title="{{ _('Edit') }}" class="btn btn-default comment-action edit-comment" data-id="{{ comment.id }}">
                    <i class="fa fa-edit"></i>
                    <span class="text">{{ _('Edit') }}</span>
                </button>
                <button title="{{ _('Save') }}" class="btn btn-default comment-action save-comment hidden" data-id="{{ comment.id }}">
                    <i class="fa fa-edit"></i>
                    <span class="text">{{ _('Save') }}</span>
                </button>
            {% endif %}

            {% if h.check_access('comments_comment_delete', comment) %}
                <button type="button" class="btn btn-remove comment-action" data-toggle="modal" data-target="#confirmation-modal">
                    <i class="fa fa-trash-o"></i>
                    <span class="text">{{ _('Remove') }}</span>
                </button>
                {% snippet 'comments/snippets/confirmation.html', comment_id=comment.id %}
            {% endif %}
        </div>
    </div>
    <div class="comment-body">
        <div class="comment-content">
            {{- (comment.content)|replace('\n', '\n<br/>'|safe) -}}
        </div>
    </div>
    <div class="comment-footer">

    </div>
</div>
