ejplatform/ej-server

View on GitHub
src/ej_conversations/jinja2/ej/role/comment-card.jinja2

Summary

Maintainability
Test Coverage
<div class="comment-card">
    <article class="col flex-center comment-card__content" aria-label="{{ _("Comment") }}"><span>{{ comment.content }}</span></article>
    <div class="comment-card__author" style="order: -1;">
        {% if badge %}
            <span class="comment-card__author-img text-accent">{{ badge }}</span>
        {% else %}
            <img class="comment-card__author-img" src="{{ static('/img/icons/catlogo.svg') }}" aria-label="Author:" alt="">
        {% endif %} {{ author }}
    </div>
    {% if show_actions %}
        <form method="post" class="width-full" id="comment-form" up-target="{{ target or 'main' }}" up-restore-scroll up-transition="move-to-right/fade-in">
            {{ csrf_input }}
            <input type="hidden" name="action" value="vote">
            <input type="hidden" name="comment_id" value="{{ comment.id }}">
            <div class="row">
                {% for value, (icon, cls, msg) in buttons.items() %}
                    <div up-expand class="comment-card__button">
                        <button type="submit" form="comment-form" name="vote" value="{{ value }}">
                            <i class="fa {{ icon }} {{ cls }}"  aria-hidden="true"></i>
                        <span>{{ msg }}</span>
                        </button>
                    </div>
                {% endfor %}
            </div>
        </form>
    {% else %}
        <p class="comment-card__message">
            {% if message is defined %}{{ message }}{% else %}
                {% trans %}It is necessary to {{ login_anchor }} before voting or sending a comment!{% endtrans %}
            {% endif %}
        </p>
    {% endif %}
</div>