fix: скрыть админские действия статей от студентов

This commit is contained in:
2026-10-29 12:01:26 +03:00
parent 2beffd84f1
commit 920d96a0f5
2 changed files with 113 additions and 5 deletions

View File

@@ -44,7 +44,7 @@
<div class="card card-flush">
<table>
<thead><tr><th>Статья</th><th class="th-w-md" data-nosort>Действия</th></tr></thead>
<thead><tr><th>Статья</th><th class="th-w-md" data-nosort th:if="${currentUser != null and currentUser.admin}">Действия</th></tr></thead>
<tbody data-article-list>
<tr th:each="article : ${section.articles}" th:attr="data-article-id=${article.id}">
<td>
@@ -55,7 +55,7 @@
th:text="${article.title}">—</a>
<span th:if="${!article.published}" class="badge badge-warn ml-1">скрыто</span>
</td>
<td class="text-right actions-cell">
<td class="text-right actions-cell" th:if="${currentUser != null and currentUser.admin}">
<a class="btn btn-secondary btn-sm p-2" title="Править статью" aria-label="Править статью"
th:href="@{/learn/{c}/{s}/{a}(c=${chapter.slug}, s=${section.slug}, a=${article.slug}, edit=1)}"><i class="ico bi bi-pencil" aria-hidden="true"></i></a>
<form class="inline-form" th:action="@{/admin/content/articles/toggle-published}" method="post">
@@ -73,7 +73,7 @@
</form>
</td>
</tr>
<tr th:if="${#lists.isEmpty(section.articles)}"><td colspan="2" class="empty">Статей пока нет.</td></tr>
<tr th:if="${#lists.isEmpty(section.articles)}"><td th:colspan="${currentUser != null and currentUser.admin} ? 2 : 1" class="empty">Статей пока нет.</td></tr>
</tbody>
</table>
</div>
@@ -118,7 +118,7 @@
</div>
</dialog>
<dialog id="modal-new-article" class="dlg">
<dialog id="modal-new-article" class="dlg" th:if="${currentUser != null and currentUser.admin}">
<div class="dlg-header">
<h2 class="dlg-title">Новая статья в разделе</h2>
<button class="dlg-close" type="button" aria-label="Закрыть">✕</button>
@@ -143,7 +143,9 @@
</div>
</dialog>
<script th:src="@{/js/content-sort.js(v='36')}" defer></script>
<th:block th:if="${currentUser != null and currentUser.admin}">
<script th:src="@{/js/content-sort.js(v='36')}" defer></script>
</th:block>
</div>
</body>
</html>