+ {% endif %}
@@ -398,4 +405,25 @@
top.frames.dictframe.location.href = url;
}
+ function deleteTerm() {
+ // Ask for confirmation
+ var isConfirmed = confirm('Are you sure you want to delete this term?\n\nThis action cannot be undone, and if this term has children, they will be orphaned.');
+
+ // Check if the user confirmed
+ if (isConfirmed) {
+ // Delete term
+ fetch("/term/delete/{{ term.id }}")
+
+ if ("{{ embedded_in_reading_frame }}" == "True") {
+ // If on reading page, reload page
+ parent.location.reload();
+ }
+ else {
+ // If on term page, go to term listing
+ window.location.href = '/term/index';
+ }
+ }
+ }
+
+
diff --git a/lute/templates/term/formframes.html b/lute/templates/term/formframes.html
index 1def3a18..5df5e392 100644
--- a/lute/templates/term/formframes.html
+++ b/lute/templates/term/formframes.html
@@ -7,16 +7,7 @@
{% block body %}