Commit d77541d9 authored by Raphaël Jakse's avatar Raphaël Jakse

feat: add notes

parent 2c0f71ba
......@@ -79,6 +79,12 @@ class Elem extends ProjectTrackingElem {
this.blockedByMe = info.blocks || []
this.blockedBy = info.blockedBy || []
this.notes = info.notes || []
if (info.note) {
this.notes.push(note)
}
}
blocks (blocked) {
......@@ -90,6 +96,10 @@ class Elem extends ProjectTrackingElem {
this.done = true
}
addNote (note) {
this.notes.push(note)
}
render (asLi = false) {
const div = document.createElement(asLi ? 'li' : 'div')
div.className = 'project-tracking-elem' + (this.done ? ' project-tracking-elem-done' : '')
......@@ -127,25 +137,37 @@ class Elem extends ProjectTrackingElem {
}
div.appendChild(title)
if (this.todo || this.difficulty) {
const tododifficulty = document.createElement('div')
tododifficulty.className = 'project-tracking-elem-details'
if (this.todo || this.difficulty || this.notes.length) {
const details = document.createElement('div')
details.className = 'project-tracking-elem-details'
if (this.todo) {
const todo = document.createElement('p')
todo.className = 'project-tracking-elem-todo'
todo.textContent = 'À faire : ' + this.todo
tododifficulty.appendChild(todo)
details.appendChild(todo)
}
if (this.difficulty) {
const difficulty = document.createElement('p')
difficulty.className = 'project-tracking-elem-difficulty'
difficulty.textContent = 'Difficulté : ' + this.difficulty
tododifficulty.appendChild(difficulty)
details.appendChild(difficulty)
}
if (this.notes) {
const notes = document.createElement('ul')
notes.className = 'project-tracking-elem-notes'
for (const note of this.notes) {
notes.appendChild(document.createElement('li'))
notes.lastChild.textContent = note
}
details.appendChild(notes)
}
div.appendChild(tododifficulty)
div.appendChild(details)
}
const footer = document.createElement('div')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment