Files
komp_ac/web/templates/pages/admin/table_definition/delete_panel.html
2026-08-12 23:40:14 +02:00

40 lines
1.7 KiB
HTML

{#
The delete page's body — crate::pages::admin::table_definition::ui::DeleteFragment.
Only a refused delete swaps this: a successful one redirects to the admin
panel, because the table this page was about no longer exists.
#}
{% include "pages/admin/table_definition/feedback.html" %}
{% if page.table_is_writable() %}
<section class="panel danger-panel">
<h2>Delete <code>{{ page.selection.table }}</code></h2>
<p class="hint">
Drops the table and its definition, and the profile too when this was its
last table. The backend refuses to delete a table that still has rows.
</p>
{% if let Some(summary) = page.selected_table() %}
{% if !summary.depends_on.is_empty() %}
<p class="hint">It links to {{ summary.depends_on|join(", ") }}.</p>
{% endif %}
{% endif %}
<form hx-post="/admin/tables/delete"
hx-target="#table-panel" hx-swap="innerHTML">
<input type="hidden" name="profile" value="{{ page.selection.profile }}">
<input type="hidden" name="table" value="{{ page.selection.table }}">
<div class="form-grid">
<label class="wide">Type <code>{{ page.selection.table }}</code> to confirm
<input name="confirm_table_name" value="" autocomplete="off" placeholder="{{ page.selection.table }}">
</label>
</div>
<div class="form-actions">
<button type="submit" class="danger-submit">Delete table</button>
</div>
</form>
</section>
{% else if !page.selection.has_table() %}
<section class="panel">
<h2>No table chosen</h2>
<p class="hint">Pick the table to delete in the <a href="/admin{{ page.selection.profile_query() }}">admin panel</a> first.</p>
</section>
{% endif %}