mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-23 07:46:23 -04:00
Add letter validation preview functionality
- 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
This commit is contained in:
@@ -3,7 +3,9 @@
|
||||
action=None,
|
||||
button_text="Choose file",
|
||||
alternate_link=None,
|
||||
alternate_link_text=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 }}">
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
('Find users by email', url_for('main.find_users_by_email')),
|
||||
('Email Complaints', url_for('main.platform_admin_list_complaints')),
|
||||
('Returned letters', url_for('main.platform_admin_returned_letters')),
|
||||
('Letter validation preview', url_for('main.platform_admin_letter_validation_preview')),
|
||||
] %}
|
||||
<li>
|
||||
<a href="{{ url }}">
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
{% extends "views/platform-admin/_base_template.html" %}
|
||||
{% from "components/banner.html" import banner %}
|
||||
{% from "components/textbox.html" import textbox %}
|
||||
{% from "components/file-upload.html" import file_upload %}
|
||||
{% from "components/page-footer.html" import page_footer %}
|
||||
|
||||
{% block per_page_title %}
|
||||
{{ page_title|capitalize }}
|
||||
{% endblock %}
|
||||
|
||||
{% block platform_admin_content %}
|
||||
|
||||
<div class="grid-row">
|
||||
<div class="column-whole">
|
||||
<h1 class="heading-large">Letter Validation Preview</h1>
|
||||
|
||||
{{ file_upload(
|
||||
form.file,
|
||||
action = url_for('main.platform_admin_letter_validation_preview'),
|
||||
button_text='Upload a PDF document',
|
||||
)}}
|
||||
</div>
|
||||
<div class="column-whole template-container">
|
||||
{% if result %}
|
||||
{{ banner(message, with_tick=True) }}
|
||||
{% elif message %}
|
||||
{{ banner(message, 'dangerous')}}
|
||||
{% endif %}
|
||||
|
||||
{% for page in pages %}
|
||||
<div class="letter">
|
||||
<img src="data:image/png;base64,{{ page }}">
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user