From fefff3ce45e2bdffefaaf35423b5574ed122b2e9 Mon Sep 17 00:00:00 2001 From: Masahiko AMANO Date: Tue, 31 Jan 2023 02:08:42 +0300 Subject: [PATCH] feat(web): introduce saving and discarding changes --- web/public/js/tfm-database.js | 22 ++++++++++++++++++++++ web/public/tfm/index.html | 8 +++++++- 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 web/public/js/tfm-database.js diff --git a/web/public/js/tfm-database.js b/web/public/js/tfm-database.js new file mode 100644 index 0000000..33a3ef6 --- /dev/null +++ b/web/public/js/tfm-database.js @@ -0,0 +1,22 @@ +$(document).on("click", "#btn-save", function (e) { + e.preventDefault(); + let resp = tdb_query("$TFM", 4, ""); + if (resp.status) { + alert("Successfully saved!"); + } else { + alert("Something went wrong!"); + } +}); + +$(document).on("click", "#btn-discard", function (e) { + e.preventDefault(); + if (!confirm("All unsaved changes will be lost permanently. Are you sure?")) { + return; + } + let resp = tdb_query("$TFM", 2, ""); + if (resp.status) { + alert("Successfully reloaded database!"); + } else { + alert("Something went wrong!"); + } +}); diff --git a/web/public/tfm/index.html b/web/public/tfm/index.html index dfd6738..25e6c9c 100644 --- a/web/public/tfm/index.html +++ b/web/public/tfm/index.html @@ -24,16 +24,22 @@ +

Welcome to Tanabata File Manager!

-

Files or tags?

+

Come on, what to do?

+
+ + +
+