initial project commit

This commit is contained in:
georg.sinn-schirwitz
2025-08-29 15:07:58 +02:00
parent 38708e6d1d
commit 23a67d7fe1
31 changed files with 3433 additions and 0 deletions

41
web/static/taxonomy.js Normal file
View File

@@ -0,0 +1,41 @@
function updateColor(id, type, newColor) {
fetch("/admin/taxonomy", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-CSRF-Token": document.querySelector('meta[name="csrf-token"]').content,
},
body: JSON.stringify({
action:
type === "region" ? "change_region_color" : "change_keyword_color",
[type + "_id"]: id,
[type + "_color"]: newColor,
}),
}).then((response) => {
if (response.ok) {
location.reload();
} else {
alert("Failed to update " + type + " color");
}
});
}
document
.getElementById("region-color-form")
.addEventListener("submit", function (event) {
event.preventDefault();
const regionId = this.querySelector('input[name="region_id"]').value;
const newColor = this.querySelector('input[name="new_region_color"]').value;
updateColor(regionId, "region", newColor);
});
document
.getElementById("keyword-color-form")
.addEventListener("submit", function (event) {
event.preventDefault();
const keywordId = this.querySelector('input[name="keyword_id"]').value;
const newColor = this.querySelector(
'input[name="new_keyword_color"]'
).value;
updateColor(keywordId, "keyword", newColor);
});