mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-19 09:54:36 -05:00
- add get/post view - create a pdf upload form - add a template where user can upload the file - check boundaries of the letter by calling template-preview - display banner messages with boundaries validation result - display pages of the document, with visible boundaries overlay if the document did not pass validation, and without overlay if they do pass validation
40 lines
1.3 KiB
HTML
40 lines
1.3 KiB
HTML
{% macro file_upload(
|
|
field,
|
|
action=None,
|
|
button_text="Choose file",
|
|
alternate_link=None,
|
|
alternate_link_text=None,
|
|
hint=None
|
|
|
|
) %}
|
|
<form method="post" enctype="multipart/form-data" {% if action %}action="{{ action }}"{% endif %} class="{% if field.errors %}form-group-error{% endif %}" data-module="file-upload">
|
|
<label class="file-upload-label" for="{{ field.name }}">
|
|
<span class="visually-hidden">{{ field.label.text }}</span>
|
|
{% if hint %}
|
|
<span class="form-hint">
|
|
{{ hint }}
|
|
</span>
|
|
{% endif %}
|
|
{% if field.errors %}
|
|
<span class="error-message">
|
|
{{ field.errors[0] }}
|
|
</span>
|
|
{% endif %}
|
|
</label>
|
|
{{ field(**{
|
|
'class': 'file-upload-field'
|
|
}) }}
|
|
<label class="file-upload-button" for="{{ field.name }}">
|
|
{{ button_text }}
|
|
</label>
|
|
{% if alternate_link and alternate_link_text %}
|
|
<span class="file-upload-alternate-link">
|
|
or <a href="{{ alternate_link }}">{{ alternate_link_text }}</a>
|
|
</span>
|
|
{% endif %}
|
|
<label class="file-upload-filename" for="{{ field.name }}"></label>
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
|
|
<button type="submit" class="file-upload-submit">Submit</button>
|
|
</form>
|
|
{% endmacro %}
|