feat(project): 하위 업무도 업무처럼 팝업에서 똑같이 편집(아사나식)
하위 업무를 누르면 상위 업무가 아니라 그 하위 업무 자신의 팝업이 열려
제목·담당자·우선순위·마감일·설명·첨부·댓글·팔로워·하위 업무를 업무와
똑같이 고친다.
- 여는 곳: 보드 카드 하위 업무 줄 클릭 / 우클릭 "열기", 업무 팝업 하위
업무 줄의 › 버튼, 공유 링크(/project/t/{id} 가 하위 업무 자신을 연다)
- 제목 위에 상위 업무 경로(누르면 상위 업무로), 세션 칸·프로젝트 연결은 숨김
- GET /api/tasks/{id} 에 parent_title 추가
- 저장해도 보드 목록에 카드로 끼어들지 않게 mergeTask 에서 제외
- 정적 파일 버전 20260925e
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -642,10 +642,9 @@ def task_permalink(request: Request, task_id: int):
|
||||
403,
|
||||
)
|
||||
|
||||
# 하위 업무는 목록에 따로 뜨지 않고 부모 팝업 안에서만 보인다 — 부모를 연다.
|
||||
open_id = task.get("parent_task_id") or task_id
|
||||
# 하위 업무도 업무처럼 자기 팝업으로 연다(아사나식 — 제목 위에 상위 업무 경로).
|
||||
return RedirectResponse(
|
||||
url=f"/project/p/{task['project_id']}?task={open_id}", status_code=303
|
||||
url=f"/project/p/{task['project_id']}?task={task_id}", status_code=303
|
||||
)
|
||||
|
||||
|
||||
@@ -1347,6 +1346,10 @@ def api_get_task(request: Request, task_id: int) -> JSONResponse:
|
||||
if task is None:
|
||||
raise HTTPException(status_code=404, detail="업무를 찾을 수 없습니다.")
|
||||
_require_manage(request, st, user, task["project_id"])
|
||||
# 하위 업무를 팝업으로 열면 제목 위에 상위 업무 경로를 보여준다(아사나식).
|
||||
if task.get("parent_task_id"):
|
||||
parent = st.get_task(task_id=task["parent_task_id"])
|
||||
task["parent_title"] = parent["title"] if parent else ""
|
||||
task["subtasks"] = st.list_tasks(parent_task_id=task_id)
|
||||
task["links"] = st.list_task_links(task_id=task_id)
|
||||
try:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20260925d" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20260925e" />
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
{% endblock %}
|
||||
|
||||
@@ -99,5 +99,5 @@
|
||||
{% include "project/_side_modals.html" %}
|
||||
{% include "project/_member_tasks_modal.html" %}
|
||||
|
||||
<script src="/static/project.js?v=20260925d" defer></script>
|
||||
<script src="/static/project.js?v=20260925e" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20260925d" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20260925e" />
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
{% endblock %}
|
||||
|
||||
@@ -98,5 +98,5 @@
|
||||
"today": {{ today | tojson }}
|
||||
}
|
||||
</script>
|
||||
<script src="/static/project.js?v=20260925d" defer></script>
|
||||
<script src="/static/project.js?v=20260925e" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20260925d" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20260925e" />
|
||||
<!-- 구글 머티리얼 심볼(담당자 아이콘 등) — self-host -->
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
<!-- 타임라인 vis-timeline — self-host -->
|
||||
@@ -245,6 +245,11 @@
|
||||
<!-- 아사나처럼 큰 제목은 이 무테 입력칸 하나뿐이다(위의 작은 안내줄은
|
||||
없앴다 — 버튼 줄 바로 아래 공간을 아낀다). -->
|
||||
<input type="hidden" id="pj-t-id" />
|
||||
<!-- 하위 업무를 열었을 때만 — 아사나처럼 제목 위에 상위 업무 경로. 누르면 상위 업무로. -->
|
||||
<button type="button" class="pj-t-parent" id="pj-t-parent" hidden title="상위 업무 열기">
|
||||
<span class="material-symbols-outlined">subdirectory_arrow_left</span>
|
||||
<span class="pj-t-parent-title" id="pj-t-parent-title"></span>
|
||||
</button>
|
||||
<input type="text" id="pj-t-title" class="pj-t-title-input" placeholder="업무 제목" />
|
||||
|
||||
<div class="pj-modal-body">
|
||||
@@ -460,5 +465,5 @@
|
||||
</script>
|
||||
|
||||
<script src="/static/vendor/vis-timeline/vis-timeline-graph2d.min.js"></script>
|
||||
<script src="/static/project.js?v=20260925d" defer></script>
|
||||
<script src="/static/project.js?v=20260925e" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20260925d" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20260925e" />
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
{% endblock %}
|
||||
|
||||
@@ -68,5 +68,5 @@
|
||||
{% include "project/_side_modals.html" %}
|
||||
{% include "project/_member_tasks_modal.html" %}
|
||||
|
||||
<script src="/static/project.js?v=20260925d" defer></script>
|
||||
<script src="/static/project.js?v=20260925e" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -498,6 +498,17 @@
|
||||
color: var(--pj-ink); box-sizing: border-box;
|
||||
}
|
||||
.pj-t-title-input:focus { outline: none; background: #f6f7f8 !important; border-radius: 8px; }
|
||||
/* 하위 업무 팝업 — 제목 위 상위 업무 경로(아사나식). 누르면 상위 업무로 */
|
||||
.pj-task-modal-card > .pj-t-parent { flex: none; }
|
||||
.pj-t-parent {
|
||||
display: inline-flex; align-items: center; gap: 4px; align-self: flex-start; max-width: 100%;
|
||||
margin: 6px 0 -4px; padding: 2px 6px; border: none; background: transparent; border-radius: 6px;
|
||||
font-size: 12px; color: var(--pj-ink-soft); cursor: pointer;
|
||||
}
|
||||
.pj-t-parent[hidden] { display: none; }
|
||||
.pj-t-parent:hover { background: #f1f2f4; color: var(--pj-ink); }
|
||||
.pj-t-parent .material-symbols-outlined { font-size: 16px; transform: scaleX(-1); }
|
||||
.pj-t-parent-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
/* 메타 정보 — 아사나처럼 "라벨(좌, 고정폭) + 아이콘/값(우)" 목록형 한 줄씩. */
|
||||
.pj-meta-list { display: flex; flex-direction: column; margin-bottom: 4px; }
|
||||
.pj-meta-row2 {
|
||||
@@ -916,6 +927,10 @@ label.pj-desc-fmtbtn { line-height: 26px; }
|
||||
.pj-subtask-row.is-done { opacity: .5; }
|
||||
.pj-subtask-row.is-done .pj-subtask-title { text-decoration: line-through; color: #9aa1a9; }
|
||||
.pj-subtask-row input[type="checkbox"] { width: auto; margin: 0; flex: 0 0 auto; }
|
||||
/* 하위 업무 열기(›) — 줄에 마우스를 올리면 진해진다 */
|
||||
.pj-subtask-open { flex: 0 0 auto; width: 26px; height: 26px; color: #9aa1a9; }
|
||||
.pj-subtask-row:hover .pj-subtask-open { color: var(--pj-ink); }
|
||||
.pj-subtask-open .material-symbols-outlined { font-size: 20px; }
|
||||
.pj-subtask-title {
|
||||
/* flex-basis 는 반드시 0(퍼센트 아님) — auto 로 두면 .pj-modal-card 의 공용
|
||||
input[type=text] 규칙이 준 width:100% 로 넘어가 버려 한 줄 배치가 깨진다. */
|
||||
|
||||
+58
-5
@@ -3292,7 +3292,8 @@
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
showContextMenu(e.clientX, e.clientY, [
|
||||
{ label: "열기 (상위 업무)", onClick: function () { openTaskModal(t); } },
|
||||
{ label: "열기", onClick: function () { openTaskById(sub.id); } },
|
||||
{ label: "상위 업무 열기", onClick: function () { openTaskModal(t); } },
|
||||
{
|
||||
label: sub.completed_at ? "완료 취소" : "완료로 표시",
|
||||
onClick: function () { row.querySelector(".pj-card-sub-check").click(); },
|
||||
@@ -3486,6 +3487,9 @@
|
||||
}
|
||||
if (e.target.closest(".pj-card-sub-check")) return;
|
||||
if (!canManage) return;
|
||||
// 하위 업무 줄을 누르면 상위 업무가 아니라 그 하위 업무 팝업(아사나식).
|
||||
const subRow = e.target.closest(".pj-card-sub");
|
||||
if (subRow) { e.stopPropagation(); openTaskById(parseInt(subRow.dataset.subId, 10)); return; }
|
||||
// 담당자/마감일 칩을 누른 경우엔 업무 팝업 대신 그 자리 편집기를 연다.
|
||||
const hitAssignee = e.target.closest(".pj-card-assignee");
|
||||
if (hitAssignee) { e.stopPropagation(); openAssigneePicker(t, e.clientX, e.clientY); return; }
|
||||
@@ -3919,7 +3923,8 @@
|
||||
delete patch.context_project_id; // 행의 맥락은 그대로
|
||||
tasks[i] = Object.assign({}, x, patch);
|
||||
});
|
||||
if (!found && !(opts && opts.noInsert)) {
|
||||
// 하위 업무(팝업에서 저장·완료)는 목록에 넣지 않는다 — 넣으면 보드에 카드로 뜬다.
|
||||
if (!found && !base.parent_task_id && !(opts && opts.noInsert)) {
|
||||
// 방금 만든 업무 — 맥락이 없으면 visibleTasks() 필터에 걸려 다음
|
||||
// 동기화 때까지 화면에 안 나왔다. 원래 소속 맥락으로 넣는다.
|
||||
if (base.context_project_id == null) base.context_project_id = base.project_id;
|
||||
@@ -4140,7 +4145,10 @@
|
||||
const detail = res.task;
|
||||
if (currentTaskId === task.id) showFollowers(task, detail.followers);
|
||||
if (subtaskBlock) {
|
||||
subtaskBlock.setContext({ taskId: task.id, projectId: task.project_id, canDelete: canDelete });
|
||||
subtaskBlock.setContext({
|
||||
taskId: task.id, projectId: task.project_id, canDelete: canDelete,
|
||||
onOpen: function (sub) { openTaskById(sub.id); },
|
||||
});
|
||||
subtaskBlock.render(detail.subtasks || []);
|
||||
}
|
||||
if (linksBlock) {
|
||||
@@ -4220,13 +4228,51 @@
|
||||
showFollowers(null, null); // 상세를 받으면(loadTaskExtras) 다시 그린다
|
||||
el("pj-attach-block").hidden = !task;
|
||||
el("pj-comment-block").hidden = !task;
|
||||
// 하위 업무도 업무와 같은 팝업·같은 편집(아사나식). 다른 점은 세 가지 —
|
||||
// 제목 위에 상위 업무 경로, 세션 칸 없음(하위 업무는 세션이 없다),
|
||||
// 다른 프로젝트 연결(멀티호밍) 없음.
|
||||
const isSub = !!(task && task.parent_task_id);
|
||||
const parentBtn = el("pj-t-parent");
|
||||
if (parentBtn) {
|
||||
parentBtn.hidden = !isSub;
|
||||
parentBtn.dataset.parentId = isSub ? String(task.parent_task_id) : "";
|
||||
const pt = isSub && tasks.find(function (x) { return x.id === task.parent_task_id; });
|
||||
el("pj-t-parent-title").textContent = isSub ? (task.parent_title || (pt && pt.title) || "상위 업무") : "";
|
||||
}
|
||||
const stageCell = document.querySelector(".pj-meta-cell-stage");
|
||||
if (stageCell) stageCell.style.display = isSub ? "none" : "";
|
||||
if (subtaskBlock) el("pj-subtask-block").hidden = !task;
|
||||
if (linksBlock) el("pj-links-block").hidden = !task;
|
||||
if (linksBlock) el("pj-links-block").hidden = !task || isSub;
|
||||
if (task) { loadAttachments(task.id); loadComments(task.id); loadTaskExtras(task); }
|
||||
openSlidePanel(taskModal);
|
||||
taskSnapshot = taskFormSnapshot();
|
||||
}
|
||||
|
||||
// id 로 업무 팝업 열기 — 하위 업무(보드 카드의 하위 업무 줄, 팝업 안 하위 업무
|
||||
// 목록, 상위 업무 경로)에서 쓴다. 보드 목록(tasks)에는 최상위 업무만 있으므로
|
||||
// 없으면 서버에서 받아 연다(상세 응답엔 parent_title 도 들어 있다).
|
||||
// 팝업에서 다른 업무로 넘어갈 때 저장 안 한 수정이 있으면 먼저 묻는다.
|
||||
async function openTaskById(id) {
|
||||
if (!taskModal.hidden && isTaskDirty()) {
|
||||
const go = await window.erpConfirm(
|
||||
"수정한 내용이 저장되지 않았습니다. 저장하지 않고 이동할까요?",
|
||||
{ okText: "이동", cancelText: "취소" }
|
||||
);
|
||||
if (!go) return;
|
||||
}
|
||||
const t = tasks.find(function (x) { return x.id === id && x.context_project_id === x.project_id; }) ||
|
||||
tasks.find(function (x) { return x.id === id; });
|
||||
if (t) { openTaskModal(t); return; }
|
||||
try {
|
||||
const res = await api("GET", "/project/api/tasks/" + id);
|
||||
if (res && res.task) openTaskModal(res.task);
|
||||
} catch (e) { showToast("업무를 열 수 없습니다: " + e.message, "error"); }
|
||||
}
|
||||
if (el("pj-t-parent")) el("pj-t-parent").addEventListener("click", function () {
|
||||
const pid = parseInt(el("pj-t-parent").dataset.parentId, 10);
|
||||
if (pid) openTaskById(pid);
|
||||
});
|
||||
|
||||
// 마감일 — 달력 아이콘 버튼(날짜가 있으면 옆에 "09/25(목)"). 진짜 값은 숨긴
|
||||
// #pj-t-due(input[type=date])가 들고 있어 저장·변경감지 코드는 그대로다.
|
||||
function syncDueBtn() {
|
||||
@@ -4902,7 +4948,7 @@
|
||||
enhanceAssigneeSelect(addAssignee);
|
||||
const addDue = el("pj-subtask-add-due");
|
||||
const addBtn = el("pj-subtask-add");
|
||||
let taskId = null, projectId = null, canDeleteFn = function () { return false; }, onChange = null;
|
||||
let taskId = null, projectId = null, canDeleteFn = function () { return false; }, onChange = null, onOpen = null;
|
||||
|
||||
async function membersOptionsHtml(pid) {
|
||||
try {
|
||||
@@ -4922,8 +4968,14 @@
|
||||
'<input type="text" class="pj-subtask-title" />' +
|
||||
'<select class="pj-subtask-assignee"><option value="">(미지정)</option>' + optionsHtml + "</select>" +
|
||||
'<input type="date" class="pj-subtask-due" />' +
|
||||
'<button type="button" class="pj-icon-btn pj-subtask-open" title="하위 업무 열기">' +
|
||||
'<span class="material-symbols-outlined">chevron_right</span></button>' +
|
||||
'<button type="button" class="pj-icon-btn pj-subtask-del" title="삭제" hidden>×</button>';
|
||||
const titleInp = li.querySelector(".pj-subtask-title");
|
||||
// 열기 — 이 하위 업무를 업무처럼 팝업 전체로(설명·댓글·첨부·하위 업무까지).
|
||||
li.querySelector(".pj-subtask-open").addEventListener("click", function () {
|
||||
if (onOpen) onOpen(sub);
|
||||
});
|
||||
const doneChk = li.querySelector(".pj-subtask-done");
|
||||
const assigneeSel = li.querySelector(".pj-subtask-assignee");
|
||||
const dueInp = li.querySelector(".pj-subtask-due");
|
||||
@@ -5002,6 +5054,7 @@
|
||||
taskId = opts.taskId; projectId = opts.projectId;
|
||||
canDeleteFn = opts.canDelete || function () { return false; };
|
||||
onChange = opts.onChange || null;
|
||||
onOpen = opts.onOpen || null;
|
||||
if (addAssignee && projectId) {
|
||||
membersOptionsHtml(projectId).then(function (html) {
|
||||
addAssignee.innerHTML = "<option value=''>(미지정)</option>" + html;
|
||||
|
||||
Reference in New Issue
Block a user