feat(project): add Asana-style board completion checks

This commit is contained in:
2026-10-02 17:55:31 +09:00
parent 20232baf06
commit 22af196d56
11 changed files with 88 additions and 15 deletions
@@ -1,7 +1,7 @@
{% extends "erp_base.html" %}
{% block head_extra %}
<link rel="stylesheet" href="/static/project.css?v=20261002g" />
<link rel="stylesheet" href="/static/project.css?v=20261002h" />
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
{% endblock %}
@@ -296,5 +296,5 @@
{% include "project/_side_modals.html" %}
{% include "project/_member_tasks_modal.html" %}
<script src="/static/project.js?v=20261002g" defer></script>
<script src="/static/project.js?v=20261002h" defer></script>
{% endblock %}
@@ -1,7 +1,7 @@
{% extends "erp_base.html" %}
{% block head_extra %}
<link rel="stylesheet" href="/static/project.css?v=20261002g" />
<link rel="stylesheet" href="/static/project.css?v=20261002h" />
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
{% endblock %}
@@ -207,5 +207,5 @@
{% include "project/_member_tasks_modal.html" %}
<script src="/static/project-goal-text.js?v=20261002g" defer></script>
<script src="/static/project.js?v=20261002g" defer></script>
<script src="/static/project.js?v=20261002h" defer></script>
{% endblock %}
@@ -1,7 +1,7 @@
{% extends "erp_base.html" %}
{% block head_extra %}
<link rel="stylesheet" href="/static/project.css?v=20261002g" />
<link rel="stylesheet" href="/static/project.css?v=20261002h" />
<link rel="stylesheet" href="/static/project-help.css?v=20261002d" />
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
{% endblock %}
@@ -239,6 +239,7 @@
<li><b>상단 작업 추가</b> — 섹션 머리의 <span class="pjh-ui">+</span>는 오른쪽에서 작업 상세창을 엽니다. 제목·설명·담당자·우선순위·마감일을 설정할 수 있습니다.</li>
<li><b>하단 작업 추가</b> — 섹션 맨 아래 <span class="pjh-ui">+ 작업 추가</span>는 보드 안에 간단한 입력 카드를 엽니다. <b>작업 이름·담당자·마감일</b>을 정한 뒤 <kbd>Enter</kbd>를 누르거나 카드 밖을 클릭하면 저장됩니다. Enter로 저장하면 다음 작업을 계속 입력할 수 있고, <kbd>Esc</kbd>로 취소할 수 있습니다.</li>
<li><b>열기</b> — 카드를 누르면 오른쪽에 작업 편집 창이 열립니다. (<a href="#task">8장</a>)</li>
<li><b>완료 체크</b> — 카드 제목 왼쪽의 원형 체크 버튼을 누르면 완료됩니다. 완료된 작업은 <b>녹색 원 안 흰 체크</b>와 흐린 회색 제목으로 표시되며 취소선은 없습니다. 다시 누르면 완료를 취소합니다. 읽기 전용 작업은 상태만 표시합니다.</li>
<li><b>담당자·마감일 바로 바꾸기</b> — 카드의 사람 아이콘이나 날짜를 누르면 그 자리에서 바꿉니다. 비어 있으면 카드에 마우스를 올렸을 때 점선 원 아이콘이 나타납니다.</li>
<li><b>옮기기</b> — 카드를 끌어 다른 섹션에 놓으면 섹션이 바뀌고, 같은 섹션 안에서 위아래로 놓으면 순서가 바뀝니다.</li>
<li><b>우클릭 메뉴</b> — <span class="pjh-ui">열기 · 작업 링크 복사 · 완료로 표시 · 삭제</span></li>
@@ -1,7 +1,7 @@
{% extends "erp_base.html" %}
{% block head_extra %}
<link rel="stylesheet" href="/static/project.css?v=20261002g" />
<link rel="stylesheet" href="/static/project.css?v=20261002h" />
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
{% endblock %}
@@ -104,5 +104,5 @@
{% include "project/_side_modals.html" %}
{% include "project/_member_tasks_modal.html" %}
<script src="/static/project.js?v=20261002g" defer></script>
<script src="/static/project.js?v=20261002h" defer></script>
{% endblock %}
@@ -1,7 +1,7 @@
{% extends "erp_base.html" %}
{% block head_extra %}
<link rel="stylesheet" href="/static/project.css?v=20261002g" />
<link rel="stylesheet" href="/static/project.css?v=20261002h" />
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
{% endblock %}
@@ -100,5 +100,5 @@
"today": {{ today | tojson }}
}
</script>
<script src="/static/project.js?v=20261002g" defer></script>
<script src="/static/project.js?v=20261002h" defer></script>
{% endblock %}
@@ -1,7 +1,7 @@
{% extends "erp_base.html" %}
{% block head_extra %}
<link rel="stylesheet" href="/static/project.css?v=20261002g" />
<link rel="stylesheet" href="/static/project.css?v=20261002h" />
<!-- 구글 머티리얼 심볼(담당자 아이콘 등) — self-host -->
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
<!-- 타임라인 vis-timeline — self-host -->
@@ -496,5 +496,5 @@
</script>
<script src="/static/vendor/vis-timeline/vis-timeline-graph2d.min.js"></script>
<script src="/static/project.js?v=20261002g" defer></script>
<script src="/static/project.js?v=20261002h" defer></script>
{% endblock %}
@@ -1,7 +1,7 @@
{% extends "erp_base.html" %}
{% block head_extra %}
<link rel="stylesheet" href="/static/project.css?v=20261002g" />
<link rel="stylesheet" href="/static/project.css?v=20261002h" />
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
{% endblock %}
@@ -70,5 +70,5 @@
{% include "project/_side_modals.html" %}
{% include "project/_member_tasks_modal.html" %}
<script src="/static/project.js?v=20261002g" defer></script>
<script src="/static/project.js?v=20261002h" defer></script>
{% endblock %}
+13 -1
View File
@@ -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
View File
@@ -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");
+4
View File
@@ -82,6 +82,10 @@
받는 쪽은 **같은 프로젝트의 최상위 작업만**(순환 방지), 하위 작업의 하위 작업은 함께 따라간다.
**카드 크기·표지**(2026-10-02): 카드 높이 100px 고정(`.pj-card-head` height 86px = 100 − 아래 여백 12 − 테두리 2, 제목 2줄·
프로젝트 배지가 있으면 1줄까지, 담당자·날짜 줄은 맨 아래), 담당자 13.2px·아바타 20px·날짜 12.1px(기존 +10%).
**카드 완료 표시**: 제목 왼쪽 원형 체크 버튼(`.pj-card-check`, role=checkbox·aria-checked).
완료된 카드는 녹색 원 안 흰 체크 + 회색 제목으로 표시하며 취소선은 없다. 클릭하면 기존 작업 PUT `{completed}`로 완료/취소.
저장 중 중복 클릭을 막고 응답 후 카드·내 작업 개수를 갱신한다. 실패하면 상태를 유지해 재시도할 수 있다.
읽기 전용 작업은 비활성 체크로 상태만 표시하며 카드 높이·표지·하위 작업 펼침과 드래그 구조는 유지한다.
설명에 이미지가 있으면 **첫 이미지를 카드 위 표지**로(아사나, `cardCoverSrc` — template 로 읽어 이미지를 불러오지 않음,
우리 첨부·http(s)·data:image 만, 높이 140px object-fit cover). 표지·펼친 하위 작업은 100px 위·아래에 더해진다.
**하위 작업이 없는 카드**도 같은 모양의 빈 토글(⤷ ▾, `.pj-card-subtoggle.is-empty` — 카드에 마우스를 올리면 보임, 편집 권한자만)이
+27
View File
@@ -525,6 +525,33 @@ function titleVal(d) { return d.getElementById("pj-t-title").value; }
check("[옵션] 폰트 로딩 실패는 이전 설정 유지·재시도 가능", dialog.open && !d.getElementById("pj-options-error").hidden && !select.disabled && w.localStorage.getItem("pj_font") === "pretendard");
}
// 카드 완료 체크 — 상세창과 분리, 중복 요청·실패 복구·읽기 전용.
{
const env = makeEnv(); baseRoutes(env); const d = env.d, w = env.w;
const seed = JSON.parse(d.getElementById("pj-data").textContent);
seed.tasks.find(function (t) { return t.id === 301; }).stage_id = 11;
d.getElementById("pj-data").textContent = JSON.stringify(seed);
const P = await boot(env);
const pending = deferred(); env.route("PUT", /tasks\/101$/, function () { return pending.promise; });
const button = function () { return d.querySelector('.pj-card[data-task-id="101"] .pj-card-check'); };
const puts = function () { return env.calls.filter(function (c) { return c.method === "PUT" && /tasks\/101$/.test(c.url); }); };
check("[카드 완료] 미완료는 선택되지 않은 원형 체크", button().getAttribute("role") === "checkbox" && button().getAttribute("aria-checked") === "false");
button().focus(); button().click(); button().dispatchEvent(new w.MouseEvent("click", { bubbles: true })); await settle();
check("[카드 완료] 체크는 상세창 없이 완료 요청 한 번", puts().length === 1 && puts()[0].body.completed === true && d.getElementById("pj-modal-task").hidden && button().disabled);
pending.resolve({ body: { task: detail(101, "작업 A", { completed_at: "2026-10-02" }) } }); await settle();
check("[카드 완료] 서버 응답 뒤 완료 카드·체크·포커스 반영", !!taskOf(P, 101).completed_at && button().getAttribute("aria-checked") === "true" && !button().disabled && button().closest(".pj-card").classList.contains("is-done") && d.activeElement === button());
env.route("PUT", /tasks\/101$/, function () { return { status: 500, body: { detail: "잠시 오류" } }; });
button().click(); await settle();
check("[카드 완료] 실패하면 완료 상태 유지·버튼 재시도 가능", button().getAttribute("aria-checked") === "true" && !button().disabled && puts()[1].body.completed === false);
env.route("PUT", /tasks\/101$/, function () { return { body: { task: detail(101, "작업 A") } }; });
button().click(); await settle();
check("[카드 완료] 다시 누르면 완료 취소", !taskOf(P, 101).completed_at && button().getAttribute("aria-checked") === "false" && !button().closest(".pj-card").classList.contains("is-done"));
const read = d.querySelector('.pj-card[data-task-id="301"] .pj-card-check'), before = env.calls.length;
check("[카드 완료] 연결된 읽기 전용 작업은 비활성 체크", !!read && read.disabled);
read.dispatchEvent(new w.MouseEvent("click", { bubbles: true })); await settle();
check("[카드 완료] 읽기 전용 체크는 서버 요청을 보내지 않음", env.calls.length === before);
}
clearTimeout(WATCHDOG);
console.log(fails.length ? "\nFAILED: " + fails.join(", ") : "\nALL PASS");
process.exit(fails.length ? 1 : 0);