{% import 'macros/forms.html' as forms %} {% import 'macros/modal.html' as modal %} {% macro file_upload_form(form, endpoint, method, id, entity_id) %} {% if id == -1 %} {% set action = url_for(endpoint, entity_id=entity_id) %} {% set title = 'Upload File' %} {% else %} {% set action = url_for(endpoint, id_=id) %} {% set title = 'Edit File' %} {% endif %} {% set modal_id = 'modal-edit-file-' ~ id %} {% set form_id = 'form-edit-file-' ~ id %} {% call modal.modal(id=modal_id, title=title) %}
{{ form.hidden_tag() }}
{{ forms.field_row(form.file, 'File') }}
{{ forms.field_row(form.filename, 'Filename') }}
{{ forms.field_row(form.note, 'Note') }}
{{ form.submit() }}
{% endcall %} {% endmacro %} {% macro file_edit_form(form, endpoint, method, id) %} {% if id == -1 %} {% set action = url_for(endpoint, entity_id=entity_id) %} {% set title = 'Upload File' %} {% else %} {% set action = url_for(endpoint, id_=id) %} {% set title = 'Edit File' %} {% endif %} {% set modal_id = 'modal-edit-file-' ~ id %} {% set form_id = 'form-edit-file-' ~ id %} {% call modal.modal(id=modal_id, title=title) %}
{{ form.hidden_tag() }}
{{ forms.field_row(form.filename, 'Filename') }}
{{ forms.field_row(form.note, 'Note') }}
{{ form.submit() }}
{{ forms.script_send_form( form=form, form_name=form_id, method=method, message_field=form_id ~ '-messages' ) }} {% endcall %} {% endmacro %}