ejplatform/ej-server

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

Summary

Maintainability
Test Coverage
<div class="comment-form">
    {% if user == None %}
        <p>{% trans %}Please {{ login_anchor }} to vote on this conversation.{% endtrans %}</p>
    {% elif comments_exceeded|default(False) %}
        <h3>{% trans %}Ooops!{% endtrans %}</h3>
        <p>{% trans %}You reached the limit of comments in this conversation.{% endtrans %}</p>
    {% else %}
        {% set n_comments_span = '<em class="text-accent roman">{n}</em>'.format(n=n_comments)|safe %}
        <form method="post" up-target="{{ target or 'main' }}" up-transition="move-to-right/fade-in">
            <label>{% trans %}Include something new and avoid similar opinions.{% endtrans %}{{ ' ' }}
                {% trans count = n_comments, n = n_comments_span %}You can only post {{ n }} comment.{% pluralize %}You can post up to {{ n }} comments.{% endtrans %}
            {{ csrf_input }}
            <input type="hidden" name="action" value="comment">
            {{ form.non_field_errors() }}
            {{ form.content.errors }}
            {{ form.content }}
            </label>
            <div class="comment-form__count" aria-hidden="true"><span>0</span> / 240</div>
            <div class="clearfix"></div>
            <input type="submit" name="submit" value="{{ _('Comment') }}" aria-label="{{ _('Send') }}">
        </form>
    {% endif %}
</div>