feat(notes): личные заметки с drag-and-drop сортировкой
- Новая страница notes.html и контроллер public/js/notes.js - Таблица user_notes (id, user_id, title, note, tags, color, sort_order) - Сохранение порядка карточек через PUT /api/notes/reorder - Личные заметки администратора видны всем, тьюторы — только своим - Поддержка user_notes в бэкапе и восстановлении (backup-restore.js) - Обновлена документация AGENTS.md
This commit is contained in:
@@ -0,0 +1,116 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="ru">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>Заметки — Админ-панель</title>
|
||||
<link rel="stylesheet" href="admin.css">
|
||||
<style>
|
||||
.notes-list { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 8px; align-items: stretch; }
|
||||
@media (max-width: 1200px) { .notes-list { grid-template-columns: repeat(3, 1fr); } }
|
||||
@media (max-width: 900px) { .notes-list { grid-template-columns: repeat(2, 1fr); } }
|
||||
@media (max-width: 640px) { .notes-list { grid-template-columns: 1fr; } }
|
||||
.note-card {
|
||||
position: relative;
|
||||
background: var(--card);
|
||||
border: 1px solid var(--border);
|
||||
border-left: 4px solid;
|
||||
border-radius: 12px;
|
||||
padding: 14px 16px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
min-width: 0;
|
||||
transition: box-shadow .15s, transform .15s, opacity .15s;
|
||||
}
|
||||
.note-card:hover { box-shadow: 0 8px 20px rgba(0,0,0,.08); }
|
||||
.note-card.dragging { opacity: .4; border-style: dashed; }
|
||||
.note-drag {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
flex: none;
|
||||
color: var(--muted);
|
||||
font-size: .85rem;
|
||||
cursor: grab;
|
||||
border-radius: 6px;
|
||||
transition: color .15s, background .15s;
|
||||
}
|
||||
.note-drag:hover { color: var(--text); background: rgba(127,127,127,.15); }
|
||||
.note-drag:active { cursor: grabbing; }
|
||||
.note-card-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
|
||||
.note-color-row { display: flex; align-items: center; gap: 10px; }
|
||||
.note-color-swatch { width: 18px; height: 18px; border-radius: 6px; border: 1px solid var(--border); flex: none; cursor: pointer; transition: transform .15s; }
|
||||
.note-color-swatch:hover { transform: scale(1.15); }
|
||||
.note-card-head { display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
|
||||
.note-card-title { font-weight: 600; font-size: .95rem; color: var(--ncolor); word-break: break-word; }
|
||||
.note-tags { display: flex; flex-wrap: wrap; gap: 6px; }
|
||||
.note-tag { font-size: .72rem; padding: 2px 8px; border-radius: 999px; background: rgba(37,99,235,.1); color: #1d4ed8; border: 1px solid rgba(37,99,235,.2); }
|
||||
.note-card-note { font-size: .88rem; color: var(--text); line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
|
||||
.note-empty-note { color: var(--muted); font-style: italic; font-size: .85rem; }
|
||||
.note-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; border-top: 1px solid var(--border); padding-top: 10px; }
|
||||
.note-card-time { font-size: .72rem; color: var(--muted); }
|
||||
.note-card-actions { display: flex; gap: 6px; }
|
||||
.note-card-actions button { font-size: .78rem; }
|
||||
.note-empty { text-align: center; color: var(--muted); padding: 32px 16px; font-size: .9rem; border: 1px dashed var(--border); border-radius: 12px; }
|
||||
.note-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
|
||||
.note-modal-head h3 { margin: 0; font-size: 1.05rem; }
|
||||
</style>
|
||||
</head>
|
||||
<body data-page="notes">
|
||||
<div class="layout">
|
||||
<div class="sidebar" id="sidebar"></div>
|
||||
<div class="main">
|
||||
<div class="page-head">
|
||||
<h2>Заметки</h2>
|
||||
<p class="page-sub">Личные заметки для каждого пользователя</p>
|
||||
<button type="button" class="btn-primary" id="notesNewBtn"><i data-lucide="plus"></i> Новая заметка</button>
|
||||
</div>
|
||||
<div id="notesList" class="notes-list"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal-overlay" id="notesModal">
|
||||
<div class="edit-modal" style="max-width:560px">
|
||||
<div class="note-modal-head">
|
||||
<h3 id="notesModalTitle">Новая заметка</h3>
|
||||
<button type="button" class="icon-btn" id="notesModalClose"><i data-lucide="x"></i></button>
|
||||
</div>
|
||||
<div class="settings-field">
|
||||
<label>Заголовок</label>
|
||||
<input id="notesTitle" class="settings-input" maxlength="200" placeholder="Краткое название заметки">
|
||||
</div>
|
||||
<div class="settings-field">
|
||||
<label>Заметка</label>
|
||||
<textarea id="notesNote" class="settings-input" rows="6" placeholder="Текст заметки"></textarea>
|
||||
</div>
|
||||
<div class="settings-field">
|
||||
<label>Теги</label>
|
||||
<input id="notesTags" class="settings-input" placeholder="через запятую: важно, учеба, запланировать">
|
||||
<div class="hint">Теги разделяются запятой</div>
|
||||
</div>
|
||||
<div class="settings-field">
|
||||
<label>Цвет</label>
|
||||
<div class="note-color-row" id="notesColorRow">
|
||||
<input id="notesColor" type="color" class="settings-input" value="#2563eb" style="width:56px;height:42px;padding:5px;border-radius:8px;cursor:pointer">
|
||||
<span id="notesColorPreview" style="width:16px;height:16px;border-radius:6px;border:1px solid var(--border);flex:none;background:#2563eb"></span>
|
||||
<div class="hint">Цвет заметки</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-foot">
|
||||
<button type="button" class="btn-primary ghost" id="notesCancel">Отмена</button>
|
||||
<button type="button" class="btn-primary" id="notesSave">Сохранить</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="toast" id="toast"></div>
|
||||
|
||||
<script src="vendor/lucide.min.js"></script>
|
||||
<script src="js/datetime.js"></script>
|
||||
<script src="admin.js"></script>
|
||||
<script src="js/notes.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user