feat(project): 좌측 프로젝트 목록을 모든 화면에서 동일하게(순서변경·수정·삭제)

수신함·내 업무·휴지통 화면의 프로젝트 목록에도 프로젝트 화면과 같은
드래그 순서 변경(⣿)·✎ 수정·× 삭제·우클릭 메뉴를 붙인다.

- 트리 동작을 initProject 에서 공용 initSideTree 로 분리
- 새 프로젝트/수정 모달을 _side_modals.html 로 모아 네 화면이 include
- 수신함·휴지통에도 color_palette 전달, 정적 파일 버전 20260925a

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-25 17:29:08 +09:00
parent 56250e6027
commit bbbe14b956
10 changed files with 375 additions and 311 deletions
@@ -1,5 +1,6 @@
{# ── 프로젝트 모듈 좌측 사이드바 (공용) ──────────────────────────────
내 업무 화면(mytasks.html)과 프로젝트 화면(project.html)이 함께 쓴다.
수신함·내 업무·휴지통·프로젝트 화면이 함께 쓴다 — 어느 화면이든 프로젝트
목록은 똑같다(관리자: 드래그 순서 변경·✎ 수정·× 삭제·우클릭 메뉴).
변수:
mention_unread 미확인 @태그 개수 (수신함 배지)
@@ -8,9 +9,11 @@
current_pid 지금 보고 있는 프로젝트 id (내 업무/수신함 화면이면 0)
side_active 'inbox' | 'mytasks' | 'trash' | '' — 개인 메뉴 활성 표시
is_admin 프로젝트 생성/수정/삭제 권한
프로젝트 수정/삭제(✎/×) 버튼은 그 동작을 배선하는 initProject 가 도는
프로젝트 화면에서만 그린다(current_pid 로 판별). #}
<aside class="pj-side">
목록 동작은 project.js 의 initSideTree(첫 화면을 같은 마크업으로 다시 그림),
새 프로젝트/수정 모달은 각 화면이 include 하는 project/_side_modals.html. #}
<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 }}">
<!-- 전체 검색 — 제목·설명·댓글, 내가 볼 수 있는 모든 프로젝트(하위 업무 포함).
결과를 누르면 그 업무 팝업(/project/t/{id})으로. 어디서든 "/" 키로 포커스. -->
<div class="pj-side-search">
@@ -42,29 +45,31 @@
{% endif %}
</nav>
<div class="pj-side-block">
<div class="pj-side-block pj-tree-block">
<div class="pj-side-head">
<span>프로젝트</span>
{# 새 프로젝트 모달(#pj-modal-project)을 갖고 그 동작을 배선하는
화면에서만 보인다 — 수신함에는 그 모달이 없다. #}
{% if is_admin and side_active != 'inbox' %}
{% if is_admin %}
<button type="button" class="pj-icon-btn" id="pj-new-project-side" title="새 프로젝트">+</button>
{% endif %}
</div>
{% macro nav_li(p) %}
<li class="pj-tree-li" data-id="{{ p.id }}"
<li class="pj-tree-li" data-id="{{ p.id }}"{% if is_admin %} draggable="true"{% endif %}
data-name="{{ p.name }}" data-desc="{{ p.description or '' }}"
data-start="{{ p.start_date or '' }}" data-due="{{ p.due_date or '' }}"
data-color="{{ p.color }}" data-status="{{ p.status or 'active' }}"
data-creator="{{ p.created_by or '' }}">
<div class="pj-tree-row {% if p.id == current_pid %}is-active{% endif %}">
<a class="pj-tree-link" href="/project/p/{{ p.id }}">
{% if is_admin %}<span class="pj-tree-handle" title="드래그로 순서 변경">⣿</span>{% endif %}
<a class="pj-tree-link" href="/project/p/{{ p.id }}"{% if is_admin %} draggable="false"{% endif %}>
<span class="pj-tree-avatar" style="background: {{ p.color }}">{{ p.name[0] | upper }}</span>
<span class="pj-tree-name">{{ p.name }}</span>
</a>
{% if is_admin and current_pid %}
{% if is_admin %}
<span class="pj-tree-acts">
<button type="button" class="pj-icon-btn pj-tree-edit" title="프로젝트 수정">✎</button>
<button type="button" class="pj-icon-btn pj-tree-edit" data-id="{{ p.id }}"
data-name="{{ p.name }}" data-desc="{{ p.description or '' }}"
data-start="{{ p.start_date or '' }}" data-due="{{ p.due_date or '' }}"
data-color="{{ p.color }}" data-status="{{ p.status or 'active' }}" title="프로젝트 수정">✎</button>
<button type="button" class="pj-icon-btn pj-tree-del" data-id="{{ p.id }}" data-name="{{ p.name }}" data-creator="{{ p.created_by }}" title="프로젝트 삭제">×</button>
</span>
{% endif %}
@@ -0,0 +1,54 @@
{# ── 좌측 프로젝트 목록(project/_side.html)용 모달 (공용) ──────────────
"+" 새 프로젝트 / ✎ 프로젝트 수정 — 수신함·내 업무·휴지통·프로젝트 화면이
모두 include 한다(동작은 project.js 의 initSideTree). 관리자만 쓰므로
관리자에게만 그린다. 색상 원은 window.PJ_COLORS(color_palette). #}
<script>
window.PJ_COLORS = {{ color_palette | tojson }};
</script>
{% if is_admin %}
<!-- 새 프로젝트 모달 — 좌측 프로젝트 목록의 + 버튼 -->
<div class="pj-modal" id="pj-modal-project" hidden>
<div class="pj-modal-card">
<h3>새 프로젝트</h3>
<label>이름<input type="text" id="pj-f-name" placeholder="프로젝트 이름" /></label>
<label>설명<textarea id="pj-f-desc" rows="2"></textarea></label>
<label>마감일<input type="date" id="pj-f-due" /></label>
<label>색상
<span class="pj-color-palette" id="pj-f-colors"></span>
</label>
<div class="pj-field-label">멤버
<div class="pj-member-picker" id="pj-f-members">불러오는 중…</div>
</div>
<div class="pj-modal-actions">
<button type="button" class="pj-btn" data-close>취소</button>
<button type="button" class="pj-btn pj-btn-primary" id="pj-save-project">만들기</button>
</div>
</div>
</div>
<!-- 프로젝트 수정 모달 — 좌측 프로젝트 목록의 ✎ 버튼 / 우클릭 "수정" -->
<div class="pj-modal" id="pj-modal-edit" hidden>
<div class="pj-modal-card">
<h3>프로젝트 수정</h3>
<input type="hidden" id="pj-e-id" />
<label>이름<input type="text" id="pj-e-name" placeholder="프로젝트 이름" /></label>
<label>설명<textarea id="pj-e-desc" rows="2"></textarea></label>
<div class="pj-form-row">
<label>시작일<input type="date" id="pj-e-start" /></label>
<label>마감일<input type="date" id="pj-e-due" /></label>
</div>
<label>색상
<span class="pj-color-palette" id="pj-e-colors"></span>
</label>
<label class="pj-time-toggle">
<input type="checkbox" id="pj-e-done" /> 프로젝트 완료 (목록 끝으로 이동·비활성)
</label>
<div class="pj-modal-actions">
<button type="button" class="pj-btn pj-btn-danger" id="pj-delete-project">삭제</button>
<span style="flex:1"></span>
<button type="button" class="pj-btn" data-close>취소</button>
<button type="button" class="pj-btn pj-btn-primary" id="pj-save-edit">저장</button>
</div>
</div>
</div>
{% endif %}
@@ -1,7 +1,7 @@
{% extends "erp_base.html" %}
{% block head_extra %}
<link rel="stylesheet" href="/static/project.css?v=20260924j" />
<link rel="stylesheet" href="/static/project.css?v=20260925a" />
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
{% endblock %}
@@ -96,7 +96,8 @@
</div>
</div>
{% include "project/_side_modals.html" %}
{% include "project/_member_tasks_modal.html" %}
<script src="/static/project.js?v=20260924j" defer></script>
<script src="/static/project.js?v=20260925a" defer></script>
{% endblock %}
@@ -1,7 +1,7 @@
{% extends "erp_base.html" %}
{% block head_extra %}
<link rel="stylesheet" href="/static/project.css?v=20260924j" />
<link rel="stylesheet" href="/static/project.css?v=20260925a" />
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
{% endblock %}
@@ -66,25 +66,7 @@
</div>
</div>
<!-- 새 프로젝트 모달 — 좌측 프로젝트 목록의 + 버튼(프로젝트 화면과 동일 폼) -->
<div class="pj-modal" id="pj-modal-project" hidden>
<div class="pj-modal-card">
<h3>새 프로젝트</h3>
<label>이름<input type="text" id="pj-f-name" placeholder="프로젝트 이름" /></label>
<label>설명<textarea id="pj-f-desc" rows="2"></textarea></label>
<label>마감일<input type="date" id="pj-f-due" /></label>
<label>색상
<span class="pj-color-palette" id="pj-f-colors"></span>
</label>
<div class="pj-field-label">멤버
<div class="pj-member-picker" id="pj-f-members">불러오는 중…</div>
</div>
<div class="pj-modal-actions">
<button type="button" class="pj-btn" data-close>취소</button>
<button type="button" class="pj-btn pj-btn-primary" id="pj-save-project">만들기</button>
</div>
</div>
</div>
{% include "project/_side_modals.html" %}
<!-- 댓글만 보는 채팅형 팝업 — 업무 행의 말풍선 아이콘 더블클릭 -->
<div class="pj-modal" id="pj-modal-comments" hidden>
@@ -108,9 +90,6 @@
{% include "project/_member_tasks_modal.html" %}
<script>
window.PJ_COLORS = {{ color_palette | tojson }};
</script>
<script id="pj-mytasks-data" type="application/json">
{
"tasks": {{ my_tasks | tojson }},
@@ -119,5 +98,5 @@
"today": {{ today | tojson }}
}
</script>
<script src="/static/project.js?v=20260924j" defer></script>
<script src="/static/project.js?v=20260925a" defer></script>
{% endblock %}
@@ -1,7 +1,7 @@
{% extends "erp_base.html" %}
{% block head_extra %}
<link rel="stylesheet" href="/static/project.css?v=20260924j" />
<link rel="stylesheet" href="/static/project.css?v=20260925a" />
<!-- 구글 머티리얼 심볼(담당자 아이콘 등) — self-host -->
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
<!-- 타임라인 vis-timeline — self-host -->
@@ -195,51 +195,7 @@
</div>
</div>
<!-- 새 프로젝트 모달 — 좌측 프로젝트 목록의 + 버튼(홈 화면과 동일 폼) -->
<div class="pj-modal" id="pj-modal-project" hidden>
<div class="pj-modal-card">
<h3>새 프로젝트</h3>
<label>이름<input type="text" id="pj-f-name" placeholder="프로젝트 이름" /></label>
<label>설명<textarea id="pj-f-desc" rows="2"></textarea></label>
<label>마감일<input type="date" id="pj-f-due" /></label>
<label>색상
<span class="pj-color-palette" id="pj-f-colors"></span>
</label>
<div class="pj-field-label">멤버
<div class="pj-member-picker" id="pj-f-members">불러오는 중…</div>
</div>
<div class="pj-modal-actions">
<button type="button" class="pj-btn" data-close>취소</button>
<button type="button" class="pj-btn pj-btn-primary" id="pj-save-project">만들기</button>
</div>
</div>
</div>
<!-- 프로젝트 수정 모달 — 좌측 프로젝트 목록의 ✎ 버튼 -->
<div class="pj-modal" id="pj-modal-edit" hidden>
<div class="pj-modal-card">
<h3>프로젝트 수정</h3>
<input type="hidden" id="pj-e-id" />
<label>이름<input type="text" id="pj-e-name" placeholder="프로젝트 이름" /></label>
<label>설명<textarea id="pj-e-desc" rows="2"></textarea></label>
<div class="pj-form-row">
<label>시작일<input type="date" id="pj-e-start" /></label>
<label>마감일<input type="date" id="pj-e-due" /></label>
</div>
<label>색상
<span class="pj-color-palette" id="pj-e-colors"></span>
</label>
<label class="pj-time-toggle">
<input type="checkbox" id="pj-e-done" /> 프로젝트 완료 (목록 끝으로 이동·비활성)
</label>
<div class="pj-modal-actions">
<button type="button" class="pj-btn pj-btn-danger" id="pj-delete-project">삭제</button>
<span style="flex:1"></span>
<button type="button" class="pj-btn" data-close>취소</button>
<button type="button" class="pj-btn pj-btn-primary" id="pj-save-edit">저장</button>
</div>
</div>
</div>
{% include "project/_side_modals.html" %}
<!-- 세션 추가/편집 모달 — 보드의 "+ 세션 추가" 버튼과 세션 헤더의 ✎(세션 편집) 공용 -->
<div class="pj-modal" id="pj-modal-stage" hidden>
@@ -484,7 +440,6 @@
{% include "project/_member_tasks_modal.html" %}
<script>
window.PJ_COLORS = {{ color_palette | tojson }};
window.PJ_STAGE_COLORS = {{ stage_color_palette | tojson }};
</script>
<!-- 데이터 -->
@@ -505,5 +460,5 @@
</script>
<script src="/static/vendor/vis-timeline/vis-timeline-graph2d.min.js"></script>
<script src="/static/project.js?v=20260924j" defer></script>
<script src="/static/project.js?v=20260925a" defer></script>
{% endblock %}
@@ -1,7 +1,7 @@
{% extends "erp_base.html" %}
{% block head_extra %}
<link rel="stylesheet" href="/static/project.css?v=20260924j" />
<link rel="stylesheet" href="/static/project.css?v=20260925a" />
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
{% endblock %}
@@ -65,7 +65,8 @@
</div>
</div>
{% include "project/_side_modals.html" %}
{% include "project/_member_tasks_modal.html" %}
<script src="/static/project.js?v=20260924j" defer></script>
<script src="/static/project.js?v=20260925a" defer></script>
{% endblock %}