feat(project): add Asana-style board completion checks
This commit is contained in:
+13
-1
@@ -421,7 +421,7 @@
|
||||
.pj-card-sub.pj-sub-drop-before { box-shadow: inset 0 2px var(--pj-accent); }
|
||||
.pj-card-sub.pj-sub-drop-after { box-shadow: inset 0 -2px var(--pj-accent); }
|
||||
.pj-card.is-sub-drop { outline: 2px solid var(--pj-accent); outline-offset: -2px; background: var(--pj-accent-tint); }
|
||||
.pj-card.is-done .pj-card-title { text-decoration: line-through; color: #9aa1a9; }
|
||||
.pj-card.is-done .pj-card-title { color: #9aa1a9; }
|
||||
.pj-card-title { font-size: var(--pj-text-size); font-weight: 400; color: var(--pj-ink); line-height: var(--pj-text-leading); }
|
||||
.pj-card-meta { display: flex; align-items: center; gap: 6px; margin-top: 10px; }
|
||||
.pj-card-due { margin-left: auto; font-size: var(--pj-small-size); color: var(--pj-ink-soft); font-weight: 400; line-height: var(--pj-small-leading); }
|
||||
@@ -437,6 +437,17 @@
|
||||
.pj-card-head .pj-card-title {
|
||||
display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; flex: none;
|
||||
}
|
||||
.pj-card-title-row { display: flex; align-items: flex-start; gap: 6px; flex: none; }
|
||||
.pj-card-title-row .pj-card-title { flex: 1; min-width: 0; }
|
||||
.pj-card-check {
|
||||
display: inline-flex; align-items: center; justify-content: center; flex: 0 0 18px; width: 18px; height: 22px;
|
||||
padding: 0; border: none; background: transparent; border-radius: 50%; color: #6d6e6f; cursor: pointer;
|
||||
}
|
||||
.pj-card-check .material-symbols-outlined { font-size: 18px; }
|
||||
.pj-card-check:hover:not(:disabled) { color: #58a182; }
|
||||
.pj-card-check:focus-visible { outline: 2px solid var(--pj-accent); outline-offset: 2px; }
|
||||
.pj-card-check:disabled { cursor: default; }
|
||||
.pj-card-check[aria-busy="true"] { opacity: .5; }
|
||||
.pj-card-head:has(.pj-card-proj) .pj-card-title { -webkit-line-clamp: 1; }
|
||||
.pj-card:has(.pj-card-subs-wrap.is-open) .pj-card-head { height: 96px; } /* 펼침 때 아래 10px 여백(음수 margin)만큼 */
|
||||
.pj-card-head .pj-card-meta { margin-top: auto; padding-top: 6px; flex: none; }
|
||||
@@ -1336,6 +1347,7 @@ label.pj-desc-fmtbtn {
|
||||
.pj-subtask-check .material-symbols-outlined { font-size: 21px; }
|
||||
.pj-subtask-check:hover { color: #3f8f6b; }
|
||||
.pj-subtask-row.is-done .pj-subtask-check { color: #3f8f6b; }
|
||||
.pj-card.is-done .pj-card-check .material-symbols-outlined,
|
||||
.pj-card-sub.is-done .pj-card-sub-check .material-symbols-outlined,
|
||||
.pj-subtask-row.is-done .pj-subtask-check .material-symbols-outlined {
|
||||
display: inline-block; width: 1em; height: 1em; color: transparent;
|
||||
|
||||
+30
-1
@@ -5227,6 +5227,7 @@
|
||||
});
|
||||
}
|
||||
|
||||
const cardCompletionSaving = new Set();
|
||||
function taskCard(t) {
|
||||
const card = document.createElement("div");
|
||||
card.className = "pj-card" + (t.completed_at ? " is-done" : "");
|
||||
@@ -5247,7 +5248,13 @@
|
||||
(showProjTag && t.project_name
|
||||
? '<div class="pj-card-proj" style="color:' + (t.project_color || "#4573d2") + '">● ' + escapeHtml(t.project_name) + "</div>"
|
||||
: "") +
|
||||
'<div class="pj-card-title">' + escapeHtml(t.title) + "</div>" +
|
||||
'<div class="pj-card-title-row"><button type="button" class="pj-card-check" role="checkbox" aria-checked="' + (!!t.completed_at) +
|
||||
'" aria-label="' + escapeHtml((t.completed_at ? "완료 취소: " : "완료로 표시: ") + t.title) +
|
||||
'" title="' + (t.completed_at ? "완료 취소" : "완료로 표시") + '"' +
|
||||
(!(canManage && taskAccessLevel(t) === "full") || cardCompletionSaving.has(t.id) ? " disabled" : "") +
|
||||
(cardCompletionSaving.has(t.id) ? ' aria-busy="true"' : "") +
|
||||
'><span class="material-symbols-outlined" aria-hidden="true">check_circle</span></button>' +
|
||||
'<div class="pj-card-title">' + escapeHtml(t.title) + "</div></div>" +
|
||||
'<div class="pj-card-meta">' +
|
||||
(t.priority && t.priority !== "normal"
|
||||
? '<span class="pj-pri pj-pri-' + t.priority + '">' + (priorityLabels[t.priority] || t.priority) + "</span>"
|
||||
@@ -5301,6 +5308,28 @@
|
||||
: "");
|
||||
const subsBox = card.querySelector(".pj-card-subs");
|
||||
if (subsBox) fillCardSubs(subsBox, t);
|
||||
const check = card.querySelector(".pj-card-check");
|
||||
check.addEventListener("click", async function (e) {
|
||||
e.stopPropagation();
|
||||
if (!canManage || taskAccessLevel(t) !== "full" || cardCompletionSaving.has(t.id)) return;
|
||||
cardCompletionSaving.add(t.id); check.disabled = true; check.setAttribute("aria-busy", "true");
|
||||
let updated = false;
|
||||
const hadFocus = document.activeElement === check;
|
||||
try {
|
||||
const res = await api("PUT", "/project/api/tasks/" + t.id, { completed: !t.completed_at });
|
||||
mergeTask(res.task); updated = true;
|
||||
} catch (err) { showToast("완료 상태 변경 실패: " + err.message, "error"); }
|
||||
finally {
|
||||
cardCompletionSaving.delete(t.id);
|
||||
const restoreFocus = hadFocus && (document.activeElement === check || document.activeElement === document.body);
|
||||
refreshActiveView();
|
||||
if (restoreFocus) {
|
||||
const liveCheck = document.querySelector('.pj-card[data-task-id="' + t.id + '"] .pj-card-check');
|
||||
if (liveCheck) liveCheck.focus();
|
||||
}
|
||||
}
|
||||
if (updated) refreshMyOpenBadge();
|
||||
});
|
||||
card.addEventListener("click", function (e) {
|
||||
// 하위 업무 펼치기/접기 — 보기 권한만 있어도 된다.
|
||||
const tog = e.target.closest(".pj-card-subtoggle");
|
||||
|
||||
Reference in New Issue
Block a user