kalender und fixes
This commit is contained in:
1 parent
940d9bbde4
commit
416ca9e854
14 files changed
+376
-71
No files matched your search
@@ -458,17 +458,21 @@ function showContent(card) {
|
||||
}
|
||||
|
||||
export function bindCheckboxes(container, card) {
|
||||
container.querySelectorAll('input[type="checkbox"]').forEach((cb, idx) => {
|
||||
cb.disabled = false;
|
||||
cb.addEventListener('change', async () => {
|
||||
container.querySelectorAll('.todo-item').forEach((item, idx) => {
|
||||
const btn = item.querySelector('.todo-cb');
|
||||
if (!btn) return;
|
||||
const toggle = async () => {
|
||||
let n = 0;
|
||||
const body = card.body.replace(/- \[([ x])\]/g, (m, s) => n++ === idx ? `- [${s === 'x' ? ' ' : 'x'}]` : m);
|
||||
card.body = body;
|
||||
await api(`api/cards/${card.id}`, { method: 'PATCH', body: { body } });
|
||||
const c = state.cards.find(x => x.id == card.id);
|
||||
if (c) c.body = body;
|
||||
btn.classList.toggle('checked');
|
||||
item.classList.toggle('todo-done');
|
||||
window._renderBoard();
|
||||
});
|
||||
};
|
||||
item.addEventListener('click', toggle);
|
||||
});
|
||||
|
||||
metaEl.textContent = '> created: ' + card.created_at + ' | modified: ' + card.updated_at +
|
||||
|
||||
Reference in new issue
Block a user