Compare commits
2 Commits
322f496d26
...
794c2989a0
| Author | SHA1 | Date | |
|---|---|---|---|
| 794c2989a0 | |||
| 02701a8e9d |
@@ -209,7 +209,20 @@ function attachCommentAutocomplete(input) {
|
||||
/* ---------- Удаление подсказки комментария и всплывающие уведомления ---------- */
|
||||
|
||||
function showToast(text, kind) {
|
||||
var host = $id('toast-host');
|
||||
// уведомления должны быть видны поверх открытой модалки: кладём их в сам <dialog>
|
||||
// (элемент верхнего слоя), иначе они оказываются под ним
|
||||
var dlg = document.querySelector('dialog[open]');
|
||||
var host = null;
|
||||
if (dlg) {
|
||||
host = dlg.querySelector('.toast-host');
|
||||
if (!host) {
|
||||
host = document.createElement('div');
|
||||
host.className = 'toast-host';
|
||||
dlg.appendChild(host);
|
||||
}
|
||||
} else {
|
||||
host = $id('toast-host');
|
||||
}
|
||||
if (!host) return;
|
||||
var toast = document.createElement('div');
|
||||
toast.className = 'toast-item ' + (kind === 'error' ? 'toast-error' : 'toast-success');
|
||||
@@ -663,8 +676,15 @@ document.addEventListener('submit', function (ev) {
|
||||
var btn = form.querySelector('button[type="submit"]');
|
||||
if (btn) btn.disabled = true;
|
||||
fetch(form.action, { method: 'POST', body: new FormData(form), headers: { 'X-Requested-With': 'fetch' } })
|
||||
.then(function (r) { if (r.redirected) throw new Error('сессия истекла — обновите страницу'); return r.text(); })
|
||||
.then(function () { return refreshAssignModal(form.getAttribute('data-refresh')); })
|
||||
.then(function (r) { if (!r.ok) throw new Error('HTTP ' + r.status); return r.text(); })
|
||||
.then(function (html) {
|
||||
// эндпоинты отвечают редиректом на страницу лабы — это норма, не ошибка;
|
||||
// flash-сообщение забираем из отданного HTML
|
||||
var err = /<div[^>]*class="[^"]*toast-item toast-error[^"]*"[^>]*>\s*<span class="toast-text">([^<]*)</.exec(html);
|
||||
var ok = /<span class="toast-text">([^<]*)<\/span>/.exec(html);
|
||||
showToast(err ? err[1].trim() : (ok ? ok[1].trim() : 'Сохранено'), err ? 'error' : 'success');
|
||||
return refreshAssignModal(form.getAttribute('data-refresh'));
|
||||
})
|
||||
.catch(function (e) { showToast('Не удалось сохранить: ' + e.message, 'error'); })
|
||||
.finally(function () { if (btn) btn.disabled = false; });
|
||||
});
|
||||
|
||||
@@ -342,7 +342,7 @@
|
||||
<div class="dlg-body" id="assign-modal-body"></div>
|
||||
</dialog>
|
||||
|
||||
<script th:src="@{/js/admin-group.js(v='29')}" defer></script>
|
||||
<script th:src="@{/js/admin-group.js(v='32')}" defer></script>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -196,7 +196,7 @@
|
||||
</dialog>
|
||||
</th:block>
|
||||
</div>
|
||||
<script th:src="@{/js/admin-lab.js(v='29')}" defer></script>
|
||||
<script th:src="@{/js/admin-lab.js(v='32')}" defer></script>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -13,22 +13,22 @@
|
||||
<noscript>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
|
||||
</noscript>
|
||||
<link rel="icon" type="image/svg+xml" th:href="@{/favicon.svg(v='29')}">
|
||||
<link rel="icon" type="image/svg+xml" th:href="@{/favicon.svg(v='32')}">
|
||||
<!-- v=4: сброс кэша стилей после редизайна; при изменении css поднимать версию -->
|
||||
<link rel="stylesheet" th:href="@{/css/bootstrap.min.css}">
|
||||
<link rel="stylesheet" th:href="@{/css/bootstrap-icons.min.css}">
|
||||
<link rel="stylesheet" th:href="@{/css/app.css(v='29')}">
|
||||
<link id="hljs-light" rel="stylesheet" th:href="@{/css/hljs-github.css(v='29')}">
|
||||
<link id="hljs-dark" rel="stylesheet" th:href="@{/css/hljs-github-dark.css(v='29')}" disabled>
|
||||
<script th:src="@{/js/highlight.min.js(v='29')}" defer></script>
|
||||
<script th:src="@{/js/table-scroll.js(v='29')}" defer></script>
|
||||
<script th:src="@{/js/tablekit.js(v='29')}" defer></script>
|
||||
<link rel="stylesheet" th:href="@{/css/app.css(v='32')}">
|
||||
<link id="hljs-light" rel="stylesheet" th:href="@{/css/hljs-github.css(v='32')}">
|
||||
<link id="hljs-dark" rel="stylesheet" th:href="@{/css/hljs-github-dark.css(v='32')}" disabled>
|
||||
<script th:src="@{/js/highlight.min.js(v='32')}" defer></script>
|
||||
<script th:src="@{/js/table-scroll.js(v='32')}" defer></script>
|
||||
<script th:src="@{/js/tablekit.js(v='32')}" defer></script>
|
||||
<script th:src="@{/js/bootstrap.bundle.min.js}" defer></script>
|
||||
<script th:src="@{/js/theme-init.js(v='29')}"></script>
|
||||
<script th:src="@{/js/app.js(v='29')}" defer></script>
|
||||
<script th:src="@{/js/ui-state.js(v='29')}" defer></script>
|
||||
<script th:src="@{/js/md-content.js(v='29')}" defer></script>
|
||||
<script th:src="@{/js/submit-guard.js(v='29')}" defer></script>
|
||||
<script th:src="@{/js/theme-init.js(v='32')}"></script>
|
||||
<script th:src="@{/js/app.js(v='32')}" defer></script>
|
||||
<script th:src="@{/js/ui-state.js(v='32')}" defer></script>
|
||||
<script th:src="@{/js/md-content.js(v='32')}" defer></script>
|
||||
<script th:src="@{/js/submit-guard.js(v='32')}" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="page d-flex flex-column min-vh-100">
|
||||
|
||||
@@ -138,7 +138,7 @@
|
||||
</div>
|
||||
|
||||
|
||||
<script th:src="@{/js/mdeditor.js(v='29')}" defer></script>
|
||||
<script th:src="@{/js/mdeditor.js(v='32')}" defer></script>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -183,7 +183,7 @@
|
||||
</div>
|
||||
</dialog>
|
||||
|
||||
<script th:src="@{/js/content-sort.js(v='29')}" defer></script>
|
||||
<script th:src="@{/js/content-sort.js(v='32')}" defer></script>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -236,8 +236,8 @@
|
||||
</div>
|
||||
</dialog>
|
||||
|
||||
<script th:src="@{/js/mdeditor.js(v='29')}" defer></script>
|
||||
<script th:src="@{/js/content-sort.js(v='29')}" defer></script>
|
||||
<script th:src="@{/js/mdeditor.js(v='32')}" defer></script>
|
||||
<script th:src="@{/js/content-sort.js(v='32')}" defer></script>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -143,7 +143,7 @@
|
||||
</div>
|
||||
</dialog>
|
||||
|
||||
<script th:src="@{/js/content-sort.js(v='29')}" defer></script>
|
||||
<script th:src="@{/js/content-sort.js(v='32')}" defer></script>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -107,7 +107,7 @@
|
||||
<p class="text-sm text-muted">Ожидайте преподавателя с проверкой.</p>
|
||||
</div>
|
||||
</div>
|
||||
<script th:src="@{/js/defense-timer.js(v='29')}" defer></script>
|
||||
<script th:src="@{/js/defense-timer.js(v='32')}" defer></script>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user