Files
WYGIWYH/app/templates/export_app/fragments/export.html
T
Herculino Trotta 8d6b86b7ca feat(export): export and restore on the page, with progress and messages
The export and restore forms now sit on the Export and Restore page
instead of an offcanvas. Exporting shows a progress line and a toast
when the download starts; restoring splits ZIP and CSV uploads into
tabs and shows errors in the form.

- An empty export warns instead of downloading the message as a file
- Export errors show a message instead of a stuck spinner
- The download link is kept long enough for Safari to save the file
- Non-superusers get a 403 instead of a redirect loop with the login
- The asset classes CSV can be uploaded on its own
- Drop the export form's unknown investment_classes layout field
2026-11-17 13:01:25 -03:00

32 lines
1.3 KiB
HTML

{% load i18n %}
<form hx-post="{% url 'export_form' %}"
hx-ext="htmx-download"
hx-swap="none"
hx-disabled-elt="find [type=submit]"
hx-indicator="#export-progress"
id="export-form"
class="flex flex-col gap-4">
{% csrf_token %}
<div class="grid gap-1 sm:grid-cols-2">
{% for field in form %}
<label class="flex items-start gap-3 px-3 py-2 rounded-box cursor-pointer hover:bg-base-200 transition-colors">
{{ field }}
<span class="flex flex-col gap-1 leading-6">
<span>{{ field.label }}</span>
{% if field.help_text %}
<span id="{{ field.auto_id }}_helptext" class="flex items-baseline gap-1.5 text-sm leading-5 text-warning">
<i class="fa-solid fa-triangle-exclamation" aria-hidden="true"></i>{{ field.help_text }}
</span>
{% endif %}
</span>
</label>
{% endfor %}
</div>
<button type="submit" class="btn btn-primary">{% translate 'Export' %}</button>
<p id="export-progress" role="status" class="hidden [&.htmx-request]:flex items-center gap-2 text-sm text-base-content/70">
<span class="loading loading-spinner loading-sm"></span>
{% translate 'Preparing your export. The download starts on its own when it is ready.' %}
</p>
</form>