From 4b7766695e6c2513c7ccd9308855ec3111f519a5 Mon Sep 17 00:00:00 2001 From: Masahiko AMANO Date: Tue, 31 Jan 2023 16:24:03 +0300 Subject: [PATCH] feat(web): introduce tag removing --- web/public/js/tfm-tags.js | 15 +++++++++++++++ web/public/tfm/tags.html | 1 + 2 files changed, 16 insertions(+) diff --git a/web/public/js/tfm-tags.js b/web/public/js/tfm-tags.js index e341888..9b65001 100644 --- a/web/public/js/tfm-tags.js +++ b/web/public/js/tfm-tags.js @@ -82,6 +82,21 @@ $(document).on("submit", "#menu-view form", function (e) { $(".list-item").removeClass("selected").css("display", "block"); }); +$(document).on("click", "#btn-remove", function (e) { + e.preventDefault(); + if (!confirm("This tag will be removed permanently. Are you sure?")) { + return; + } + let resp = tdb_query("$TFM", 33, '' + current_tanzaku.id); + if (!resp.status) { + alert("Something went wrong!"); + return; + } + $(".menu-wrapper").css("display", "none"); + $("#menu-view").css("display", "none"); + location.reload(true); +}); + $(document).on("submit", "#menu-add form", function (e) { e.preventDefault(); let resp = tdb_query("$TFM", 34, $("#new-name").val() + '\n' + $("#new-description").val()); diff --git a/web/public/tfm/tags.html b/web/public/tfm/tags.html index 595ed40..078491d 100644 --- a/web/public/tfm/tags.html +++ b/web/public/tfm/tags.html @@ -60,6 +60,7 @@
+