{% import 'macros/forms.html' as forms %} {% import 'macros/modal.html' as modal %} {% macro comments_add_form(form, endpoint, method, id, entity_id) %} {% if id == -1 %} {% set action = url_for(endpoint, entity_id=entity_id) %} {% set title = 'Write Comment' %} {% else %} {% set action = url_for(endpoint, id_=id) %} {% set title = 'Edit Comment' %} {% endif %} {% set modal_id = 'modal-edit-comment-' ~ id %} {% set form_id = 'form-edit-comment-' ~ id %} {% call modal.modal(id=modal_id, title=title) %}
{{ forms.script_send_form( form=form, form_name=form_id, method=method, message_field=form_id ~ '-messages' ) }} {% endcall %} {% endmacro %}