Jinja2 macro for comments

This commit is contained in:
Sander Ferdinand 2018-10-20 18:28:18 +02:00
parent 8cfa556c04
commit e3d2834ea6
No known key found for this signature in database
GPG key ID: 7BBC83D7A8810AAB

View file

@ -0,0 +1,57 @@
{% macro comment_entry(c, proposal) %}
<div class="media mb-4 comment-container" id="comment-{{c.id}}">
<div class="votearrow" title="upvote"></div>
<div class="media-body">
<span class="username">
<a href="/user/{{ c.user.username }}">
{{c.user.username}}
{% if c.user.username == proposal.user.username %}
<small>[op]</small>
{% endif %}
{% if c.user.admin %}
<small>[admin]</small>
{% endif %}
</a>
</span>
<span class="date_posted">
<a href="/proposal/{{proposal.id}}#comment-{{c.id}}">
{{c.date_added.strftime('%Y-%m-%d %H:%M')}}
</a>
</span><br>
<span data-id="{{c.id}}" class="body" style="{% if c.automated %}color:blue;{% endif %};word-break: break-all;">{{c.message}}</span>
<br>
{% if not c.automated %}
<a class="reply" href="{{url_for('propsal_comment_reply', cid=c.id, pid=proposal.id)}}">reply</a>
{% endif %}
{% for _c in c.comments %}
<div class="media mt-4 comment-container" id="comment-{{_c.id}}">
<div class="votearrow" title="upvote"></div>
<div class="media-body" id="comment">
<span class="username">
<a href="/user/{{ _c.user.username }}">
{{_c.user.username}}
{% if _c.user.username == proposal.user.username %}
<small>[op]</small>
{% endif %}
{% if _c.user.admin %}
<small>[admin]</small>
{% endif %}
</a>
</span>
<span class="date_posted">
<a href="/proposal/{{proposal.id}}#comment-{{_c.id}}">
{{_c.date_added.strftime('%Y-%m-%d %H:%M')}}
</a>
</span>
<br>
<span data-id="{{_c.id}}" class="body" style="word-break: break-all;">
{{_c.message}}
</span>
</div>
</div>
{% endfor %}
</div>
</div>
{% endmacro %}