mirror of
https://codeberg.org/catask-org/catask.git
synced 2025-04-19 13:23:41 -05:00
add import/export page template
This commit is contained in:
parent
50bcdce6b3
commit
3211b6321e
1 changed files with 79 additions and 0 deletions
79
templates/admin/categories/import.html
Normal file
79
templates/admin/categories/import.html
Normal file
|
@ -0,0 +1,79 @@
|
|||
{% extends 'admin/base.html' %}
|
||||
{% block _title %}Import/Export{% endblock %}
|
||||
{% set import_link = 'active' %}
|
||||
{% block _content %}
|
||||
<h2 id="general" class="mb-3 fw-normal">Import/Export</h2>
|
||||
<h3 id="import" class="mb-3 fw-light">Import</h3>
|
||||
<form class="mb-2" hx-disabled-elt="find button[type=submit]" hx-put="{{ url_for('api.importData') }}" hx-encoding="multipart/form-data" hx-target="#response-container" hx-swap="none">
|
||||
<div class="form-group mb-3">
|
||||
<label class="form-label" for="import_archive">Import data</label>
|
||||
<input class="form-control" type="file" id="import_archive" name="import_archive" required>
|
||||
<p class="form-text">Note: Retrospring exports are not supported yet</p>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary mt-2" id="import-data">
|
||||
<span class="me-1 spinner-border spinner-border-sm htmx-indicator" aria-hidden="true"></span>
|
||||
<span class="visually-hidden" role="status">Loading...</span>
|
||||
<i class="bi bi-database-up me-1"></i> Import
|
||||
</button>
|
||||
</form>
|
||||
{#
|
||||
<hr>
|
||||
<form class="mb-2" hx-disabled-elt="find button[type=submit]" hx-put="{{ url_for('api.importRsData') }}" hx-encoding="multipart/form-data" hx-target="#response-container" hx-swap="none">
|
||||
<div class="form-group mb-3">
|
||||
<label class="form-label" for="import_archive_rs">Retrospring data</label>
|
||||
<input class="form-control" type="file" id="import_archive_rs" name="import_archive" required>
|
||||
<!-- <p class="form-text">Note: Retrospring exports are not supported yet</p> -->
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary mt-2" id="import-data">
|
||||
<span class="me-1 spinner-border spinner-border-sm htmx-indicator" aria-hidden="true"></span>
|
||||
<span class="visually-hidden" role="status">Loading...</span>
|
||||
<i class="bi bi-database-up me-1"></i> Import
|
||||
</button>
|
||||
</form>
|
||||
#}
|
||||
<h3 id="export" class="mb-3 mt-5 fw-light">Export</h3>
|
||||
<div class="form-group mb-3">
|
||||
<form hx-post="{{ url_for('api.createExport') }}" hx-swap="none" hx-disabled-elt="#export-btn">
|
||||
<button type="submit" class="btn btn-primary" id="export-btn">
|
||||
<span class="spinner-border spinner-border-sm htmx-indicator" aria-hidden="true"></span>
|
||||
<span class="visually-hidden" role="status">Loading...</span>
|
||||
<i class="bi bi-plus-lg me-1"></i> New Export
|
||||
</button>
|
||||
</form>
|
||||
{% if exports %}
|
||||
<div class="table-responsive mt-2">
|
||||
<table class="table align-middle">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for export in exports %}
|
||||
<tr id="export-{{ export.timestamp_esc }}">
|
||||
<td>{{ export.timestamp }}</td>
|
||||
<td>
|
||||
<a href="/{{ export.downloadPath }}" class="btn btn-secondary btn-sm px-3 px-md-2"><i class="bi bi-download"></i> <span class="d-none d-lg-inline-block ms-1">Download</span></a>
|
||||
<button class="btn btn-outline-danger btn-sm px-3 px-md-2" hx-target="#export-{{ export.timestamp_esc }}" hx-swap="delete" hx-delete="{{ url_for('api.deleteExport', timestamp=export.timestamp_esc) }}"><i class="bi bi-trash"></i> <span class="d-none d-lg-inline-block ms-1">Delete</span></button>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% else %}
|
||||
<p class="text-center my-3"><i>No exports created yet</i></p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% block _scripts %}
|
||||
<script>
|
||||
// fix handling checkboxes
|
||||
document.querySelectorAll('.form-check-input[type=checkbox]').forEach(function(checkbox) {
|
||||
checkbox.addEventListener('change', function() {
|
||||
checkbox.nextElementSibling.value = this.checked ? 'True' : 'False';
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
Loading…
Add table
Reference in a new issue