Docker/prod deployment:
- multi-stage Dockerfile (JDK21 build, JRE21 run), docker-compose.prod.yml,
nginx config for lms.our-place.ru, deploy.sh; DEPLOY/IMPORT guides (UI flow)
- Fix Docker 401: LMS_JWT_JWK_SET_URI for academic/progress; forward-headers
Variant distribution (lab page only):
- round-robin by student level, shared random queue across selected groups,
least-used variants, manual pins always preserved; occupied/dup labels
- setup page: single form + one «Сохранить всё», batch level/variant for
selected students (checkboxes)
Grades, defense, materials:
- publication gate + comment lists; defense CSV import (2/3 cols, quotes)
- additional task after defense ("начать заново"); enroll/unenroll students
from group page; temporary-password lock (no navigation until changed) and
persistent "Смена пароля"; forced change once
- chapter page /learn/{c}; header: LMS home, Войти, user -> dashboard,
compact theme toggle; responsive mobile header
- markdown: single newlines are soft breaks; highlight.js with light/dark themes
- lab/content imports ZIP-only (lab.yaml+README+variants/assets,
chapters tree+assets); duplicate lab numbers rejected; variant ordering
and date defaults honored
Fixes:
- 500 on student create (@MapsId set before persist); broken dialogs/JS refs in group page
216 lines
14 KiB
HTML
216 lines
14 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="ru" xmlns:th="http://www.thymeleaf.org" th:replace="~{fragments/base :: layout(~{::title}, ~{::#content})}">
|
||
<head><title>Материалы — LMS</title></head>
|
||
<body>
|
||
<div id="content">
|
||
<div class="flex items-center justify-between gap-4 mb-6">
|
||
<h1 class="page-title">Учебные материалы</h1>
|
||
<div th:if="${currentUser != null and currentUser.admin}" class="flex gap-2">
|
||
<button class="btn btn-primary" type="button" onclick="openModal('modal-new-article')">+ Статья</button>
|
||
<button class="btn btn-secondary" type="button" onclick="openModal('modal-import')">Импорт zip</button>
|
||
<button class="btn btn-secondary" type="button" onclick="openModal('modal-new-chapter')">+ Глава</button>
|
||
</div>
|
||
</div>
|
||
<div th:if="${notice}" class="alert alert-success" th:text="${notice}"></div>
|
||
<div th:if="${error}" class="alert alert-error" th:text="${error}"></div>
|
||
|
||
<div th:if="${tree == null || #lists.isEmpty(tree.chapters)}" class="card card-body text-muted">
|
||
Материалы ещё не добавлены.
|
||
</div>
|
||
|
||
<details th:each="chapter, chStat : ${tree?.chapters}" class="card mb-4 accordion" th:attr="open=${chStat.last}">
|
||
<summary class="card-body acc-head">
|
||
<h2 class="section-title acc-title" th:text="${chapter.title}">Глава</h2>
|
||
<span class="acc-arrow" aria-hidden="true"></span>
|
||
</summary>
|
||
<div class="card-body acc-body">
|
||
<div class="flex flex-wrap items-center justify-between gap-4 mb-4">
|
||
<h2 class="section-title" th:text="${chapter.title}">Глава</h2>
|
||
<div th:if="${currentUser != null and currentUser.admin}" class="flex flex-wrap gap-2">
|
||
<button class="btn btn-secondary btn-sm" type="button"
|
||
th:data-modal="|modal-rename-chapter-${chapter.id}|" onclick="openModalData(this)">Переименовать</button>
|
||
<form th:action="@{/admin/content/chapters/{id}/delete(id=${chapter.id})}" method="post"
|
||
onsubmit="return confirm('Удалить главу со всеми разделами и статьями?')">
|
||
<input type="hidden" name="_csrf" th:value="${csrfToken}">
|
||
<button class="btn btn-danger btn-sm" type="submit">Удалить главу</button>
|
||
</form>
|
||
</div>
|
||
</div>
|
||
|
||
<p th:if="${#lists.isEmpty(chapter.sections)}" class="text-sm text-muted">Разделов пока нет</p>
|
||
|
||
<details th:each="section : ${chapter.sections}" class="mt-4 sub-acc">
|
||
<summary class="sub-head">
|
||
<h3 class="group-title m-0">
|
||
<span class="sub-arrow" aria-hidden="true"></span>
|
||
<a th:href="@{/learn/{c}/{s}(c=${chapter.slug}, s=${section.slug})}" th:text="${section.title}">Раздел</a>
|
||
</h3>
|
||
</summary>
|
||
<div class="flex flex-wrap items-center justify-between gap-4 sub-actions">
|
||
<div class="spacer"></div>
|
||
<div th:if="${currentUser != null and currentUser.admin}" class="flex flex-wrap gap-2">
|
||
<button class="btn btn-secondary btn-sm" type="button"
|
||
th:data-modal="|modal-rename-section-${section.id}|" onclick="openModalData(this)">Переименовать</button>
|
||
<button class="btn btn-secondary btn-sm" type="button"
|
||
th:data-modal="|modal-move-${section.id}|" onclick="openModalData(this)">Перенести статьи</button>
|
||
<form class="inline-form" th:action="@{/admin/content/sections/{id}/delete(id=${section.id})}" method="post"
|
||
onsubmit="return confirm('Удалить раздел со всеми статьями?')">
|
||
<input type="hidden" name="_csrf" th:value="${csrfToken}">
|
||
<button class="btn btn-danger btn-sm" type="submit">Удалить раздел</button>
|
||
</form>
|
||
</div>
|
||
</div>
|
||
<ul class="list-pad text-sm">
|
||
<li th:each="article : ${section.articles}" class="flex items-center gap-2">
|
||
<a th:href="@{/learn/{c}/{s}/{a}(c=${chapter.slug}, s=${section.slug}, a=${article.slug})}"
|
||
th:text="${article.title}">Статья</a>
|
||
<th:block th:if="${currentUser != null and currentUser.admin}">
|
||
<button class="btn btn-secondary btn-sm" type="button"
|
||
th:data-modal="|modal-edit-article-${article.id}|" onclick="openModalData(this)">Править</button>
|
||
<form class="inline-form" th:action="@{/admin/content/articles/{id}/delete(id=${article.id})}" method="post"
|
||
onsubmit="return confirm('Удалить статью?')">
|
||
<input type="hidden" name="_csrf" th:value="${csrfToken}">
|
||
<button class="btn btn-danger btn-sm" type="submit">✕</button>
|
||
</form>
|
||
</th:block>
|
||
</li>
|
||
<li th:if="${#lists.isEmpty(section.articles)}" class="text-muted">Статей пока нет</li>
|
||
</ul>
|
||
|
||
<th:block th:if="${currentUser != null and currentUser.admin}">
|
||
<dialog th:id="|modal-rename-section-${section.id}|" class="modal">
|
||
<div class="modal-header">
|
||
<h2 class="modal-title">Переименовать раздел</h2>
|
||
<button class="modal-close" type="button"
|
||
th:data-modal="|modal-rename-section-${section.id}|" onclick="closeModalData(this)">✕</button>
|
||
</div>
|
||
<div class="modal-body">
|
||
<form class="form-stack" th:action="@{/admin/content/sections/{id}/rename(id=${section.id})}" method="post">
|
||
<input type="hidden" name="_csrf" th:value="${csrfToken}">
|
||
<div><label class="label">Название</label>
|
||
<input class="input" name="title" th:value="${section.title}" required></div>
|
||
<button class="btn btn-primary" type="submit">Сохранить</button>
|
||
</form>
|
||
</div>
|
||
</dialog>
|
||
<dialog th:id="|modal-move-${section.id}|" class="modal">
|
||
<div class="modal-header">
|
||
<h2 class="modal-title">Перенести статьи из раздела</h2>
|
||
<button class="modal-close" type="button"
|
||
th:data-modal="|modal-move-${section.id}|" onclick="closeModalData(this)">✕</button>
|
||
</div>
|
||
<div class="modal-body">
|
||
<form class="form-stack" th:action="@{/admin/content/sections/{id}/delete(id=${section.id})}" method="post">
|
||
<input type="hidden" name="_csrf" th:value="${csrfToken}">
|
||
<p class="text-sm text-muted">Выберите раздел-приёмник: статьи перенесутся туда, а текущий раздел будет удалён.</p>
|
||
<div><label class="label">Перенести в раздел</label>
|
||
<select class="input" name="moveTo">
|
||
<option th:each="pair : ${sectionChoices}"
|
||
th:value="${pair['id']}" th:text="${pair['label']}">—</option>
|
||
</select></div>
|
||
<button class="btn btn-primary" type="submit">Перенести и удалить раздел</button>
|
||
</form>
|
||
</div>
|
||
</dialog>
|
||
</th:block>
|
||
</details>
|
||
<th:block th:if="${currentUser != null and currentUser.admin}">
|
||
<dialog th:id="|modal-rename-chapter-${chapter.id}|" class="modal">
|
||
<div class="modal-header">
|
||
<h2 class="modal-title">Переименовать главу</h2>
|
||
<button class="modal-close" type="button"
|
||
th:data-modal="|modal-rename-chapter-${chapter.id}|" onclick="closeModalData(this)">✕</button>
|
||
</div>
|
||
<div class="modal-body">
|
||
<form class="form-stack" th:action="@{/admin/content/chapters/{id}/rename(id=${chapter.id})}" method="post">
|
||
<input type="hidden" name="_csrf" th:value="${csrfToken}">
|
||
<div><label class="label">Название</label>
|
||
<input class="input" name="title" th:value="${chapter.title}" required></div>
|
||
<button class="btn btn-primary" type="submit">Сохранить</button>
|
||
</form>
|
||
</div>
|
||
</dialog>
|
||
</th:block>
|
||
</div>
|
||
</details>
|
||
|
||
<dialog id="modal-import" class="modal">
|
||
<div class="modal-header">
|
||
<h2 class="modal-title">Импорт материалов (zip)</h2>
|
||
<button class="modal-close" type="button" onclick="closeModal('modal-import')">✕</button>
|
||
</div>
|
||
<div class="modal-body">
|
||
<form class="form-stack" th:action="@{/admin/content/import}" method="post" enctype="multipart/form-data">
|
||
<input type="hidden" name="_csrf" th:value="${csrfToken}">
|
||
<p class="text-sm text-muted">
|
||
Структура: <code class="code">chapters/01-глава/01-раздел/01-статья.md</code>, картинки в <code class="code">assets/</code>.
|
||
</p>
|
||
<div><label class="label" for="file">Архив</label>
|
||
<input class="input" id="file" name="file" type="file" accept=".zip" required></div>
|
||
<button class="btn btn-primary" type="submit">Импортировать</button>
|
||
</form>
|
||
</div>
|
||
</dialog>
|
||
|
||
<dialog id="modal-new-chapter" class="modal">
|
||
<div class="modal-header">
|
||
<h2 class="modal-title">Новая глава</h2>
|
||
<button class="modal-close" type="button" onclick="closeModal('modal-new-chapter')">✕</button>
|
||
</div>
|
||
<div class="modal-body">
|
||
<form class="form-stack" th:action="@{/admin/content/chapters/create}" method="post">
|
||
<input type="hidden" name="_csrf" th:value="${csrfToken}">
|
||
<div><label class="label" for="chTitle">Название</label>
|
||
<input class="input" id="chTitle" name="title" required></div>
|
||
<button class="btn btn-primary" type="submit">Создать</button>
|
||
</form>
|
||
</div>
|
||
</dialog>
|
||
|
||
<dialog id="modal-new-article" class="modal">
|
||
<div class="modal-header">
|
||
<h2 class="modal-title">Новая статья</h2>
|
||
<button class="modal-close" type="button" onclick="closeModal('modal-new-article')">✕</button>
|
||
</div>
|
||
<div class="modal-body">
|
||
<form class="form-stack" th:action="@{/admin/content/articles/create}" method="post">
|
||
<input type="hidden" name="_csrf" th:value="${csrfToken}">
|
||
<div><label class="label" for="naChapter">Существующая глава и раздел</label>
|
||
<select class="input" id="naChapter" name="sectionId">
|
||
<option th:each="pair : ${sectionChoices}"
|
||
th:value="${pair['id']}" th:text="${pair['label']}">—</option>
|
||
</select></div>
|
||
<div><label class="label" for="naNewSection">…или новый раздел в выбранной главе</label>
|
||
<input class="input" id="naNewSection" name="newSectionTitle" placeholder="Новый раздел"></div>
|
||
<div><label class="label" for="naTitle">Заголовок статьи</label>
|
||
<input class="input" id="naTitle" name="title" required></div>
|
||
<div><label class="label" for="naBody">Текст (markdown)</label>
|
||
<textarea class="input" id="naBody" name="bodyMd" rows="10"></textarea></div>
|
||
<button class="btn btn-primary" type="submit">Создать</button>
|
||
</form>
|
||
</div>
|
||
</dialog>
|
||
|
||
<th:block th:if="${currentUser != null and currentUser.admin}" th:each="a : ${articles}">
|
||
<dialog th:id="|modal-edit-article-${a.id}|" class="modal">
|
||
<div class="modal-header">
|
||
<h2 class="modal-title">Правка статьи</h2>
|
||
<button class="modal-close" type="button"
|
||
th:data-modal="|modal-edit-article-${a.id}|" onclick="closeModalData(this)">✕</button>
|
||
</div>
|
||
<div class="modal-body">
|
||
<form class="form-stack" th:action="@{/admin/content/articles/{id}/save(id=${a.id})}" method="post">
|
||
<input type="hidden" name="_csrf" th:value="${csrfToken}">
|
||
<div><label class="label">Заголовок</label>
|
||
<input class="input" name="title" th:value="${a.title}" required></div>
|
||
<div><label class="label">Текст (markdown)</label>
|
||
<textarea class="input" name="bodyMd" rows="14" th:text="${a.bodyMd}"></textarea></div>
|
||
<button class="btn btn-primary" type="submit">Сохранить</button>
|
||
</form>
|
||
</div>
|
||
</dialog>
|
||
</th:block>
|
||
</div>
|
||
</body>
|
||
</html>
|