Admin group: single table, defense actions in cells; flash messages as toasts
This commit is contained in:
@@ -108,5 +108,33 @@
|
||||
LMS v0.2.0
|
||||
</footer>
|
||||
</div>
|
||||
<div class="toast-host" id="toast-host" aria-live="polite">
|
||||
<div th:if="${notice}" class="toast-item toast-success" data-toast>
|
||||
<span class="toast-text" th:text="${notice}">…</span>
|
||||
<button class="toast-close" type="button" aria-label="Закрыть" onclick="this.parentElement.remove()">✕</button>
|
||||
</div>
|
||||
<div th:if="${error}" class="toast-item toast-error" data-toast>
|
||||
<span class="toast-text" th:text="${error}">…</span>
|
||||
<button class="toast-close" type="button" aria-label="Закрыть" onclick="this.parentElement.remove()">✕</button>
|
||||
</div>
|
||||
<div th:if="${resetPassword}" class="toast-item toast-warning" data-toast>
|
||||
<span class="toast-text">Новый пароль: <code class="code font-mono" th:text="${resetPassword}">password</code></span>
|
||||
<button class="toast-close" type="button" aria-label="Закрыть" onclick="this.parentElement.remove()">✕</button>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
document.querySelectorAll('[data-toast]').forEach(function (toast) {
|
||||
var timer = setTimeout(function () { toast.remove(); }, 30000);
|
||||
var close = toast.querySelector('.toast-close');
|
||||
if (close) {
|
||||
close.addEventListener('click', function () {
|
||||
clearTimeout(timer);
|
||||
toast.remove();
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user