haufen sachen

This commit is contained in:
th committed 2026-04-08 22:46:48 +02:00
1 parent 416ca9e854
commit e6243701a3
20 files changed
+1562 -116

No files matched your search

+36 -1
View File
@@ -444,9 +444,23 @@ function renderSidebar(card) {
// ── Content ──
function updateDoneButton(card) {
const isDone = (card.tags || '').split(',').includes('done');
const btn = $('detail-done');
const label = $('detail-done-label');
if (btn) {
btn.classList.toggle('text-t-accent', isDone);
btn.classList.toggle('border-t-accent', isDone);
}
if (label) label.textContent = isDone ? 'undone' : 'done';
}
function showContent(card) {
$('detail-color').style.background = card.color;
titleEl.textContent = card.title;
updateDoneButton(card);
const doneCorner = $('detail-done-corner');
if (doneCorner) doneCorner.classList.toggle('hidden', !(card.tags || '').split(',').includes('done'));
bodyEl.innerHTML = renderMd(card.body);
addCodeCopyButtons(bodyEl);
formatTodoItems(bodyEl);
@@ -575,7 +589,7 @@ function applyReadingResizeHandles(root) {
});
}
function bindDetailImageFullscreen(root) {
export function bindDetailImageFullscreen(root) {
if (!root) return;
// Gallery grids: single click, with prev/next
@@ -978,6 +992,27 @@ $('detail-edit')?.addEventListener('click', () => {
window._openModal(card);
});
$('detail-done')?.addEventListener('click', async () => {
const card = state.viewingCard;
if (!card) return;
const isDone = (card.tags || '').split(',').includes('done');
let newBody;
if (isDone) {
newBody = card.body.replace(/\s*#done\b/g, '');
} else {
newBody = (card.body || '').trimEnd() + ' #done';
}
await api(`api/cards/${card.id}`, { method: 'PATCH', body: { body: newBody, due_date: isDone ? card.due_date : null } });
card.body = newBody;
if (!isDone) card.due_date = null;
const c = state.cards.find(x => x.id == card.id);
if (c) { c.body = newBody; c.tags = newBody.match(/#[a-z0-9_/-]+/gi)?.map(t => t.substring(1).toLowerCase()).join(',') || ''; if (!isDone) c.due_date = null; }
showContent(card);
window._renderBoard();
const doneCorner = $('detail-done-corner');
if (doneCorner) doneCorner.classList.toggle('hidden', !newBody.includes('#done'));
});
$('detail-delete')?.addEventListener('click', async () => {
if (!state.viewingCard) return;
const ok = await showDialog({ title: 'delete_card', message: `"${state.viewingCard.title}" wirklich loeschen?`, danger: true, okLabel: 'delete' });