feat(project): collapse meeting months by year

This commit is contained in:
2026-10-04 14:40:58 +09:00
parent 2a1a3e7bd9
commit a2a39671b9
8 changed files with 77 additions and 7 deletions
@@ -8,7 +8,7 @@
<link rel="stylesheet" href="/static/erp.css?v=20260615b" />
<link rel="stylesheet" href="/static/erp-dialog.css?v=20260930a" />
{% block head_extra %}{% endblock %}
<link rel="stylesheet" href="/static/project-goal-nav.css?v=20261004b" />
<link rel="stylesheet" href="/static/project-goal-nav.css?v=20261004d" />
<script>
try { document.documentElement.dataset.pjFont = localStorage.getItem('pj_font') || 'system'; } catch (_) {}
window.PJ_HOLIDAYS = {{ (pj_kr_holidays or {}) | tojson }};
@@ -17,8 +17,8 @@
프로젝트 관리의 모든 화면에 들어가므로 여기서 한 번 넘긴다(main.py 의 Jinja 전역). #}
<script>window.PJ_HOLIDAYS = {{ (pj_kr_holidays or {}) | tojson }};</script>
{# 모든 프로젝트 화면에서 같은 회의록 트리를 사용한다. #}
<link rel="stylesheet" href="/static/project-goal-nav.css?v=20261004b" />
<script src="/static/project-goal-nav.js?v=20261004b" defer></script>
<link rel="stylesheet" href="/static/project-goal-nav.css?v=20261004d" />
<script src="/static/project-goal-nav.js?v=20261004d" defer></script>
<aside class="pj-side" data-is-admin="{{ 'true' if is_admin else 'false' }}"
data-is-super="{{ 'true' if user.is_super_admin else 'false' }}"
data-me="{{ user.email }}">
@@ -66,9 +66,16 @@
<div class="pj-side-goal-years" id="pj-side-goal-years"{% if not goal_open %} hidden{% endif %}>
{% for y in (goal_years or []) %}
<div class="pj-side-goal-branch" data-goal-year="{{ y }}">
{# 화살표는 하위 월을 접고 펼치고, 연도 글자는 기존 목표 화면을 연다. #}
<div class="pj-side-goal-year-row">
<button type="button" class="pj-side-goal-year-toggle" aria-expanded="true"
aria-controls="pj-side-meeting-months-{{ y }}" aria-label="{{ y }}년 하위 월 접기" title="하위 월 접기">
<span class="material-symbols-outlined" aria-hidden="true">chevron_right</span>
</button>
<a class="pj-side-goal-year{% if side_active == 'goals' and y == goal_year_active %} is-active{% endif %}"
href="/project/goals/{{ y }}">{{ y }}년</a>
<div class="pj-side-meeting-months" data-current-week="{{ week if goal_month is defined else '' }}"></div>
</div>
<div class="pj-side-meeting-months" id="pj-side-meeting-months-{{ y }}" data-current-week="{{ week if goal_month is defined else '' }}"></div>
</div>
{% endfor %}
{% if is_admin %}
@@ -571,6 +571,7 @@
<p class="pjh-lead">월 목표를 기준으로 지난주 결과를 리뷰하고 이번주 할 일과 금액 목표를 정하는 화면입니다. 연간 목표의 월 계획, 실적 모듈의 매출, 주별 결정 사항을 함께 확인합니다. 직원은 조회할 수 있고, 생성·입력·삭제는 관리자만 할 수 있습니다.</p>
<h3 id="meetings-week">회의록 열기와 주차 기준</h3>
<p>왼쪽 연도 앞 화살표를 누르면 해당 연도의 하위 월 전체를 접거나 펼칠 수 있습니다. 연도 글자를 누르면 연간 목표를 엽니다. 연도와 월의 접기·펼치기 선택은 이 브라우저에 기억됩니다.</p>
<ol class="pjh-steps">
<li>왼쪽 <span class="pjh-ui">목표</span>에서 연도를 선택하고 표 머리의 <b>월 이름</b>을 누릅니다.</li>
<li>이미 만든 회의록은 왼쪽 목표 연도 아래의 <b>월 폴더</b>에서도 열 수 있습니다. 폴더 아이콘과 월 이름을 눌러 접거나 펼치고, 주차·날짜 항목을 누르면 오른쪽 회의록만 바뀝니다. 왼쪽 메뉴와 스크롤 위치는 유지됩니다. 입력한 칸은 이동 전에 저장하며, 저장에 실패하면 현재 회의록을 유지합니다. 접기·펼치기는 이 브라우저에 기억됩니다.</li>
+9
View File
@@ -1,6 +1,15 @@
/* 목표 연도 아래 월 폴더와 주간 회의록 — 좁은 왼쪽 메뉴에서도 글자는 한 줄로 표시한다. */
.pj-side-goal-branch { min-width: 0; }
.pj-side-goal-year-row { display: flex; align-items: center; min-width: 0; }
.pj-side-goal-year-row .pj-side-goal-year { flex: 1; min-width: 0; }
/* 연도 이동 링크와 접기 버튼은 따로 눌러 사용할 수 있다. */
.pj-side-goal-year-toggle { display: flex; align-items: center; justify-content: center; flex: none; width: 24px; height: 30px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--pj-ink-soft); cursor: pointer; }
.pj-side-goal-year-toggle:hover { background: #f1f2f4; }
.pj-side-goal-year-toggle:focus-visible { outline: 2px solid var(--pj-accent); outline-offset: -2px; }
.pj-side-goal-year-toggle .material-symbols-outlined { font-size: 18px; }
.pj-side-goal-year-toggle[aria-expanded="true"] .material-symbols-outlined { transform: rotate(90deg); }
.pj-side-meeting-months { padding-left: 8px; }
.pj-side-meeting-months[hidden] { display: none; }
.pj-side-meeting-month { min-width: 0; }
.pj-side-meeting-month > summary {
display: flex; align-items: center; gap: 5px; padding: 5px 4px;
+22
View File
@@ -6,6 +6,28 @@
if (!branches.length) return;
let loading = false, retry = null;
const navigation = initMeetingNavigation();
// 연도 접기는 월 폴더를 지우지 않고 숨겨서 각 월의 펼침 상태도 그대로 남긴다.
branches.forEach(function (branch) {
const button = branch.querySelector(".pj-side-goal-year-toggle");
const list = branch.querySelector(".pj-side-meeting-months");
if (!button || !list) return;
const key = "pj_goal_year_open:" + branch.dataset.goalYear;
function setOpen(open) {
list.hidden = !open;
button.setAttribute("aria-expanded", String(open));
const action = open ? "하위 월 접기" : "하위 월 펼치기";
button.setAttribute("aria-label", branch.dataset.goalYear + "년 " + action);
button.title = action;
}
let saved = null;
try { saved = localStorage.getItem(key); } catch (_) {}
setOpen(saved !== "0");
button.addEventListener("click", function () {
const open = list.hidden;
setOpen(open);
try { localStorage.setItem(key, open ? "1" : "0"); } catch (_) {}
});
});
// 문자열을 HTML로 해석하지 않고 넣어 회의록 메뉴의 글자를 그대로 표시한다.
function icon(name, cls) {
+2
View File
@@ -727,6 +727,8 @@ description 을 항상 HTML로 취급하기 때문). 두 번 실행하면 이중
왼쪽 목표 연도 아래에는 생성된 회의록만 월별 폴더 트리로 표시한다(`project-goal-nav.js`·`.css`,
`GET /project/api/goals/meeting-nav`, 프로젝트 권한자 조회). 월요일이 속한 월로 묶고 월·주차는 날짜순이다.
월 폴더는 아이콘과 함께 접기·펼치기를 지원하며 `pj_goal_month_open:{연도}:{월}`에 선택을 기억한다.
연도 앞 화살표는 해당 연도의 하위 월 전체를 접고 펼친다(`pj_goal_year_open:{연도}`에 선택 기억, 기본 펼침).
연도 글자를 누르면 기존 연간 목표 화면으로 이동한다. 연도를 접어도 각 월의 접기·펼치기 상태는 유지된다.
현재 회의록의 월은 저장된 선택이 없으면 펼치고, 주간 링크는 그 주의 회의록으로 바로 이동한다. 조회로 회의록을 만들지 않는다.
주간 링크·회의록 안 주차/달 이동은 왼쪽 DOM과 스크롤을 유지하고 오른쪽 문서만 교체한다.
`?content=1`은 `_meeting_content_base.html`로 공통 메뉴 없는 회의록을 반환하며 `project-meeting-panel.js`가 부모 화면에 이동을 전달한다.
+31 -2
View File
@@ -52,7 +52,8 @@ const server = http.createServer(async (req, res) => {
try {
await new Promise(r => server.listen(0, "127.0.0.1", r));
browser = await chromium.launch({ headless: true, executablePath: process.env.PJ_TEST_BROWSER || undefined });
const page = await browser.newPage({ viewport: { width: 1600, height: 1000 } });
const context = await browser.newContext({ viewport: { width: 1600, height: 1000 } });
const page = await context.newPage();
const errors = []; page.on("pageerror", e => errors.push(e.message));
const origin = "http://127.0.0.1:" + server.address().port;
await page.goto(origin + "/project/goals/2026/meetings/9?week=2026-09-28");
@@ -66,6 +67,34 @@ const server = http.createServer(async (req, res) => {
await ready("2026-09-28");
assert.ok((await page.locator(".pj-meeting-panel-host").boundingBox()).height > 500, "실제 ERP 셸에서 오른쪽은 화면 높이를 사용");
await page.locator(".pj-side-meeting-month").first().waitFor();
// 연도 접기·펼치기는 화면 이동 없이 월 DOM과 월별 펼침 상태를 유지한다.
const yearToggle = page.locator('[data-goal-year="2026"] .pj-side-goal-year-toggle');
const yearMonths = page.locator('[data-goal-year="2026"] .pj-side-meeting-months');
await page.evaluate(() => { window.yearMonthIdentity = document.querySelector('[data-goal-year="2026"] .pj-side-meeting-months'); });
const initialUrl = page.url();
await yearToggle.click();
assert.equal(await yearToggle.getAttribute("aria-expanded"), "false");
assert.ok(await yearMonths.isHidden());
await page.locator(".pj-side").screenshot({ path: path.join(OUT, "meeting-year-collapsed.png") });
assert.equal(page.url(), initialUrl); assert.equal(navReads, 1); assert.equal(topReads, 1);
assert.equal(await page.evaluate(() => localStorage.getItem("pj_goal_year_open:2026")), "0");
await yearToggle.focus(); await page.keyboard.press("Enter");
assert.ok(await yearMonths.isVisible());
assert.ok(await page.evaluate(() => document.querySelector('[data-goal-year="2026"] .pj-side-meeting-months') === yearMonthIdentity && yearMonthIdentity.querySelectorAll("details")[8].open));
// 새 화면을 열어도 저장된 접힘 상태가 적용되고, 다른 연도는 영향을 받지 않는다.
await yearToggle.click();
const restored = await page.context().newPage();
await restored.goto(origin + "/project/goals/2026");
await restored.locator(".pj-side-meeting-month").first().waitFor({ state: "attached" });
assert.ok(await restored.locator('[data-goal-year="2026"] .pj-side-meeting-months').isHidden());
assert.equal(await restored.locator('[data-goal-year="2027"] .pj-side-goal-year-toggle').getAttribute("aria-expanded"), "true");
assert.equal(await restored.locator('[data-goal-year="2026"] .pj-side-goal-year').getAttribute("href"), "/project/goals/2026");
await restored.close();
await yearToggle.focus(); await page.keyboard.press("Space");
assert.ok(await yearMonths.isVisible());
await page.locator(".pj-side").screenshot({ path: path.join(OUT, "meeting-year-expanded.png") });
// 위 검증용 새 페이지의 조회 수는 이후 주차 이동 검증의 기준에서 뺀다.
navReads = topReads = 1;
await page.evaluate(() => {
window.sidebarIdentity = document.querySelector(".pj-side");
window.monthIdentity = document.querySelectorAll(".pj-side-meeting-month")[8];
@@ -135,6 +164,6 @@ const server = http.createServer(async (req, res) => {
assert.equal(await annual.evaluate(() => window.pjLiveRefreshState().applied), "2", "원래 화면으로 돌아오면 자동 갱신 재개");
assert.equal(await annual.locator(".pj-side-goal-year.is-active").count(), 1);
await annual.close();
console.log("ALL PASS: stable left DOM/scroll/folders, right-only navigation, back/forward, delayed saves, failed-save draft, inner month links and single sidebar read");
console.log("ALL PASS: year collapse/keyboard/persistence, stable left DOM/scroll/folders, right-only navigation, back/forward, delayed saves, failed-save draft, inner month links and single sidebar read");
} finally { if (releaseSave) releaseSave(); if (browser) await browser.close(); await new Promise(r => server.close(r)); }
})().catch(e => { console.error(e); process.exitCode = 1; });
+1 -1
View File
@@ -162,7 +162,7 @@ def main() -> None:
shell_env.globals["pj_kr_holidays"] = {}
for name, ctx in [("meeting_shell_admin.html", meeting_ctx(True, False, can_sync=False)),
("goals_shell_admin.html", goals_ctx(True))]:
ctx.update(nav_items=[], force_sidebar_collapsed=True, page_title="목표·회의록 검증")
ctx.update(nav_items=[], force_sidebar_collapsed=True, page_title="목표·회의록 검증", goal_years=[2027, 2026])
ctx["user"]["name"] = "Tester"
html = shell_env.get_template("project/goals.html" if name.startswith("goals") else "project/goal_meeting.html").render(**ctx)
path = os.path.join(OUT_DIR, name)