{% import 'input/form.html' as form with context %} {% import 'input/field.html' as field %} {% macro head(service, node, type="textbox") %} {# include data needed to identify the node to use for commenting #} {% endmacro %} {% macro submit(label=_("Send")) %} {% endmacro %} {% macro textbox(service, node, action='', placeholder='', submit_label=_("Send"), type="textbox") %} {# generic content area for comments/blog posts/etc. Only a body by default, but new elements can be added by using this macro with call #} {% set extra_content = caller() if caller is defined else '' %} {% call form.form(action=action, class="textbox") %} {{ head(service, node, type) }} {{ extra_content }} {{ field.textarea("body", placeholder=placeholder, required=True) }} {{ submit(label=submit_label) }} {% endcall %} {% endmacro %} {% macro comment(service, node, action='', placeholder=_("Your comment")) %} {{ textbox(service, node, action=action, placeholder=placeholder, type="comment") }} {% endmacro %} {% macro comment_or_login(service, node, action='', placeholder=none) %} {# show comment form a a message asking to log in login is checked using profile #} {% if profile %} {% if placeholder is none %} {{ comment(service, node, action) }} {% else %} {{ comment(service, node, action, placeholder=placeholder) }} {% endif %} {% else %}
{% trans %}You are not logged. You need to log in to comment.{% endtrans %}
{% if login_url is defined %}{% trans link_start=('')|join|safe, link_end=''|safe %} To log in {{link_start}}follow this link{{link_end}} {% endtrans %}
{% endif %}