feat(project): 프로젝트 색상·아이콘을 아사나식으로(16색 + 아이콘 42종)
- 색상표: 아사나 프로젝트 16색(8칸×2줄, 고른 색에 체크), 새 프로젝트 기본 파랑. 예전 팔레트 색 프로젝트는 그대로 유지(수정 팝업이 첫 칸으로 바꾸지 않음) - 아이콘: 아사나 프로젝트 아이콘과 같은 종류 42개(Material Symbols, self-host 글꼴에 전부 있는 것 확인). 새 프로젝트·수정 팝업에 아이콘 격자(첫 칸 Aa=없음), 사이드바 배지·프로젝트 제목에 흰 아이콘 - DB: projects.icon (scripts/sql/project_db_011_project_icon.sql). 아이콘은 고르거나 바꿨을 때만 보내서 011 적용 전에도 다른 생성·수정은 그대로 동작, 아이콘을 고르면 "마이그레이션 011 필요" 안내(503) - 색상·아이콘 칸을 label 대신 div 로(글자를 누르면 첫 버튼이 눌리던 문제) - 정적 파일 버전 20260926h Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+23
-17
@@ -93,9 +93,11 @@ class ProjectStore:
|
||||
due_date: str | None = None,
|
||||
created_by: str = "",
|
||||
seed_stages: bool = False,
|
||||
icon: str | None = None,
|
||||
) -> dict[str, Any]:
|
||||
nm = store.validate_project_name(name)
|
||||
col = store.validate_color(color)
|
||||
ic = store.validate_project_icon(icon)
|
||||
sd = store.validate_date(start_date)
|
||||
dd = store.validate_date(due_date)
|
||||
with self._pool.connection() as conn:
|
||||
@@ -106,24 +108,27 @@ class ProjectStore:
|
||||
).fetchone()
|
||||
if not parent:
|
||||
raise KeyError(f"상위 프로젝트를 찾을 수 없습니다: {parent_id}")
|
||||
# 아이콘을 고른 경우에만 icon 컬럼을 쓴다 — 마이그레이션 011 전에도
|
||||
# 아이콘 없이 만드는 건 예전처럼 된다.
|
||||
cols = ["parent_id", "name", "description", "color", "owner_email",
|
||||
"start_date", "due_date", "created_by"]
|
||||
vals: list[Any] = [
|
||||
parent_id,
|
||||
nm,
|
||||
store.norm_str(description),
|
||||
col,
|
||||
store.norm_str(owner_email, lower=True),
|
||||
sd,
|
||||
dd,
|
||||
store.norm_str(created_by, lower=True),
|
||||
]
|
||||
if ic:
|
||||
cols.append("icon")
|
||||
vals.append(ic)
|
||||
row = conn.execute(
|
||||
"""
|
||||
INSERT INTO projects
|
||||
(parent_id, name, description, color, owner_email,
|
||||
start_date, due_date, created_by)
|
||||
VALUES (%s,%s,%s,%s,%s,%s,%s,%s)
|
||||
RETURNING *
|
||||
""",
|
||||
(
|
||||
parent_id,
|
||||
nm,
|
||||
store.norm_str(description),
|
||||
col,
|
||||
store.norm_str(owner_email, lower=True),
|
||||
sd,
|
||||
dd,
|
||||
store.norm_str(created_by, lower=True),
|
||||
),
|
||||
f"INSERT INTO projects ({', '.join(cols)}) "
|
||||
f"VALUES ({', '.join(['%s'] * len(cols))}) RETURNING *",
|
||||
vals,
|
||||
).fetchone()
|
||||
pid = row["id"]
|
||||
if seed_stages:
|
||||
@@ -143,6 +148,7 @@ class ProjectStore:
|
||||
"name": lambda v: store.validate_project_name(v),
|
||||
"description": lambda v: store.norm_str(v),
|
||||
"color": lambda v: store.validate_color(v),
|
||||
"icon": lambda v: store.validate_project_icon(v), # 마이그레이션 011
|
||||
"owner_email": lambda v: store.norm_str(v, lower=True),
|
||||
"start_date": lambda v: store.validate_date(v),
|
||||
"due_date": lambda v: store.validate_date(v),
|
||||
|
||||
@@ -381,6 +381,7 @@ def _nav_projects(st: Any, user: dict[str, Any], admin: bool) -> list[dict[str,
|
||||
"id": p["id"],
|
||||
"name": p["name"],
|
||||
"color": p.get("color") or "#4573d2",
|
||||
"icon": p.get("icon") or "",
|
||||
"created_by": p.get("created_by") or "",
|
||||
"description": p.get("description") or "",
|
||||
"start_date": p.get("start_date"),
|
||||
@@ -587,6 +588,7 @@ def my_tasks_page(request: Request) -> HTMLResponse:
|
||||
"avatars": avatars,
|
||||
"priority_labels": store.PRIORITY_LABELS,
|
||||
"color_palette": list(store.COLOR_PALETTE),
|
||||
"project_icons": list(store.PROJECT_ICONS),
|
||||
"today": today_iso,
|
||||
},
|
||||
)
|
||||
@@ -714,6 +716,7 @@ def project_page(request: Request, project_id: int) -> HTMLResponse:
|
||||
"id": p["id"],
|
||||
"name": p["name"],
|
||||
"color": p.get("color") or "#4573d2",
|
||||
"icon": p.get("icon") or "",
|
||||
"start_date": p.get("start_date"),
|
||||
"due_date": p.get("due_date"),
|
||||
"created_by": p.get("created_by") or "",
|
||||
@@ -724,6 +727,7 @@ def project_page(request: Request, project_id: int) -> HTMLResponse:
|
||||
"id": p["id"],
|
||||
"name": p["name"],
|
||||
"color": p.get("color") or "#4573d2",
|
||||
"icon": p.get("icon") or "",
|
||||
"created_by": p.get("created_by") or "",
|
||||
"description": p.get("description") or "",
|
||||
"start_date": p.get("start_date"),
|
||||
@@ -796,6 +800,7 @@ def project_page(request: Request, project_id: int) -> HTMLResponse:
|
||||
"avatars": avatars,
|
||||
"priority_labels": store.PRIORITY_LABELS,
|
||||
"color_palette": list(store.COLOR_PALETTE),
|
||||
"project_icons": list(store.PROJECT_ICONS),
|
||||
"stage_color_palette": list(store.STAGE_COLOR_PALETTE),
|
||||
"today": today.isoformat(),
|
||||
"year": year,
|
||||
@@ -832,6 +837,9 @@ def api_list_projects(request: Request) -> JSONResponse:
|
||||
return JSONResponse({"projects": projects, "tree": _build_tree(projects)})
|
||||
|
||||
|
||||
_PROJECT_ICON_MIGRATION_MSG = "프로젝트 아이콘 기능이 아직 준비되지 않았습니다(DB 마이그레이션 011 필요)."
|
||||
|
||||
|
||||
@router.post("/api/projects")
|
||||
def api_create_project(
|
||||
request: Request, payload: dict[str, Any] = Body(...)
|
||||
@@ -849,9 +857,12 @@ def api_create_project(
|
||||
start_date=payload.get("start_date"),
|
||||
due_date=payload.get("due_date"),
|
||||
created_by=user["email"],
|
||||
icon=payload.get("icon"),
|
||||
)
|
||||
except ValueError as exc:
|
||||
raise HTTPException(status_code=400, detail=str(exc))
|
||||
except UndefinedColumn:
|
||||
raise HTTPException(status_code=503, detail=_PROJECT_ICON_MIGRATION_MSG)
|
||||
return JSONResponse({"project": project}, status_code=201)
|
||||
|
||||
|
||||
@@ -913,6 +924,8 @@ def api_update_project(
|
||||
project = st.update_project(project_id=project_id, fields=payload)
|
||||
except ValueError as exc:
|
||||
raise HTTPException(status_code=400, detail=str(exc))
|
||||
except UndefinedColumn:
|
||||
raise HTTPException(status_code=503, detail=_PROJECT_ICON_MIGRATION_MSG)
|
||||
except KeyError:
|
||||
raise HTTPException(status_code=404, detail="프로젝트를 찾을 수 없습니다.")
|
||||
return JSONResponse({"project": project})
|
||||
@@ -2001,6 +2014,7 @@ def trash_page(request: Request) -> HTMLResponse:
|
||||
"page_subtitle": "삭제한 작업 — 3개월 보관, 관리자만 복구",
|
||||
"force_sidebar_collapsed": True,
|
||||
"color_palette": list(store.COLOR_PALETTE),
|
||||
"project_icons": list(store.PROJECT_ICONS),
|
||||
"trash_enabled": enabled,
|
||||
"items": _trash_view_items(st.list_trash()) if enabled else [],
|
||||
},
|
||||
@@ -2073,6 +2087,7 @@ def inbox_page(request: Request) -> HTMLResponse:
|
||||
"page_subtitle": "나를 태그한 작업과 프로젝트 알림",
|
||||
"force_sidebar_collapsed": True,
|
||||
"color_palette": list(store.COLOR_PALETTE),
|
||||
"project_icons": list(store.PROJECT_ICONS),
|
||||
"notifications": items,
|
||||
"mentioned_tasks": mentioned,
|
||||
"mention_unread": _safe_mention_unread(st, user["email"]),
|
||||
|
||||
@@ -39,16 +39,74 @@ ACTION_STAGE_CHANGED = "stage_changed"
|
||||
ACTION_REOPENED = "reopened"
|
||||
ACTION_SUBTASK_MOVED = "subtask_moved" # 하위 업무를 다른 상위 업무로 옮김(보드 드래그)
|
||||
|
||||
# 프로젝트 색상 팔레트(아사나 느낌) — UI 선택지
|
||||
# 프로젝트 색상 팔레트 — 아사나 프로젝트 색 16가지(아사나 색상표 순서 그대로).
|
||||
# 새 프로젝트 기본색은 DEFAULT_PROJECT_COLOR(파랑). 예전 팔레트 색으로 만든 프로젝트는
|
||||
# 그 색 그대로 둔다(검증은 hex 형식만 본다).
|
||||
COLOR_PALETTE: tuple[str, ...] = (
|
||||
"#c7c4c4", # none(연회색)
|
||||
"#f06a6a", # red
|
||||
"#ec8d71", # orange
|
||||
"#f1bd6c", # yellow-orange
|
||||
"#f8df72", # yellow
|
||||
"#aecf55", # yellow-green
|
||||
"#5da283", # green
|
||||
"#4ecbc4", # blue-green
|
||||
"#9ee7e3", # aqua
|
||||
"#4573d2", # blue
|
||||
"#37a3a3", # teal
|
||||
"#62a420", # green
|
||||
"#e8a33d", # amber
|
||||
"#e8384f", # red
|
||||
"#aa62e3", # purple
|
||||
"#f06a6a", # coral
|
||||
"#5a6772", # slate
|
||||
"#8d84e8", # indigo
|
||||
"#b36bd4", # purple
|
||||
"#f9aaef", # magenta
|
||||
"#f26fb2", # hot-pink
|
||||
"#fc979a", # pink
|
||||
"#6d6e6f", # cool-gray
|
||||
)
|
||||
DEFAULT_PROJECT_COLOR = "#4573d2"
|
||||
|
||||
# 프로젝트 아이콘 — 아사나 프로젝트 아이콘 목록과 같은 종류를 Material Symbols
|
||||
# (앱이 self-host 하는 아이콘 글꼴)의 이름으로. 빈 값/목록 밖 = 아이콘 없음(첫 글자).
|
||||
PROJECT_ICONS: tuple[str, ...] = (
|
||||
"format_list_bulleted", # 목록
|
||||
"view_kanban", # 보드
|
||||
"view_timeline", # 타임라인
|
||||
"calendar_month", # 캘린더
|
||||
"rocket_launch", # 로켓
|
||||
"groups", # 사람들
|
||||
"trending_up", # 그래프
|
||||
"stars", # 별
|
||||
"bug_report", # 버그
|
||||
"lightbulb", # 전구
|
||||
"language", # 지구
|
||||
"settings", # 톱니
|
||||
"menu_book", # 노트
|
||||
"desktop_windows", # 모니터
|
||||
"check_circle", # 체크
|
||||
"adjust", # 과녁
|
||||
"code", # 코드
|
||||
"campaign", # 확성기
|
||||
"forum", # 말풍선
|
||||
"work", # 서류가방
|
||||
"dashboard", # 페이지 레이아웃
|
||||
"flag", # 깃발
|
||||
"extension", # 퍼즐
|
||||
"slideshow", # 발표
|
||||
"confirmation_number", # 티켓
|
||||
"shopping_basket", # 장바구니
|
||||
"cloud", # 구름
|
||||
"payments", # 돈
|
||||
"favorite", # 하트
|
||||
"redeem", # 선물
|
||||
"trophy", # 트로피
|
||||
"photo_camera", # 카메라
|
||||
"palette", # 디자인
|
||||
"school", # 교육
|
||||
"local_shipping", # 배송
|
||||
"inventory_2", # 재고
|
||||
"storefront", # 상점
|
||||
"science", # 실험
|
||||
"videocam", # 영상
|
||||
"description", # 문서
|
||||
"handshake", # 협업
|
||||
"build", # 도구
|
||||
)
|
||||
|
||||
# 세션(칸반 컬럼) 색상 팔레트 — 아사나 태그/커스텀필드에서 쓰는 10색.
|
||||
@@ -187,7 +245,7 @@ def validate_task_title(title: Any) -> str:
|
||||
def validate_color(color: Any) -> str:
|
||||
v = norm_str(color)
|
||||
if not v:
|
||||
return COLOR_PALETTE[0]
|
||||
return DEFAULT_PROJECT_COLOR
|
||||
# 매우 단순한 hex 검증 — #RGB / #RRGGBB
|
||||
if v.startswith("#") and len(v) in (4, 7):
|
||||
try:
|
||||
@@ -195,7 +253,13 @@ def validate_color(color: Any) -> str:
|
||||
return v.lower()
|
||||
except ValueError:
|
||||
pass
|
||||
return COLOR_PALETTE[0]
|
||||
return DEFAULT_PROJECT_COLOR
|
||||
|
||||
|
||||
def validate_project_icon(icon: Any) -> str | None:
|
||||
"""프로젝트 아이콘 — PROJECT_ICONS 안의 이름만, 빈값/목록 밖은 None(첫 글자 표시)."""
|
||||
v = norm_str(icon)
|
||||
return v if v in PROJECT_ICONS else None
|
||||
|
||||
|
||||
def validate_stage_color(color: Any) -> str | None:
|
||||
|
||||
@@ -57,11 +57,11 @@
|
||||
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 '' }}">
|
||||
data-creator="{{ p.created_by or '' }}" data-icon="{{ p.icon or '' }}">
|
||||
<div class="pj-tree-row {% if p.id == current_pid %}is-active{% endif %}">
|
||||
{% 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-avatar{% if p.icon %} has-icon{% endif %}" style="background: {{ p.color }}">{% if p.icon %}<span class="material-symbols-outlined pj-proj-ic">{{ p.icon }}</span>{% else %}{{ p.name[0] | upper }}{% endif %}</span>
|
||||
<span class="pj-tree-name">{{ p.name }}</span>
|
||||
</a>
|
||||
{% if is_admin %}
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
{# ── 좌측 프로젝트 목록(project/_side.html)용 모달 (공용) ──────────────
|
||||
"+" 새 프로젝트 / ✎ 프로젝트 수정 — 수신함·내 업무·휴지통·프로젝트 화면이
|
||||
모두 include 한다(동작은 project.js 의 initSideTree). 관리자만 쓰므로
|
||||
관리자에게만 그린다. 색상 원은 window.PJ_COLORS(color_palette). #}
|
||||
관리자에게만 그린다. 색상 원은 window.PJ_COLORS(color_palette, 아사나 16색),
|
||||
아이콘은 window.PJ_ICONS(project_icons — Material Symbols 이름). #}
|
||||
<script>
|
||||
window.PJ_COLORS = {{ color_palette | tojson }};
|
||||
window.PJ_ICONS = {{ (project_icons or []) | tojson }};
|
||||
</script>
|
||||
{% if is_admin %}
|
||||
<!-- 새 프로젝트 모달 — 좌측 프로젝트 목록의 + 버튼 -->
|
||||
@@ -15,9 +17,13 @@
|
||||
{# 날짜 칸은 project.js enhanceDateInput 이 아사나식 날짜 버튼으로 바꾼다(input 은 숨긴 값 저장소).
|
||||
label 로 감싸지 않는다 — label 안의 버튼을 누르면 숨긴 input 이 다시 눌리는 문제가 생긴다. #}
|
||||
<div class="pj-field-label">마감일<input type="date" id="pj-f-due" /></div>
|
||||
<label>색상
|
||||
{# 색상·아이콘은 label 로 감싸지 않는다 — label 글자를 누르면 첫 버튼이 눌린다. #}
|
||||
<div class="pj-field-label">색상
|
||||
<span class="pj-color-palette" id="pj-f-colors"></span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="pj-field-label">아이콘
|
||||
<div class="pj-icon-palette" id="pj-f-icons"></div>
|
||||
</div>
|
||||
<div class="pj-field-label">멤버
|
||||
<div class="pj-member-picker" id="pj-f-members">불러오는 중…</div>
|
||||
</div>
|
||||
@@ -40,9 +46,12 @@
|
||||
<input type="date" id="pj-e-start" />
|
||||
<input type="date" id="pj-e-due" />
|
||||
</div>
|
||||
<label>색상
|
||||
<div class="pj-field-label">색상
|
||||
<span class="pj-color-palette" id="pj-e-colors"></span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="pj-field-label">아이콘
|
||||
<div class="pj-icon-palette" id="pj-e-icons"></div>
|
||||
</div>
|
||||
<label class="pj-time-toggle">
|
||||
<input type="checkbox" id="pj-e-done" /> 프로젝트 완료 (목록 끝으로 이동·비활성)
|
||||
</label>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20260926g" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20260926h" />
|
||||
<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=20260926g" defer></script>
|
||||
<script src="/static/project.js?v=20260926h" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20260926g" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20260926h" />
|
||||
<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=20260926g" defer></script>
|
||||
<script src="/static/project.js?v=20260926h" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20260926g" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20260926h" />
|
||||
<!-- 구글 머티리얼 심볼(담당자 아이콘 등) — self-host -->
|
||||
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
|
||||
<!-- 타임라인 vis-timeline — self-host -->
|
||||
@@ -48,7 +48,7 @@
|
||||
같은 마크업으로 다시 그린다. -->
|
||||
<div class="pj-title-wrap">
|
||||
<h1 class="pj-project-title">
|
||||
<span class="pj-project-title-pill" style="--pj-color: {{ project.color or '#4573d2' }}">{{ project.name }}</span>
|
||||
<span class="pj-project-title-pill" style="--pj-color: {{ project.color or '#4573d2' }}">{% if project.icon %}<span class="material-symbols-outlined pj-pill-ic">{{ project.icon }}</span>{% endif %}{{ project.name }}</span>
|
||||
</h1>
|
||||
<div class="pj-title-members" id="pj-member-list">
|
||||
{% for m in members %}
|
||||
@@ -466,5 +466,5 @@
|
||||
</script>
|
||||
|
||||
<script src="/static/vendor/vis-timeline/vis-timeline-graph2d.min.js"></script>
|
||||
<script src="/static/project.js?v=20260926g" defer></script>
|
||||
<script src="/static/project.js?v=20260926h" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends "erp_base.html" %}
|
||||
|
||||
{% block head_extra %}
|
||||
<link rel="stylesheet" href="/static/project.css?v=20260926g" />
|
||||
<link rel="stylesheet" href="/static/project.css?v=20260926h" />
|
||||
<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=20260926g" defer></script>
|
||||
<script src="/static/project.js?v=20260926h" defer></script>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user