feat(project): compact links and add file icons
This commit is contained in:
@@ -315,9 +315,9 @@
|
||||
<li><b>@태그</b> — <kbd>@</kbd>를 누르면 사람 목록이 뜹니다. 고른 사람의 수신함에 이 작업이 쌓입니다.</li>
|
||||
</ul>
|
||||
<h3>첨부 파일</h3>
|
||||
<p><span class="pjh-ui">파일 추가</span>로 파일을 올립니다(한 파일 최대 20MB). 파일 이름을 누르면 내려받고, <span class="pjh-ui">×</span>로 지웁니다.</p>
|
||||
<p><span class="pjh-ui">파일 추가</span>로 파일을 올립니다(한 파일 최대 20MB). 파일 이름 옆에 이미지·엑셀·텍스트·PPT·문서·PDF 형식별 아이콘이 표시됩니다. 파일 이름을 누르면 내려받고, <span class="pjh-ui">×</span>로 지웁니다.</p>
|
||||
<h3>프로젝트 (다른 프로젝트에 추가)</h3>
|
||||
<p>작업 하나를 <b>여러 프로젝트의 보드에 동시에</b> 보이게 합니다. 예) 신상품 프로젝트의 작업을 디자인 프로젝트 보드에도 올리기.</p>
|
||||
<p>작업 하나를 <b>여러 프로젝트의 보드에 동시에</b> 보이게 합니다. 예) 신상품 프로젝트의 작업을 디자인 프로젝트 보드에도 올리기. 협업자 아래의 프로젝트 줄에 연결 목록·프로젝트 선택·섹션 선택·추가 버튼이 한 줄로 표시됩니다. 창이 좁으면 이 줄을 좌우로 스크롤할 수 있습니다.</p>
|
||||
<ol class="pjh-steps">
|
||||
<li>“프로젝트” 칸에서 프로젝트를 고릅니다.</li>
|
||||
<li>그 프로젝트에서 들어갈 섹션을 고릅니다.</li>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261003f" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20261004a" />
|
||||
<!-- 구글 머티리얼 심볼(담당자 아이콘 등) — self-host -->
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
<!-- 타임라인 vis-timeline — self-host -->
|
||||
@@ -330,6 +330,18 @@
|
||||
</div>
|
||||
<button type="button" class="pj-follow-toggle" id="pj-follow-toggle">협업자로 참여</button>
|
||||
</div>
|
||||
<!-- 프로젝트 연결 — 협업자 아래에서 목록·선택·추가를 한 줄로 표시. -->
|
||||
<div class="pj-meta-row2 pj-projects-row" id="pj-links-block" hidden>
|
||||
<span class="pj-meta-cell-label pj-projects-label">
|
||||
<span class="material-symbols-outlined pj-gicon pj-gicon-sm" aria-hidden="true">link</span> 프로젝트
|
||||
</span>
|
||||
<div class="pj-link-chips" id="pj-link-chips"></div>
|
||||
<div class="pj-link-form" id="pj-link-form">
|
||||
<select id="pj-link-project" aria-label="연결할 프로젝트"><option value="">프로젝트 선택…</option></select>
|
||||
<select id="pj-link-stage" aria-label="연결할 섹션"><option value="">섹션 선택…</option></select>
|
||||
<button type="button" class="pj-btn pj-btn-primary" id="pj-link-save">다른 프로젝트에 추가</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -377,31 +389,15 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 첨부파일 | 연결된 프로젝트 — 나란히 2열(팝업 너비 전체를 나눠 쓴다).
|
||||
기존 업무 편집 시에만. -->
|
||||
<div class="pj-side-2col">
|
||||
<div class="pj-task-extra" id="pj-attach-block" hidden>
|
||||
<div class="pj-extra-head">
|
||||
<span class="material-symbols-outlined pj-gicon pj-gicon-sm">attach_file</span> 첨부 파일
|
||||
<label class="pj-upload-btn">
|
||||
파일 추가<input type="file" id="pj-attach-input" hidden />
|
||||
</label>
|
||||
</div>
|
||||
<ul class="pj-attach-list" id="pj-attach-list"></ul>
|
||||
</div>
|
||||
|
||||
<!-- 연결된 프로젝트 — 멀티호밍(아사나식). -->
|
||||
<div class="pj-task-extra" id="pj-links-block" hidden>
|
||||
<div class="pj-extra-head">
|
||||
<span class="material-symbols-outlined pj-gicon pj-gicon-sm">link</span> 프로젝트
|
||||
</div>
|
||||
<div class="pj-link-chips" id="pj-link-chips"></div>
|
||||
<div class="pj-link-form" id="pj-link-form">
|
||||
<select id="pj-link-project"><option value="">프로젝트 선택…</option></select>
|
||||
<select id="pj-link-stage"><option value="">섹션 선택…</option></select>
|
||||
<button type="button" class="pj-btn pj-btn-primary" id="pj-link-save">다른 프로젝트에 추가</button>
|
||||
</div>
|
||||
<!-- 첨부파일 — 팝업 너비 전체, 기존 업무 편집 시에만. -->
|
||||
<div class="pj-task-extra" id="pj-attach-block" hidden>
|
||||
<div class="pj-extra-head">
|
||||
<span class="material-symbols-outlined pj-gicon pj-gicon-sm">attach_file</span> 첨부 파일
|
||||
<label class="pj-upload-btn">
|
||||
파일 추가<input type="file" id="pj-attach-input" hidden />
|
||||
</label>
|
||||
</div>
|
||||
<ul class="pj-attach-list" id="pj-attach-list"></ul>
|
||||
</div>
|
||||
|
||||
<!-- 댓글(활동) — 팝업 너비 전체를 쓰는 맨 아래 줄. 길어지면 자체
|
||||
@@ -496,5 +492,5 @@
|
||||
</script>
|
||||
|
||||
<script src="/static/vendor/vis-timeline/vis-timeline-graph2d.min.js"></script>
|
||||
<script src="/static/project.js?v=20261003h" defer></script>
|
||||
<script src="/static/project.js?v=20261004a" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
+25
-14
@@ -731,16 +731,14 @@ html.pj-ui-scale #pj-timeline { zoom: calc(1 / var(--pj-z)); --tz: var(--pj-z);
|
||||
margin: 0 -22px 0 -8px; padding: 0 22px 0 8px;
|
||||
}
|
||||
.pj-task-modal-card .pj-modal-actions { flex: none; }
|
||||
/* 위에서 아래로 쭉 쌓는 단일 칼럼 — 메타 → 설명 → 하위업무 →
|
||||
(첨부파일|연결된 프로젝트 2열) → 댓글(팝업 너비 전체) 순서. 각 구간은
|
||||
/* 위에서 아래로 쭉 쌓는 단일 칼럼 — 메타(프로젝트 연결 포함) → 설명 → 하위업무 →
|
||||
첨부파일 → 댓글(팝업 너비 전체) 순서. 각 구간은
|
||||
.pj-task-extra 의 위쪽 구분선으로 나뉘고, 넘치는 부분은 이 전체가 세로로
|
||||
스크롤한다. */
|
||||
.pj-modal-body { display: flex; flex-direction: column; overflow-y: auto; }
|
||||
.pj-desc-block { min-width: 0; padding-top: 10px; margin-top: 14px; border-top: 1px solid #eef0f2; }
|
||||
.pj-subtask-full { min-width: 0; }
|
||||
/* 첨부파일 | 연결된 프로젝트 — 나란히 2열. */
|
||||
.pj-side-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; }
|
||||
.pj-side-2col .pj-task-extra { min-width: 0; }
|
||||
#pj-attach-block { min-width: 0; }
|
||||
/* 댓글 — 팝업 너비 전체, 목록 자체는 더 이상 안에서 스크롤하지 않고
|
||||
팝업 전체(.pj-modal-body)와 같이 늘어난다. */
|
||||
.pj-comment-full .pj-comment-list { max-height: none; overflow-y: visible; }
|
||||
@@ -763,7 +761,6 @@ html.pj-ui-scale #pj-timeline { zoom: calc(1 / var(--pj-z)); --tz: var(--pj-z);
|
||||
.pj-comment-dock .pj-comment-form textarea { border: none !important; box-shadow: none !important; padding: 8px 8px; font-size: 14px; outline: none; background: transparent; }
|
||||
@media (max-width: 720px) {
|
||||
.pj-task-modal-card { width: 100vw; max-width: 100vw; min-width: 0; }
|
||||
.pj-side-2col { display: block; }
|
||||
}
|
||||
.pj-modal-card h3 { margin: 0 0 16px; font-size: var(--pj-heading-size); line-height: var(--pj-heading-leading); font-weight: 500; letter-spacing: normal; }
|
||||
.pj-modal-hint { margin: -6px 0 14px; font-size: 12px; color: #6b7280; }
|
||||
@@ -942,9 +939,17 @@ html.pj-ui-scale #pj-timeline { zoom: calc(1 / var(--pj-z)); --tz: var(--pj-z);
|
||||
|
||||
.pj-attach-list, .pj-comment-list { list-style: none; margin: 0 0 6px; padding: 0; max-height: 160px; overflow-y: auto; }
|
||||
.pj-attach-item { display: flex; align-items: center; gap: 8px; padding: 5px 4px; font-size: 13px; }
|
||||
.pj-attach-item a { color: #2b4a85; text-decoration: none; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.pj-attach-item a { display: flex; align-items: center; gap: 8px; min-width: 0; color: #2b4a85; text-decoration: none; flex: 1; }
|
||||
.pj-attach-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.pj-attach-icon { flex: none; font-size: 22px; color: #6b7280; }
|
||||
.pj-attach-icon.is-image { color: #7c5ce0; }
|
||||
.pj-attach-icon.is-excel { color: #21834d; }
|
||||
.pj-attach-icon.is-text { color: #64748b; }
|
||||
.pj-attach-icon.is-ppt { color: #c85a29; }
|
||||
.pj-attach-icon.is-document { color: #356ac3; }
|
||||
.pj-attach-icon.is-pdf { color: #c43c3c; }
|
||||
.pj-attach-item a:hover { text-decoration: underline; }
|
||||
.pj-attach-size { font-size: 11px; color: #9aa1a9; }
|
||||
.pj-attach-size { flex: none; font-size: 11px; color: #9aa1a9; }
|
||||
|
||||
.pj-comment-item { display: flex; align-items: flex-start; gap: 8px; padding: 7px 2px; }
|
||||
.pj-comment-main { flex: 1; }
|
||||
@@ -1428,21 +1433,27 @@ label.pj-desc-fmtbtn {
|
||||
}
|
||||
|
||||
/* ── 연결된 프로젝트(멀티호밍) 칩 ── */
|
||||
.pj-link-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
|
||||
.pj-projects-row { gap: 8px; padding: 4px 0; flex-wrap: nowrap; overflow-x: auto; }
|
||||
.pj-projects-row[hidden] { display: none; }
|
||||
.pj-projects-label { display: inline-flex; align-items: center; gap: 4px; }
|
||||
.pj-link-chips { display: flex; flex: 0 1 auto; min-width: 32px; max-width: 25%; gap: 6px; overflow-x: auto; }
|
||||
.pj-link-chips .pj-empty-sm { padding: 0 2px; white-space: nowrap; }
|
||||
.pj-projects-row.is-readonly .pj-link-chips { max-width: none; flex: 1; }
|
||||
.pj-link-chip {
|
||||
display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600;
|
||||
display: inline-flex; flex: none; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; white-space: nowrap;
|
||||
padding: 3px 6px 3px 10px; border-radius: 999px; background: #eef0f2; color: #333;
|
||||
}
|
||||
.pj-link-chip .pj-link-del { border: none; background: transparent; cursor: pointer; color: #9aa1a9; font-size: 13px; line-height: 1; padding: 2px; }
|
||||
.pj-link-chip .pj-link-del:hover { color: #c22b10; }
|
||||
/* 세로로 쌓기 — 옆 칼럼이 좁아 가로 배치면 select 글자가 잘린다. */
|
||||
.pj-link-form { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
|
||||
/* 좁은 패널에서도 한 줄을 유지하며 프로젝트 줄 안에서만 가로 스크롤. */
|
||||
.pj-link-form { display: flex; flex: 1; min-width: 360px; gap: 6px; align-items: center; }
|
||||
.pj-link-form[hidden] { display: none; }
|
||||
.pj-link-form select {
|
||||
width: 100% !important; flex: none; margin: 0 !important;
|
||||
width: 0 !important; min-width: 90px; flex: 1; margin: 0 !important;
|
||||
padding: 6px 8px !important; border: 1px solid #d8dce2 !important; border-radius: 8px;
|
||||
font-size: 11.5px !important; font-family: inherit; box-sizing: border-box;
|
||||
}
|
||||
.pj-link-form .pj-btn { align-self: flex-end; }
|
||||
.pj-link-form .pj-btn { flex: none; padding: 6px 8px; font-size: 11.5px; white-space: nowrap; }
|
||||
|
||||
/* ── 알림센터 ── */
|
||||
.pj-inbox { list-style: none; margin: 0; padding: 0; }
|
||||
|
||||
+31
-1
@@ -6567,6 +6567,34 @@
|
||||
});
|
||||
|
||||
// ── 첨부파일 ──
|
||||
function attachmentIconHtml(a) {
|
||||
const suffix = String(a.filename || "").trim().toLowerCase().match(/\.([^.]+)$/);
|
||||
const ext = suffix ? suffix[1] : "";
|
||||
const mime = String(a.content_type || "").split(";")[0].trim().toLowerCase();
|
||||
// 확장자를 먼저 확인 — CSV/마크다운처럼 MIME 이 일반 text 인 파일도 구분한다.
|
||||
let kind;
|
||||
if (/^(png|jpe?g|gif|webp|bmp|svg|tiff?|ico|heic|heif|avif)$/.test(ext)) kind = "image";
|
||||
else if (/^(xlsx?|xlsm|xlsb|xltx?|xltm|csv|ods)$/.test(ext)) kind = "excel";
|
||||
else if (/^(pptx?|pptm|ppsx?|ppsm|potx?|potm|odp)$/.test(ext)) kind = "ppt";
|
||||
else if (/^(docx?|docm|dotx?|dotm|hwp|hwpx|odt|rtf)$/.test(ext)) kind = "document";
|
||||
else if (ext === "pdf") kind = "pdf";
|
||||
else if (/^(txt|text|md|markdown|log|json|xml|ya?ml|ini|conf)$/.test(ext)) kind = "text";
|
||||
else if (mime.startsWith("image/")) kind = "image";
|
||||
else if (/excel|spreadsheet|opendocument.spreadsheet|csv/.test(mime)) kind = "excel";
|
||||
else if (/powerpoint|presentation/.test(mime)) kind = "ppt";
|
||||
else if (/msword|wordprocessing|opendocument.text|hwp|rtf/.test(mime)) kind = "document";
|
||||
else if (mime === "application/pdf") kind = "pdf";
|
||||
else if (mime.startsWith("text/") || /json|xml/.test(mime)) kind = "text";
|
||||
else kind = "file";
|
||||
const types = {
|
||||
image: ["image", "이미지 파일"], excel: ["table_chart", "엑셀 파일"],
|
||||
text: ["article", "텍스트 파일"], ppt: ["slideshow", "PPT 파일"],
|
||||
document: ["description", "문서 파일"], pdf: ["picture_as_pdf", "PDF 파일"],
|
||||
file: ["draft", "파일"],
|
||||
};
|
||||
return '<span class="material-symbols-outlined pj-attach-icon is-' + kind +
|
||||
'" role="img" aria-label="' + types[kind][1] + '" title="' + types[kind][1] + '">' + types[kind][0] + '</span>';
|
||||
}
|
||||
function fmtSize(n) {
|
||||
if (n < 1024) return n + " B";
|
||||
if (n < 1048576) return (n / 1024).toFixed(1) + " KB";
|
||||
@@ -6586,7 +6614,8 @@
|
||||
li.className = "pj-attach-item";
|
||||
// 댓글에 붙은 파일은 "댓글" 표시 — 아래 댓글 목록에도 같은 파일이 보인다(같은 파일임을 알 수 있게).
|
||||
li.innerHTML =
|
||||
'<a href="/project/api/attachments/' + a.id + '/download">' + escapeHtml(a.filename) + "</a>" +
|
||||
'<a href="/project/api/attachments/' + a.id + '/download">' + attachmentIconHtml(a) +
|
||||
'<span class="pj-attach-name">' + escapeHtml(a.filename) + "</span></a>" +
|
||||
(a.comment_id != null ? '<span class="pj-attach-from-comment" title="댓글에 첨부한 파일">댓글</span>' : "") +
|
||||
'<span class="pj-attach-size">' + fmtSize(a.size_bytes) + "</span>" +
|
||||
(canManage && !taskReadOnly ? '<button type="button" class="pj-icon-btn pj-attach-del" data-id="' + a.id + '">×</button>' : "");
|
||||
@@ -7937,6 +7966,7 @@
|
||||
ctxSeq++;
|
||||
taskId = opts.taskId; homeProjectId = opts.projectId; onChange = opts.onChange || null;
|
||||
readOnly = !!opts.readOnly;
|
||||
el("pj-links-block").classList.toggle("is-readonly", readOnly);
|
||||
if (linkForm) linkForm.hidden = readOnly;
|
||||
if (!readOnly) loadProjects();
|
||||
},
|
||||
|
||||
@@ -628,6 +628,62 @@ function titleVal(d) { return d.getElementById("pj-t-title").value; }
|
||||
env.w.localStorage.setItem("pj_side_w", "250"); await boot(env);
|
||||
check("[왼쪽 메뉴] 저장값이 기본 너비와 같아도 명시적으로 복원", env.d.querySelector(".pj-layout").style.getPropertyValue("--pj-side-w") === "250px");
|
||||
}
|
||||
// 파일 형식은 확장자 우선, 확장자 없는 파일은 MIME 으로 구분한다.
|
||||
{
|
||||
const env = makeEnv(); baseRoutes(env);
|
||||
const samples = [
|
||||
["사진.JPG", "application/octet-stream", "image"],
|
||||
["매출.XLSX", "application/octet-stream", "excel"],
|
||||
["매출.csv", "text/csv", "excel"],
|
||||
["메모.txt", "text/plain", "text"],
|
||||
["발표.pptx", "application/octet-stream", "ppt"],
|
||||
["보고서.docx", "application/octet-stream", "document"],
|
||||
["한글.hwpx", "application/octet-stream", "document"],
|
||||
["자료.pdf", "application/pdf", "pdf"],
|
||||
["이미지", "image/png", "image"],
|
||||
["시트", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "excel"],
|
||||
["발표", "application/vnd.ms-powerpoint", "ppt"],
|
||||
["문서", "application/msword", "document"],
|
||||
["텍스트", "text/plain; charset=utf-8", "text"],
|
||||
["<b>파일</b>.zip", "application/zip", "file"],
|
||||
];
|
||||
env.route("GET", /\/project\/api\/tasks\/101\/attachments/, function () {
|
||||
return { body: { attachments: samples.map(function (s, i) {
|
||||
return { id: 80 + i, filename: s[0], content_type: s[1], size_bytes: 123, comment_id: i === 0 ? 7 : null };
|
||||
}) } };
|
||||
});
|
||||
env.route("GET", /\/project\/api\/projects$/, function () { return { body: { projects: [{ id: 2, name: "P2" }] } }; });
|
||||
env.route("GET", /\/project\/api\/projects\/2\/stages$/, function () { return { body: { stages: [{ id: 21, name: "할 일" }] } }; });
|
||||
env.route("POST", /\/project\/api\/tasks\/101\/links$/, function () { return { body: {} }; });
|
||||
const P = await boot(env), d = env.d;
|
||||
await P.openTaskModal(taskOf(P, 101)); await settle();
|
||||
const items = Array.from(d.querySelectorAll("#pj-attach-list .pj-attach-item"));
|
||||
check("[첨부 아이콘] 모든 파일에 형식별 아이콘·이름·다운로드 링크", items.length === samples.length && items.every(function (li, i) {
|
||||
const icon = li.querySelector(".pj-attach-icon");
|
||||
return icon && icon.classList.contains("is-" + samples[i][2]) && icon.getAttribute("aria-label") &&
|
||||
li.querySelector(".pj-attach-name").textContent === samples[i][0] &&
|
||||
li.querySelector("a").getAttribute("href") === "/project/api/attachments/" + (80 + i) + "/download";
|
||||
}));
|
||||
check("[첨부 아이콘] 파일명 HTML 이스케이프·댓글 배지·삭제 유지", !items[13].querySelector("b") && !!items[0].querySelector(".pj-attach-from-comment") && !!items[0].querySelector(".pj-attach-del"));
|
||||
const row = d.getElementById("pj-links-block");
|
||||
check("[프로젝트 줄] 협업자 바로 아래·설명 위로 이동", d.getElementById("pj-followers-row").nextElementSibling === row && !!row.closest(".pj-meta-list") && !row.hidden);
|
||||
d.getElementById("pj-link-project").value = "2";
|
||||
d.getElementById("pj-link-project").dispatchEvent(new env.w.Event("change")); await settle();
|
||||
d.getElementById("pj-link-save").click(); await settle();
|
||||
check("[프로젝트 줄] 선택한 프로젝트·섹션으로 기존 연결 API 호출", env.calls.some(function (c) {
|
||||
return c.method === "POST" && c.url === "/project/api/tasks/101/links" && c.body.project_id === 2 && c.body.stage_id === 21;
|
||||
}));
|
||||
}
|
||||
{
|
||||
const env = makeEnv(); baseRoutes(env);
|
||||
env.route("GET", /\/project\/api\/tasks\/101$/, function () { return { body: { task: detail(101, "읽기 전용", {
|
||||
access: "read", links: [{ project_id: 2, project_name: "P2", stage_name: "할 일" }],
|
||||
}) } }; });
|
||||
const P = await boot(env);
|
||||
await P.openTaskModal(taskOf(P, 101)); await settle();
|
||||
const d = env.d;
|
||||
check("[프로젝트 줄] 읽기 전용은 연결 목록만 표시", d.getElementById("pj-link-form").hidden && d.getElementById("pj-links-block").classList.contains("is-readonly") && !!d.querySelector(".pj-link-chip") && !d.querySelector(".pj-link-del"));
|
||||
}
|
||||
clearTimeout(WATCHDOG);
|
||||
console.log(fails.length ? "\nFAILED: " + fails.join(", ") : "\nALL PASS");
|
||||
process.exit(fails.length ? 1 : 0);
|
||||
|
||||
Reference in New Issue
Block a user