added project delete + changed to list template

This commit is contained in:
2025-02-02 23:01:17 +01:00
parent 35d5a81e6f
commit 092812b9b7
8 changed files with 74 additions and 44 deletions

View File

@ -82,6 +82,7 @@ main {
display: flex;
flex-direction: column;
padding: 2em;
overflow-y: auto;
}
button, input, select {

View File

@ -5,6 +5,7 @@
display: flex;
flex-direction: column;
gap: 1em;
overflow-y: auto;
}
.list-header {
@ -22,6 +23,7 @@
gap: 0.8em;
flex-direction: column;
padding: 0;
overflow-y: auto;
}
.list li {

View File

@ -33,7 +33,7 @@ window.addEventListener("load", () => {
document.querySelectorAll(".list li").forEach(row => {
let id = row.dataset.id
row.querySelector("button.edit").addEventListener("click", () => {
row.querySelector("button.edit")?.addEventListener("click", () => {
window.location.href = `${id}/`
})

View File

@ -1,4 +1,8 @@
.productive {
box-shadow: 0.2em 0 0 var(--accent) inset;
}
/*
.projects {
width: 100%;
max-width: 40em;
@ -21,4 +25,5 @@
.projects tbody tr:nth-child(even) {
background-color: var(--dark2);
}
}
*/

View File

@ -1,5 +1,16 @@
onBeforeDelete = async row => {
await req(`${row.dataset.id}/on_delete/`).then(res => {
return res.json()
}).then(res => {
if (res.status === "success") {
let popup = document.getElementById("delete-popup")
popup.querySelector(".task-count").innerText = res.tasks
}
})
}
window.addEventListener("load", () => {
document.querySelectorAll(".projects tbody tr").forEach(row => {
document.querySelectorAll(".list li").forEach(row => {
let id = row.dataset.id
let selector = row.querySelector(".parent-sel")
selector.addEventListener("change", () => {
@ -10,9 +21,5 @@ window.addEventListener("load", () => {
body: fd
})
})
row.querySelector("button.edit").addEventListener("click", () => {
window.location.href = `${id}/`
})
})
})