- migration V5 adds published flag (default true) to chapters/sections/articles
- ContentService: tree(includeHidden) filters, treeAll(), findArticle(includeHidden),
set*Published; public tree/article expose only published items
- admin API: GET /tree/all, GET /all/{chapter}/{section}/{article}, PUT
/{chapters|sections|articles}/{id}/published
- web: learn pages for admins load the full tree, show "скрыто" badges and
publish/hide buttons for every chapter, section and article; hidden articles
open in preview for admins, guests get "not found"; article view carries
published flag
37 lines
1.7 KiB
HTML
37 lines
1.7 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="ru" xmlns:th="http://www.thymeleaf.org" th:replace="~{fragments/base :: layout(~{::title}, ~{::#content})}">
|
||
<head><title th:text="${chapter.title} + ' — LMS'">Глава</title></head>
|
||
<body>
|
||
<div id="content">
|
||
<nav class="text-sm mb-4 breadcrumb">
|
||
<a th:href="@{/learn}" class="nav-link">Материалы</a>
|
||
<span class="nav-sep">/</span>
|
||
<span th:text="${chapter.title}">Глава</span>
|
||
</nav>
|
||
<h1 class="page-title">
|
||
<span th:text="${chapter.title}">Глава</span>
|
||
<span th:if="${!chapter.published}" class="badge badge-warn ml-2">скрыто</span>
|
||
</h1>
|
||
|
||
<div th:if="${#lists.isEmpty(chapter.sections)}" class="card card-body text-muted">
|
||
В этой главе пока нет разделов.
|
||
</div>
|
||
|
||
<div th:each="section : ${chapter.sections}" class="card card-body mb-4">
|
||
<h2 class="group-title">
|
||
<a th:href="@{/learn/{c}/{s}(c=${chapter.slug}, s=${section.slug})}" th:text="${section.title}">Раздел</a>
|
||
<span th:if="${!section.published}" class="badge badge-warn">скрыто</span>
|
||
</h2>
|
||
<ul class="list-pad text-sm">
|
||
<li th:each="article : ${section.articles}">
|
||
<a th:href="@{/learn/{c}/{s}/{a}(c=${chapter.slug}, s=${section.slug}, a=${article.slug})}"
|
||
th:text="${article.title}">Статья</a>
|
||
<span th:if="${!article.published}" class="badge badge-warn ml-1">скрыто</span>
|
||
</li>
|
||
<li th:if="${#lists.isEmpty(section.articles)}" class="text-muted">Статей пока нет</li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
</body>
|
||
</html>
|