feat(notifications): 알림 종 + 공지 기능 추가
- 헤더 프로필 왼쪽 알림 종: 드롭다운·안읽음 배지·60초 폴링(최초 폴링 도입) - 내 프로젝트 좋아요/즐겨찾기/댓글 시 소유자에게 알림(본인 제외·재토글 도배 방지) - 관리자 공지: /announcements 목록 + 작성/수정/삭제, 등록 시 전 직원에게 fan-out 알림 - notifications/announcements 테이블(멱등) + requireAdmin 가드 + bell/megaphone 아이콘 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
31
public/js/announcements.js
Normal file
31
public/js/announcements.js
Normal file
@@ -0,0 +1,31 @@
|
||||
// 공지 페이지 — 항목별 인라인 수정 폼 토글. (삭제 확인은 comments.js 의 [data-confirm] 핸들러가 처리)
|
||||
// 문서 위임이라 공지 페이지가 아닌 곳에서 로드돼도 해당 요소가 없으면 무동작 → 전 페이지 안전.
|
||||
import { $ } from "./util.js";
|
||||
|
||||
export function initAnnouncements() {
|
||||
document.addEventListener("click", (e) => {
|
||||
// 수정 열기: 보기 숨기고 수정 폼 표시.
|
||||
const eb = e.target.closest("[data-ann-edit]");
|
||||
if (eb) {
|
||||
const id = eb.getAttribute("data-ann-edit");
|
||||
const view = $('[data-ann-view="' + id + '"]');
|
||||
const form = $('[data-ann-editform="' + id + '"]');
|
||||
if (view) view.hidden = true;
|
||||
if (form) {
|
||||
form.hidden = false;
|
||||
const t = $(".ann-input-title", form);
|
||||
if (t) t.focus();
|
||||
}
|
||||
return;
|
||||
}
|
||||
// 수정 취소: 폼 숨기고 보기 복원.
|
||||
const cb = e.target.closest("[data-ann-cancel]");
|
||||
if (cb) {
|
||||
const id = cb.getAttribute("data-ann-cancel");
|
||||
const view = $('[data-ann-view="' + id + '"]');
|
||||
const form = $('[data-ann-editform="' + id + '"]');
|
||||
if (form) form.hidden = true;
|
||||
if (view) view.hidden = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user