dokytree/samples/it_v1/templates/todos.pug

81 lines
1.5 KiB
Plaintext
Raw Normal View History

2023-03-08 23:38:30 +00:00
div#HEADFILES
-
let todos = []
const readNode = (curNode) => {
if(curNode?.data?.todo?.length > 0) {
curNode.data.todo.forEach((itm) => {
const nodeItem = {
name: curNode.data.name,
todo: itm,
}
todos.push(nodeItem)
})
}
curNode.items.forEach((itm) => {
if(itm?.data?.todo?.length > 0) {
itm.data.todo.forEach((todo) => {
const nodeItem = {
name: itm.data.name,
2024-04-27 21:27:29 +00:00
url: curNode.url + '?itm=' + itm.name,
2023-03-08 23:38:30 +00:00
todo: todo,
}
todos.push(nodeItem)
})
}
})
curNode.nodes.forEach((childNode) => {
readNode(childNode)
})
}
const readNode1 = (curNode) => {
if(curNode?.data?.todo?.length > 0) {
const nodeItem = {
name: curNode.data.name,
todos: curNode.data.todo,
}
todos.push(nodeItem)
}
curNode.items.forEach((itm) => {
if(itm?.data?.todo?.length > 0) {
const nodeItem = {
name: itm.data.name,
2024-04-27 21:27:29 +00:00
url: curNode.url + '?itm=' + itm.name,
2023-03-08 23:38:30 +00:00
todos: itm.data.todo,
}
todos.push(nodeItem)
}
})
curNode.nodes.forEach((childNode) => {
readNode(childNode)
})
}
readNode(doc)
todos = todos.sort((x, y) => {
2024-04-27 21:27:29 +00:00
return (y.todo.priority - x.todo.priority)
2023-03-08 23:38:30 +00:00
})
table
thead
th Priority
th Object
th Message
each itm in todos
2024-04-27 21:27:29 +00:00
if itm.todo.priority >= 10
tr.alert
td=itm.todo.priority
td
a.alert(href=itm.url)=itm.name
td=itm.todo.msg
else
tr
td=itm.todo.priority
td
a(href=itm.url)=itm.name
td=itm.todo.msg
2023-03-08 23:38:30 +00:00
div#FILES
div#FOOTFILES