Content: drag & drop reordering and moving of chapters, sections and articles
- academic: POST /api/v1/content/reorder applies a full tree arrangement in one request — chapter order, section order and section->chapter moves, article order and article->section moves (positions and parent ids updated) - web: POST /admin/content/reorder accepts the tree from JS (CSRF via query param), calls the gateway with the admin token - /learn admin view: draggable handles (⠿) for chapters, sections and articles; drop before/after to reorder, drop into a chapter/section to move; visual indicators; structure is collected from DOM and saved, then page reloads - docs: class diagram method + new sequence diagram for drag & drop
This commit is contained in:
@@ -322,3 +322,30 @@ sequenceDiagram
|
||||
W->>W: сборка матрицы «студент × лабораторная»
|
||||
W-->>A: страница группы (оценки, защиты, поиск, фильтры, сортировка)
|
||||
```
|
||||
|
||||
## 11. Drag & drop материалов (порядок и перенос)
|
||||
|
||||
```mermaid
|
||||
sequenceDiagram
|
||||
autonumber
|
||||
actor A as Администратор
|
||||
participant UI as /learn (JS content-sort.js)
|
||||
participant W as web
|
||||
participant G as gateway
|
||||
participant AC as academic
|
||||
participant DB as PostgreSQL
|
||||
|
||||
A->>UI: тянет за значок ⠿ (глава, раздел или статья)
|
||||
UI->>UI: dragover: выбирает цель и позицию<br/>(до/после либо «внутрь» контейнера)
|
||||
A->>UI: отпускает кнопку мыши
|
||||
UI->>UI: перемещает элемент в DOM (перенос между главами/разделами)
|
||||
UI->>UI: collectTree() — собирает порядок глав, разделов и статей
|
||||
UI->>W: POST /admin/content/reorder?_csrf=... (JSON)
|
||||
W->>G: POST /api/v1/content/reorder (Bearer admin)
|
||||
G->>AC: ReorderTree
|
||||
AC->>DB: UPDATE chapters.position,<br/>sections.chapter_id/position,<br/>articles.section_id/position
|
||||
AC-->>W: 200
|
||||
W-->>UI: {"ok": true}
|
||||
UI->>UI: location.reload() — страница из серверного состояния
|
||||
Note over AC,DB: один запрос применяет и порядок, и перенос между родителями
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user