Redesign B3 bordeaux + finish lab-page rework
- Lab page is now read-only with a settings screen for levels/variants; variant issuance moved to a large modal on the group page (assign-fragment). - Header: bordeaux logo and 2px accent underline, bordeaux login/logout/theme buttons; smaller radii across the UI; filled secondary/danger buttons. - Includes prior agent work (login backoff, no-cache pages, API timeouts, content tweaks) and fixes (variant usage Map.values, import order). - Bump static asset version to v=9.
This commit is contained in:
@@ -7,44 +7,66 @@ body {
|
||||
flex-direction: column;
|
||||
background: var(--c-bg);
|
||||
color: var(--c-text);
|
||||
font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
|
||||
line-height: 1.5;
|
||||
font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
|
||||
line-height: 1.55;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
|
||||
/* Палитра Б3: нейтральный каркас + бордовый акцент.
|
||||
Цвет несёт смысл: акцент — действия и фокус, зелёный/янтарный — статусы защиты,
|
||||
винный — деструктивные действия и негативная тональность. */
|
||||
:root {
|
||||
--c-bg: #f8fafc;
|
||||
--c-bg: #fafafa;
|
||||
--c-surface: #ffffff;
|
||||
--c-text: #0f172a;
|
||||
--c-text-muted: #64748b;
|
||||
--c-text-link: #6366f1;
|
||||
--c-text-link-hover: #4f46e5;
|
||||
--c-border: #e2e8f0;
|
||||
--c-accent: #6366f1;
|
||||
--c-badge-ok-bg: #dcfce7;
|
||||
--c-badge-ok-text: #166534;
|
||||
--c-badge-warn-bg: #fef3c7;
|
||||
--c-badge-warn-text: #92400e;
|
||||
--c-tone-pos: #16803c;
|
||||
--c-tone-neg: #b3283b;
|
||||
--c-tone-neu: #64748b;
|
||||
--c-text: #131316;
|
||||
--c-text-muted: #74747c;
|
||||
--c-text-link: #131316;
|
||||
--c-text-link-hover: #7a2333;
|
||||
--c-border: #e6e6e9;
|
||||
--c-border-strong: #d4d4da;
|
||||
--c-accent: #7a2333;
|
||||
--c-accent-hover: #5f1b28;
|
||||
--c-accent-soft: #f7edee;
|
||||
--c-badge-ok-bg: #f2f7f3;
|
||||
--c-badge-ok-text: #2f6b3a;
|
||||
--c-badge-ok-border: #b7cdbd;
|
||||
--c-badge-warn-bg: #faf5e9;
|
||||
--c-badge-warn-text: #8a5a12;
|
||||
--c-badge-warn-border: #d3bd8f;
|
||||
--c-tone-pos: #2f6b3a;
|
||||
--c-tone-neg: #9d2b3c;
|
||||
--c-tone-neu: #74747c;
|
||||
--c-btn-secondary-bg: #f1f1f3;
|
||||
--c-btn-secondary-bg-hover: #e6e6ea;
|
||||
--radius-xs: 0.125rem;
|
||||
--radius-sm: 0.1875rem;
|
||||
--radius: 0.25rem;
|
||||
--radius-lg: 0.375rem;
|
||||
}
|
||||
|
||||
[data-theme="dark"] {
|
||||
--c-bg: #0f1115;
|
||||
--c-surface: #171a21;
|
||||
--c-text: #e7e9ee;
|
||||
--c-text-muted: #9aa3b2;
|
||||
--c-text-link: #6ea8fe;
|
||||
--c-text-link-hover: #8bb9fe;
|
||||
--c-border: #262b36;
|
||||
--c-accent: #6ea8fe;
|
||||
--c-badge-ok-bg: rgba(16, 185, 129, 0.15);
|
||||
--c-badge-ok-text: #6ee7b7;
|
||||
--c-badge-warn-bg: rgba(251, 191, 36, 0.15);
|
||||
--c-badge-warn-text: #fcd34d;
|
||||
--c-tone-pos: #4ade80;
|
||||
--c-tone-neg: #f87171;
|
||||
--c-tone-neu: #9aa3b2;
|
||||
--c-bg: #101014;
|
||||
--c-surface: #17181d;
|
||||
--c-text: #e8e9ec;
|
||||
--c-text-muted: #9a9ba4;
|
||||
--c-text-link: #e8e9ec;
|
||||
--c-text-link-hover: #d98b98;
|
||||
--c-border: #26272e;
|
||||
--c-border-strong: #34353d;
|
||||
--c-accent: #a64d5f;
|
||||
--c-accent-hover: #b86070;
|
||||
--c-accent-soft: rgba(166, 77, 95, 0.16);
|
||||
--c-badge-ok-bg: rgba(46, 107, 58, 0.25);
|
||||
--c-badge-ok-text: #8fd4a1;
|
||||
--c-badge-ok-border: rgba(143, 212, 161, 0.4);
|
||||
--c-badge-warn-bg: rgba(138, 90, 18, 0.25);
|
||||
--c-badge-warn-text: #e3b766;
|
||||
--c-badge-warn-border: rgba(227, 183, 102, 0.4);
|
||||
--c-tone-pos: #6fcf8f;
|
||||
--c-tone-neg: #d98b98;
|
||||
--c-tone-neu: #9a9ba4;
|
||||
--c-btn-secondary-bg: #26272e;
|
||||
--c-btn-secondary-bg-hover: #2f3037;
|
||||
}
|
||||
|
||||
a { color: var(--c-text-link); text-decoration: none; }
|
||||
@@ -55,7 +77,7 @@ a:not(.btn):hover { color: var(--c-text-link-hover); }
|
||||
|
||||
/* Layout */
|
||||
.page { display: flex; flex-direction: column; min-height: 100vh; }
|
||||
.page-header { position: sticky; top: 0; z-index: 10; border-bottom: 1px solid var(--c-border); background: var(--c-surface); }
|
||||
.page-header { position: sticky; top: 0; z-index: 10; border-bottom: 2px solid var(--c-accent); background: var(--c-surface); }
|
||||
.page-header-inner { max-width: 1152px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; flex-wrap: wrap; padding: 0.75rem 1.5rem; }
|
||||
@media (max-width: 640px) {
|
||||
.page-header-inner { padding: 0.5rem 0.75rem; }
|
||||
@@ -68,10 +90,11 @@ a:not(.btn):hover { color: var(--c-text-link-hover); }
|
||||
|
||||
/* Nav */
|
||||
.nav { display: flex; align-items: center; gap: 1rem; font-size: 0.875rem; }
|
||||
.nav-link { color: var(--c-text-link); text-decoration: none; }
|
||||
.nav-link:hover { color: var(--c-text-link-hover); }
|
||||
.nav-link { color: var(--c-text-muted); text-decoration: none; }
|
||||
.nav-link:hover { color: var(--c-accent); }
|
||||
.nav-sep { color: var(--c-text-muted); }
|
||||
.logo { font-size: 1.125rem; font-weight: 600; color: var(--c-text); text-decoration: none; }
|
||||
.logo { font-size: 1.25rem; font-weight: 700; color: var(--c-accent); text-decoration: none; letter-spacing: -0.01em; }
|
||||
.logo:hover { color: var(--c-accent-hover); }
|
||||
.nav-user { font-weight: 500; }
|
||||
.theme-btn { display: inline-flex; align-items: center; justify-content: center; padding: 0.3rem 0.5rem; }
|
||||
.theme-icon { width: 1.05rem; height: 1.05rem; display: block; }
|
||||
@@ -79,36 +102,39 @@ a:not(.btn):hover { color: var(--c-text-link-hover); }
|
||||
.breadcrumb .nav-sep { user-select: none; }
|
||||
.check-list { display: flex; flex-direction: column; gap: 0.25rem; margin-top: 0.25rem; max-height: 12rem; overflow-y: auto; }
|
||||
|
||||
/* Buttons */
|
||||
/* Buttons — по спецификации Б3: настоящая рамка вместо box-shadow,
|
||||
компактный кегль 13px, бордо только на основном действии */
|
||||
.btn {
|
||||
display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
|
||||
border-radius: 0.5rem; padding: 0.5rem 1rem; font-size: 0.875rem; font-weight: 500;
|
||||
border: none; cursor: pointer; transition: opacity 0.15s;
|
||||
border: 1px solid transparent; border-radius: var(--radius);
|
||||
padding: 0.5rem 1rem; font-size: 0.8125rem; font-weight: 500;
|
||||
cursor: pointer; text-decoration: none;
|
||||
transition: background 0.15s, border-color 0.15s, color 0.15s;
|
||||
}
|
||||
.btn:active { opacity: 0.8; }
|
||||
.btn-sm { padding: 0.25rem 0.5rem; font-size: 0.75rem; }
|
||||
.btn-primary { background: var(--c-accent); color: white; text-decoration: none; }
|
||||
.btn-primary:hover { opacity: 0.9; }
|
||||
.btn-secondary {
|
||||
background: var(--c-surface); color: var(--c-text); text-decoration: none;
|
||||
box-shadow: inset 0 0 0 1px var(--c-border);
|
||||
}
|
||||
.btn-secondary:hover { background: var(--c-border); }
|
||||
.btn:active { opacity: 0.85; }
|
||||
.btn:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 2px; }
|
||||
.btn-primary { background: var(--c-accent); border-color: var(--c-accent); color: #ffffff; }
|
||||
.btn-primary:hover { background: var(--c-accent-hover); border-color: var(--c-accent-hover); }
|
||||
.btn-secondary { background: var(--c-btn-secondary-bg); border-color: var(--c-btn-secondary-bg); color: var(--c-text); }
|
||||
.btn-secondary:hover { background: var(--c-btn-secondary-bg-hover); border-color: var(--c-btn-secondary-bg-hover); }
|
||||
/* Деструктивные действия — залиты мягким бордо, текст и рамка акцентные */
|
||||
.btn-danger { background: var(--c-accent-soft); border-color: #dcb9be; color: var(--c-accent); }
|
||||
.btn-danger:hover { background: var(--c-accent); border-color: var(--c-accent); color: #ffffff; }
|
||||
|
||||
/* Forms */
|
||||
.input {
|
||||
width: 100%; border-radius: 0.5rem; background: var(--c-bg); color: var(--c-text);
|
||||
padding: 0.5rem 0.75rem; font-size: 0.875rem; border: 1px solid var(--c-border);
|
||||
width: 100%; border-radius: var(--radius); background: var(--c-surface); color: var(--c-text);
|
||||
padding: 0.5rem 0.75rem; font-size: 0.875rem; border: 1px solid var(--c-border-strong);
|
||||
outline: none;
|
||||
}
|
||||
.input:focus { border-color: var(--c-accent); box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2); }
|
||||
.input:focus { border-color: var(--c-accent); box-shadow: 0 0 0 3px var(--c-accent-soft); }
|
||||
.input::placeholder { color: var(--c-text-muted); }
|
||||
.label { display: block; margin-bottom: 0.25rem; font-size: 0.875rem; font-weight: 500; }
|
||||
.hint { margin-top: 0.25rem; font-size: 0.75rem; color: var(--c-text-muted); }
|
||||
|
||||
/* Cards */
|
||||
.card { border-radius: 0.75rem; background: var(--c-surface); border: 1px solid var(--c-border); }
|
||||
.card-flush { border-radius: 0.75rem; background: var(--c-surface); border: 1px solid var(--c-border); padding: 0; overflow: hidden; }
|
||||
.card { border-radius: var(--radius-lg); background: var(--c-surface); border: 1px solid var(--c-border); }
|
||||
.card-flush { border-radius: var(--radius-lg); background: var(--c-surface); border: 1px solid var(--c-border); padding: 0; overflow: hidden; }
|
||||
.card-body { padding: 1.5rem; }
|
||||
|
||||
/* Grid */
|
||||
@@ -153,11 +179,15 @@ a:not(.btn):hover { color: var(--c-text-link-hover); }
|
||||
.w-full { width: 100%; }
|
||||
.overflow-x-auto { overflow-x: auto; }
|
||||
|
||||
/* Badges */
|
||||
.badge { display: inline-flex; align-items: center; border-radius: 9999px; padding: 0.125rem 0.625rem; font-size: 0.75rem; font-weight: 500; }
|
||||
.badge-ok { background: var(--c-badge-ok-bg); color: var(--c-badge-ok-text); }
|
||||
.badge-warn { background: var(--c-badge-warn-bg); color: var(--c-badge-warn-text); }
|
||||
.badge-btn { border: none; cursor: pointer; padding: 0.125rem 0.625rem; }
|
||||
/* Badges — «этикетки»: строгая рамка, разрядка капсом; только индикаторы статуса */
|
||||
.badge {
|
||||
display: inline-flex; align-items: center;
|
||||
border-radius: var(--radius-sm); padding: 0.1rem 0.5rem;
|
||||
font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
|
||||
border: 1px solid transparent;
|
||||
}
|
||||
.badge-ok { background: var(--c-badge-ok-bg); color: var(--c-badge-ok-text); border-color: var(--c-badge-ok-border); }
|
||||
.badge-warn { background: var(--c-badge-warn-bg); color: var(--c-badge-warn-text); border-color: var(--c-badge-warn-border); }
|
||||
|
||||
/* Tables */
|
||||
table { width: 100%; font-size: 0.875rem; border-collapse: collapse; }
|
||||
@@ -168,7 +198,7 @@ td { padding: 0.75rem 1.5rem; border-bottom: 1px solid var(--c-border); }
|
||||
tr:last-child td { border-bottom: none; }
|
||||
|
||||
/* Alerts */
|
||||
.alert { padding: 0.75rem 1rem; border-radius: 0.5rem; font-size: 0.875rem; margin-bottom: 1rem; }
|
||||
.alert { padding: 0.75rem 1rem; border-radius: var(--radius); font-size: 0.875rem; margin-bottom: 1rem; }
|
||||
.alert-error { background: #fef2f2; color: #991b1b; }
|
||||
.alert-success { background: #dcfce7; color: #166534; }
|
||||
.alert-warning { background: #fef3c7; color: #92400e; }
|
||||
@@ -176,7 +206,7 @@ tr:last-child td { border-bottom: none; }
|
||||
.ml-2 { margin-left: 0.5rem; }
|
||||
.list-pad { padding-left: 1.25rem; }
|
||||
.import-card { border-color: rgba(16,185,129,0.4); }
|
||||
.mini-alert { padding: 0.5rem 0.75rem; border-radius: 0.25rem; margin-bottom: 0.5rem; }
|
||||
.mini-alert { padding: 0.5rem 0.75rem; border-radius: var(--radius-xs); margin-bottom: 0.5rem; }
|
||||
.font-semibold { font-weight: 600; }
|
||||
|
||||
/* Theme toggle */
|
||||
@@ -185,10 +215,10 @@ tr:last-child td { border-bottom: none; }
|
||||
/* Group assignment page */
|
||||
.group-title { margin: 0 0 0.5rem; font-size: 1rem; font-weight: 600; }
|
||||
.inline-form { display: inline-flex; align-items: center; gap: 0.375rem; margin: 0; }
|
||||
.inline-form .input-sm { width: auto; min-width: 10rem; }
|
||||
.input-sm { padding: 0.25rem 0.5rem; font-size: 0.8125rem; }
|
||||
/* Селект фокуса на лабу в тулбаре ведомости — по содержимому, не на всю ширину */
|
||||
#lab-focus { width: auto; min-width: 11rem; }
|
||||
.input-score { width: 4.5rem; }
|
||||
.inline-form .input-sm { width: auto; min-width: 0; }
|
||||
|
||||
.inline-form .input-score, input[type="number"].input-score { width: 4.5rem; min-width: 4.5rem; flex: 0 0 auto; }
|
||||
.filter-select { width: auto; }
|
||||
.hidden { display: none !important; }
|
||||
@@ -214,7 +244,7 @@ tr:last-child td { border-bottom: none; }
|
||||
}
|
||||
.toast-item {
|
||||
pointer-events: auto; display: flex; align-items: flex-start; gap: 0.5rem;
|
||||
padding: 0.7rem 0.85rem; border-radius: 0.5rem; border: 1px solid var(--c-border);
|
||||
padding: 0.7rem 0.85rem; border-radius: var(--radius); border: 1px solid var(--c-border);
|
||||
border-left-width: 4px; background: var(--c-surface); color: var(--c-text);
|
||||
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
|
||||
animation: toast-in 0.18s ease-out;
|
||||
@@ -235,12 +265,12 @@ tr:last-child td { border-bottom: none; }
|
||||
|
||||
/* Modals */
|
||||
dialog.modal {
|
||||
border: none; border-radius: 0.75rem; padding: 0;
|
||||
border: 1px solid var(--c-border); border-radius: var(--radius-lg); padding: 0;
|
||||
background: var(--c-surface); color: var(--c-text);
|
||||
width: min(34rem, calc(100vw - 2rem));
|
||||
box-shadow: 0 20px 60px rgba(0,0,0,0.35);
|
||||
box-shadow: 0 16px 48px rgba(19, 19, 22, 0.28);
|
||||
}
|
||||
dialog.modal::backdrop { background: rgba(0,0,0,0.55); }
|
||||
dialog.modal::backdrop { background: rgba(19, 19, 22, 0.5); }
|
||||
/* Пока открыта модалка — страница не прокручивается, позиция скролла сохраняется;
|
||||
прокрутка остаётся внутри .modal-body */
|
||||
html.modal-open body {
|
||||
@@ -277,10 +307,13 @@ html.modal-open body {
|
||||
.md-body h2 { font-size: 1.125rem; }
|
||||
.md-body p, .md-body ul, .md-body ol { margin: 0.5rem 0; }
|
||||
.md-body ul, .md-body ol { padding-left: 1.5rem; }
|
||||
.md-body pre { background: var(--c-bg); border: 1px solid var(--c-border); border-radius: 0.5rem; padding: 0.75rem 1rem; overflow-x: auto; font-size: 0.8125rem; }
|
||||
.md-body pre { background: var(--c-bg); border: 1px solid var(--c-border); border-radius: var(--radius); padding: 0.75rem 1rem; overflow-x: auto; font-size: 0.8125rem; }
|
||||
.md-body code { font-family: monospace; }
|
||||
.md-body details.spoiler { border: 1px solid var(--c-border); border-radius: 0.5rem; padding: 0.5rem 0.75rem; margin: 0.5rem 0; }
|
||||
.md-body details.spoiler summary { cursor: pointer; font-weight: 500; color: var(--c-text-link); }
|
||||
/* Ссылки в учебных материалах — акцентные, с подчёркиванием: их видно в тексте */
|
||||
.md-body a { color: var(--c-accent); text-decoration: underline; text-underline-offset: 2px; }
|
||||
.md-body a:hover { color: var(--c-accent-hover); }
|
||||
.md-body details.spoiler { border: 1px solid var(--c-border); border-radius: var(--radius); padding: 0.5rem 0.75rem; margin: 0.5rem 0; }
|
||||
.md-body details.spoiler summary { cursor: pointer; font-weight: 500; color: var(--c-accent); }
|
||||
.md-body img { max-width: 100%; }
|
||||
.md-body table { margin: 0; }
|
||||
/* Таблицы в статьях прокручиваются по горизонтали, как блоки кода */
|
||||
@@ -293,7 +326,7 @@ html.modal-open body {
|
||||
font: inherit; font-size: 0.72rem; line-height: 1;
|
||||
padding: 0.25rem 0.5rem; cursor: pointer;
|
||||
color: var(--c-text-muted); background: var(--c-surface);
|
||||
border: 1px solid var(--c-border); border-radius: 0.35rem; opacity: 0.85;
|
||||
border: 1px solid var(--c-border); border-radius: var(--radius-sm); opacity: 0.85;
|
||||
}
|
||||
.md-copy:hover { color: var(--c-text); opacity: 1; }
|
||||
.md-copy.copied { color: var(--c-text-link); }
|
||||
@@ -302,7 +335,7 @@ html.modal-open body {
|
||||
.empty { text-align: center; color: var(--c-text-muted); padding: 1.5rem; }
|
||||
|
||||
/* Mono inline code */
|
||||
code.code { padding: 0.125rem 0.5rem; border-radius: 0.25rem; font-family: monospace; background: var(--c-bg); }
|
||||
code.code { padding: 0.125rem 0.5rem; border-radius: var(--radius-xs); font-family: monospace; background: var(--c-bg); }
|
||||
|
||||
/* Containers */
|
||||
.container-sm { max-width: 28rem; margin: 0 auto; }
|
||||
@@ -311,10 +344,10 @@ code.code { padding: 0.125rem 0.5rem; border-radius: 0.25rem; font-family: monos
|
||||
|
||||
/* Header logo */
|
||||
.link-inherit { font-size: 0.875rem; }/* Chips (оценочные комментарии) */
|
||||
.chip { display: inline-block; margin: 2px 4px 2px 0; padding: 2px 8px; border-radius: 9999px; font-size: 11.5px; line-height: 1.5; }
|
||||
.chip-pos { background: #16803c; color: #fff; }
|
||||
.chip { display: inline-block; margin: 2px 4px 2px 0; padding: 2px 8px; border-radius: var(--radius-sm); font-size: 11.5px; line-height: 1.5; }
|
||||
.chip-pos { background: #2e6b3a; color: #fff; }
|
||||
.chip-neu { background: #5d6570; color: #fff; }
|
||||
.chip-neg { background: #b3283b; color: #fff; }
|
||||
.chip-neg { background: #8f2d3c; color: #fff; }
|
||||
/* Слоты комментариев в диалоге */
|
||||
.cs-row { display: flex; gap: 6px; align-items: center; }
|
||||
.cs-text-wrap { position: relative; flex: 1 1 auto; min-width: 0; }
|
||||
@@ -325,7 +358,7 @@ code.code { padding: 0.125rem 0.5rem; border-radius: 0.25rem; font-family: monos
|
||||
position: absolute; left: 0; right: 0; top: 100%; margin-top: 2px; z-index: 20;
|
||||
max-height: 14rem; overflow-y: auto;
|
||||
background: var(--c-surface); border: 1px solid var(--c-border);
|
||||
border-radius: 0.4rem; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
|
||||
border-radius: var(--radius-sm); box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
.ac-list.drop-up { top: auto; bottom: 100%; margin-top: 0; margin-bottom: 2px; }
|
||||
.ac-item { display: flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0.6rem; padding-left: 0.45rem; border-left: 3px solid transparent; cursor: pointer; font-size: 0.875rem; }
|
||||
@@ -339,55 +372,86 @@ code.code { padding: 0.125rem 0.5rem; border-radius: 0.25rem; font-family: monos
|
||||
.ac-tone-neu { color: var(--c-tone-neu); }
|
||||
.ac-text { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.ac-count { flex: 0 0 auto; background: var(--c-border); color: var(--c-text-muted); }
|
||||
.ac-del { flex: 0 0 auto; border: none; background: transparent; color: var(--c-text-muted); cursor: pointer; padding: 0 0.25rem; border-radius: 0.25rem; font-size: 0.75rem; line-height: 1.4; }
|
||||
.ac-del { flex: 0 0 auto; border: none; background: transparent; color: var(--c-text-muted); cursor: pointer; padding: 0 0.25rem; border-radius: var(--radius-xs); font-size: 0.75rem; line-height: 1.4; }
|
||||
.ac-del:not(:disabled):hover { color: #dc2626; background: var(--c-bg); }
|
||||
.ac-del:disabled { opacity: 0.3; cursor: not-allowed; }
|
||||
.ac-empty { padding: 0.4rem 0.6rem; font-size: 0.875rem; color: var(--c-text-muted); }
|
||||
/* Ячейка матрицы: вариант и кнопки действий под ним; кнопки в шапке ЛР */
|
||||
/* Ячейка матрицы в стиле Б3: вариант и оценка — текстом, подстрока — сдача и защита с точкой */
|
||||
.cell-stack { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; }
|
||||
.cell-top { display: flex; align-items: center; justify-content: center; gap: 0.4rem; }
|
||||
/* Публикация в ячейке — «глаз»-точка: ○ скрыто, ◉ опубликовано (нативный checkbox под капотом) */
|
||||
.pub-toggle {
|
||||
appearance: none; -webkit-appearance: none;
|
||||
width: 1rem; height: 1rem; margin: 0; padding: 0; cursor: pointer;
|
||||
border-radius: 50%; border: 1.5px solid var(--c-border-strong);
|
||||
background: transparent; vertical-align: middle;
|
||||
transition: border-color 0.15s, box-shadow 0.15s;
|
||||
}
|
||||
.pub-toggle:checked {
|
||||
border-color: var(--c-accent);
|
||||
background: radial-gradient(circle, var(--c-accent) 0 42%, transparent 48%);
|
||||
}
|
||||
.pub-toggle:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 2px; }
|
||||
.variant-btn {
|
||||
display: inline-block; padding: 0.18rem 0.5rem; border-radius: 0.4rem;
|
||||
border: 1px solid var(--c-border); background: var(--c-bg);
|
||||
font-size: 0.8rem; white-space: nowrap; cursor: pointer; color: var(--c-text);
|
||||
display: inline-block; padding: 0; border: none; background: none;
|
||||
font-size: 0.8125rem; font-weight: 600; white-space: nowrap; cursor: pointer;
|
||||
color: var(--c-accent); text-decoration: none;
|
||||
}
|
||||
.variant-btn:hover { border-color: var(--c-accent); color: var(--c-accent); }
|
||||
.pub-toggle { width: 1.05rem; height: 1.05rem; margin: 0; cursor: pointer; accent-color: #16a34a; }
|
||||
.variant-btn.manual { border-color: var(--c-border-strong, var(--c-border)); font-weight: 600; }
|
||||
.cell-btns { display: flex; gap: 0.2rem; }
|
||||
.cell-btn {
|
||||
display: inline-flex; align-items: center; justify-content: center; gap: 0.15rem;
|
||||
min-width: 1.6rem; height: 1.6rem; padding: 0 0.35rem; cursor: pointer;
|
||||
border: 1px solid var(--c-border); border-radius: 0.35rem;
|
||||
background: var(--c-surface); color: var(--c-text); text-decoration: none; font-size: 0.85rem;
|
||||
.variant-btn:hover { text-decoration: underline; }
|
||||
.variant-btn.manual { font-weight: 700; }
|
||||
.variant-btn .cell-none { color: var(--c-text-muted); font-weight: 400; }
|
||||
.variant-btn.manual .cell-none { font-weight: 600; }
|
||||
.score-link {
|
||||
display: inline-block; padding: 0; border: none; background: none;
|
||||
font-size: 0.8125rem; font-weight: 600; font-variant-numeric: tabular-nums;
|
||||
color: var(--c-text); cursor: pointer;
|
||||
}
|
||||
.cell-btn:hover { background: var(--c-bg); }
|
||||
.cell-btn.dim { color: var(--c-text-muted); }
|
||||
.cell-btn.warn { color: #d97706; }
|
||||
.cell-btn.ok { color: #16a34a; }
|
||||
.cell-num { font-size: 0.72rem; opacity: 0.75; }
|
||||
.score-link:hover { color: var(--c-accent); text-decoration: underline; }
|
||||
.score-link.none { color: var(--c-text-muted); font-weight: 400; }
|
||||
.cell-sub { display: flex; align-items: center; justify-content: center; gap: 0.75rem; font-size: 0.75rem; }
|
||||
.sub-link { color: var(--c-text-muted); text-decoration: none; font-variant-numeric: tabular-nums; }
|
||||
.sub-link:hover { color: var(--c-text); text-decoration: underline; }
|
||||
.sub-dim { color: var(--c-text-muted); }
|
||||
.cell-dim { color: var(--c-text-muted); }
|
||||
/* Статус защиты: текст с цветной точкой вместо кнопки-плашки.
|
||||
Класс cell-btn сохранён — по нему JS находит ячейку (defenseBtn). */
|
||||
.cell-btn.st {
|
||||
display: inline-flex; align-items: center; gap: 0.35rem;
|
||||
min-width: 0; height: auto; padding: 0;
|
||||
border: none; border-radius: 0; background: none;
|
||||
color: var(--c-text-muted); font-size: 0.75rem; text-decoration: none; cursor: pointer;
|
||||
}
|
||||
.cell-btn.st:hover { background: none; color: var(--c-text); }
|
||||
.cell-btn.st::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--c-border-strong); }
|
||||
.cell-btn.st.ok { color: var(--c-tone-pos); }
|
||||
.cell-btn.st.ok::before { background: var(--c-tone-pos); }
|
||||
.cell-btn.st.warn { color: #b45309; }
|
||||
.cell-btn.st.warn::before { background: #b45309; }
|
||||
.cell-btn.st.dim { color: var(--c-text-muted); }
|
||||
.cell-btn.st.dim::before { background: var(--c-border-strong); }
|
||||
.mini-count { font-size: 0.72rem; margin-left: 0.15rem; color: var(--c-text-muted); }
|
||||
.defense-cell-timer { font-variant-numeric: tabular-nums; }
|
||||
.lab-head-actions { display: flex; gap: 0.2rem; }
|
||||
.mini-btn {
|
||||
display: inline-flex; align-items: center; justify-content: center;
|
||||
min-width: 1.5rem; height: 1.5rem; padding: 0 0.3rem; cursor: pointer;
|
||||
border: 1px solid var(--c-border); border-radius: 0.35rem;
|
||||
border: 1px solid var(--c-border); border-radius: var(--radius-sm);
|
||||
background: var(--c-surface); color: var(--c-text); text-decoration: none; font-size: 0.85rem;
|
||||
}
|
||||
.mini-btn:hover { background: var(--c-bg); }
|
||||
.mini-btn.ok { color: #16a34a; }
|
||||
.mini-btn.warn { color: #d97706; }
|
||||
.mini-btn.partial { color: #2563eb; }
|
||||
.mini-btn.ok { color: var(--c-tone-pos); }
|
||||
.mini-btn.warn { color: #b45309; }
|
||||
.mini-btn.partial { color: var(--c-accent); }
|
||||
|
||||
/* Увеличенный диалог (оценка + комментарии) */
|
||||
dialog.modal.modal-lg { width: min(72rem, calc(100vw - 2rem)); }
|
||||
dialog.modal.modal-lg .modal-body { max-height: 88vh; min-height: 62vh; }
|
||||
.mini-btn svg, .cell-btn svg { width: 1rem; height: 1rem; }
|
||||
|
||||
.chip { display: inline-block; margin: 2px 4px 2px 0; padding: 2px 8px; border-radius: 9999px; font-size: 11.5px; line-height: 1.5; }
|
||||
.chip-pos { background: #16803c; color: #fff; }
|
||||
.chip { display: inline-block; margin: 2px 4px 2px 0; padding: 2px 8px; border-radius: var(--radius-sm); font-size: 11.5px; line-height: 1.5; }
|
||||
.chip-pos { background: #2e6b3a; color: #fff; }
|
||||
.chip-neu { background: #5d6570; color: #fff; }
|
||||
.chip-neg { background: #b3283b; color: #fff; }
|
||||
.chip-neg { background: #8f2d3c; color: #fff; }
|
||||
|
||||
/* Defense timer */
|
||||
/* Материалы: ряды и ручки перетаскивания слева, одним столбцом */
|
||||
@@ -430,6 +494,10 @@ dialog.modal.modal-lg .modal-body { max-height: 88vh; min-height: 62vh; }
|
||||
.matrix td.cell-lab { min-width: 9.5rem; border-left: 1px solid var(--c-border); }
|
||||
.matrix td.student-cell { min-width: 12rem; }
|
||||
.lab-col-head { display: flex; flex-direction: column; align-items: center; gap: 0.375rem; }
|
||||
.lab-col-title {
|
||||
max-width: 9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
|
||||
font-size: 0.7rem; font-weight: 400; color: var(--c-text-muted); letter-spacing: 0;
|
||||
}
|
||||
.cell-line { display: flex; align-items: center; gap: 0.375rem; font-size: 0.8125rem; text-align: left; }
|
||||
.cell-label { color: var(--c-text-muted); min-width: 3.5rem; }
|
||||
.cell-link { font-size: 0.8125rem; }
|
||||
@@ -455,7 +523,7 @@ dialog.modal.modal-lg .modal-body { max-height: 88vh; min-height: 62vh; }
|
||||
.pre-wrap { white-space: pre-wrap; word-break: break-word; }
|
||||
|
||||
/* Редактируемая матрица: закреплённый столбец и компактные селекты */
|
||||
.matrix-sticky { position: sticky; left: 0; z-index: 2; background: var(--c-surface); }
|
||||
.matrix-sticky { position: sticky; left: 0; z-index: 2; background: var(--c-surface); box-shadow: 8px 0 8px -8px rgba(19, 19, 22, 0.1); }
|
||||
.matrix thead .matrix-sticky { z-index: 3; }
|
||||
.level-form { margin: 0; }
|
||||
.level-select {
|
||||
@@ -474,7 +542,7 @@ dialog.modal.modal-lg .modal-body { max-height: 88vh; min-height: 62vh; }
|
||||
.cell-chip {
|
||||
display: inline-flex; align-items: center; gap: 0.15rem;
|
||||
font-size: 0.72rem; line-height: 1.7; padding: 0.05rem 0.45rem;
|
||||
border: 1px solid var(--c-border); border-radius: 99px;
|
||||
border: 1px solid var(--c-border); border-radius: var(--radius-sm);
|
||||
background: var(--c-bg); color: var(--c-text); white-space: nowrap; cursor: pointer;
|
||||
text-decoration: none; font-family: inherit;
|
||||
}
|
||||
@@ -482,12 +550,21 @@ dialog.modal.modal-lg .modal-body { max-height: 88vh; min-height: 62vh; }
|
||||
.chip-dim { color: var(--c-text-muted); }
|
||||
.chip-warn { color: #92400e; background: #fef3c7; border-color: #fde68a; }
|
||||
.chip-ok { color: #166534; background: #dcfce7; border-color: #bbf7d0; }
|
||||
.chip-link:hover { color: var(--c-text-link); }
|
||||
.chip-link:hover { color: var(--c-accent); }
|
||||
[data-theme="dark"] .chip-warn { color: #fcd34d; background: rgba(146, 64, 14, 0.25); border-color: rgba(146, 64, 14, 0.5); }
|
||||
[data-theme="dark"] .chip-ok { color: #86efac; background: rgba(22, 101, 52, 0.25); border-color: rgba(22, 101, 52, 0.5); }
|
||||
.lab-head-row { display: flex; align-items: center; justify-content: center; gap: 0.3rem; }
|
||||
.actions-cell { white-space: nowrap; }
|
||||
.actions-cell .inline-form { display: inline-block; }
|
||||
/* Действия столбиком: ровные одинаковые кнопки друг под другом */
|
||||
.actions-col { display: inline-flex; flex-direction: column; gap: 0.35rem; align-items: stretch; min-width: 6.5rem; }
|
||||
.actions-col .btn { text-align: center; }
|
||||
/* Монохромные SVG-иконки в ячейках матрицы (защита, оценка) */
|
||||
.cell-ico {
|
||||
width: 0.95rem; height: 0.95rem; display: block;
|
||||
fill: none; stroke: currentColor; stroke-width: 2;
|
||||
stroke-linecap: round; stroke-linejoin: round;
|
||||
}
|
||||
|
||||
/* tablekit: сортируемые таблицы и поиск */
|
||||
th.th-sortable { cursor: pointer; user-select: none; }
|
||||
@@ -500,7 +577,7 @@ th.th-sortable.is-desc::after { content: " ▼"; color: var(--c-text-muted); fon
|
||||
.filter-row th { padding: 0.25rem 0.35rem; background: var(--c-bg); }
|
||||
.filter-control {
|
||||
width: 100%; min-width: 3.5rem; font-size: 0.72rem; line-height: 1.4;
|
||||
padding: 0.1rem 0.25rem; border: 1px solid var(--c-border); border-radius: 0.35rem;
|
||||
padding: 0.1rem 0.25rem; border: 1px solid var(--c-border); border-radius: var(--radius-sm);
|
||||
background: var(--c-surface); color: var(--c-text); font-family: inherit;
|
||||
}
|
||||
th.th-filterable { padding-bottom: 0.35rem; }
|
||||
@@ -509,14 +586,14 @@ th.th-filterable { padding-bottom: 0.35rem; }
|
||||
.drag-handle {
|
||||
display: inline-block; flex: 0 0 auto; width: 1.5rem; text-align: center;
|
||||
cursor: grab; user-select: none; color: var(--c-text-muted);
|
||||
font-size: 1rem; line-height: 1; padding: 0.15rem 0; border-radius: 0.35rem;
|
||||
font-size: 1rem; line-height: 1; padding: 0.15rem 0; border-radius: var(--radius-sm);
|
||||
}
|
||||
.drag-handle:hover { background: var(--c-bg); color: var(--c-text); }
|
||||
.drag-handle:active { cursor: grabbing; }
|
||||
.dragging { opacity: 0.45; }
|
||||
.drop-before { box-shadow: 0 -3px 0 0 var(--c-text); }
|
||||
.drop-after { box-shadow: 0 3px 0 0 var(--c-text); }
|
||||
.drop-into { outline: 2px dashed var(--c-border); outline-offset: 3px; border-radius: 0.35rem; }
|
||||
.drop-into { outline: 2px dashed var(--c-border); outline-offset: 3px; border-radius: var(--radius-sm); }
|
||||
|
||||
/* индикатор сохранения порядка материалов */
|
||||
.sort-status {
|
||||
@@ -524,7 +601,7 @@ th.th-filterable { padding-bottom: 0.35rem; }
|
||||
display: flex; align-items: center; gap: 0.6rem;
|
||||
max-width: min(24rem, calc(100vw - 2rem));
|
||||
background: var(--c-surface); border: 1px solid var(--c-border);
|
||||
border-radius: 0.5rem; padding: 0.5rem 0.75rem;
|
||||
border-radius: var(--radius); padding: 0.5rem 0.75rem;
|
||||
box-shadow: 0 6px 24px rgba(0, 0, 0, 0.15); font-size: 0.85rem;
|
||||
}
|
||||
|
||||
@@ -555,13 +632,13 @@ th.th-filterable { padding-bottom: 0.35rem; }
|
||||
.md-toolbar {
|
||||
display: flex; flex-wrap: wrap; align-items: center; gap: 0.1rem;
|
||||
padding: 0.3rem; margin-bottom: 0.5rem;
|
||||
border: 1px solid var(--c-border); border-radius: 0.5rem; background: var(--c-bg);
|
||||
border: 1px solid var(--c-border); border-radius: var(--radius); background: var(--c-bg);
|
||||
}
|
||||
.md-sprite { display: none; }
|
||||
.md-btn {
|
||||
display: inline-flex; align-items: center; justify-content: center;
|
||||
width: 2rem; height: 2rem; padding: 0; cursor: pointer;
|
||||
border: 1px solid transparent; border-radius: 0.375rem;
|
||||
border: 1px solid transparent; border-radius: var(--radius-sm);
|
||||
background: transparent; color: var(--c-text);
|
||||
}
|
||||
.md-btn:hover { background: var(--c-surface); border-color: var(--c-border); }
|
||||
@@ -587,4 +664,4 @@ th.th-filterable { padding-bottom: 0.35rem; }
|
||||
margin-top: 0.4rem; font-size: 0.875rem; color: var(--c-text-muted);
|
||||
}
|
||||
.md-video-figure { margin: 1rem 0; text-align: center; }
|
||||
.md-video { width: 100%; max-width: 100%; border-radius: 0.5rem; background: #000; }
|
||||
.md-video { width: 100%; max-width: 100%; border-radius: var(--radius); background: #000; }
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
|
||||
<rect x="2" y="2" width="28" height="28" rx="6" fill="#6366f1"/>
|
||||
<path d="M9 8v13h5l-1.5 3H6V8z" fill="#eef2ff"/>
|
||||
<path d="M23 8v13h-5l1.5 3h5V8z" fill="#c7d2fe"/>
|
||||
<path d="M11 9c2-1.5 4-1.5 5 0 1-1.5 3-1.5 5 0v10c-2-1.5-4-1.5-5 0-1-1.5-3-1.5-5 0z" fill="#ffffff"/>
|
||||
<path d="M16 9v10" stroke="#6366f1" stroke-width="1"/>
|
||||
<rect x="1" y="1" width="30" height="30" rx="8" fill="#7a2333"/>
|
||||
<path d="M11.5 7.5h4v13.2h8.2v3.8h-12.2z" fill="#fdfcf9"/>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 399 B After Width: | Height: | Size: 196 B |
@@ -57,7 +57,7 @@ function csRow(text, tone) {
|
||||
|
||||
var rm = document.createElement('button');
|
||||
rm.type = 'button';
|
||||
rm.className = 'btn btn-secondary btn-sm';
|
||||
rm.className = 'btn btn-secondary';
|
||||
rm.textContent = 'удалить';
|
||||
rm.onclick = function () { row.remove(); };
|
||||
|
||||
@@ -361,13 +361,13 @@ function applyDefenseToCell(s) {
|
||||
}
|
||||
if (label) {
|
||||
label.textContent = started ? ''
|
||||
: (s.status == null ? 'нет'
|
||||
: (s.status === 'ready' ? 'готов'
|
||||
: (s.code ? 'код' : 'ожид.')));
|
||||
: (s.status == null ? '—'
|
||||
: (s.status === 'ready' ? 'готова'
|
||||
: (s.code ? 'код' : 'ожидает')));
|
||||
}
|
||||
if (s.status === 'ready') {
|
||||
btn.title = 'Защита завершена: ' + (s.readyReason === 'timeout' ? 'время вышло' : 'студент нажал «Готов»');
|
||||
if (label) label.textContent = 'готов';
|
||||
if (label) label.textContent = 'готова';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -521,7 +521,11 @@ function openVariant(btn) {
|
||||
levelSel.innerHTML = '';
|
||||
VARIANT_CACHE = {};
|
||||
fetch('/admin/labs/' + encodeURIComponent(lab) + '/schema')
|
||||
.then(function (r) { return r.ok ? r.json() : { levels: [] }; })
|
||||
.then(function (r) { return r.ok && !r.redirected ? r.json() : { levels: [] }; })
|
||||
.catch(function () {
|
||||
alert('Не удалось загрузить уровни и варианты (возможно, сессия истекла). Обновите страницу и откройте модалку заново.');
|
||||
return { levels: [] };
|
||||
})
|
||||
.then(function (data) {
|
||||
(data.levels || []).forEach(function (lvl, i) {
|
||||
var opt = document.createElement('option');
|
||||
@@ -607,3 +611,55 @@ window.addEventListener('DOMContentLoaded', function () {
|
||||
startDefenseWatch();
|
||||
attachPublishToggles();
|
||||
});
|
||||
|
||||
/* ---------- Большая модалка «Выдача вариантов» ---------- */
|
||||
|
||||
function refreshAssignModal(url) {
|
||||
var body = document.getElementById('assign-modal-body');
|
||||
if (!body) return Promise.resolve();
|
||||
return fetch(url, { headers: { 'X-Requested-With': 'fetch' } })
|
||||
.then(function (r) {
|
||||
if (r.redirected) throw new Error('сессия истекла — обновите страницу');
|
||||
return r.text();
|
||||
})
|
||||
.then(function (html) { body.innerHTML = html; });
|
||||
}
|
||||
|
||||
window.openLabAssign = function (btn) {
|
||||
var body = document.getElementById('assign-modal-body');
|
||||
if (!body) return;
|
||||
var title = document.getElementById('assign-modal-title');
|
||||
if (title) title.textContent = 'Выдача вариантов — ' + (btn.getAttribute('data-lab-name') || '');
|
||||
body.innerHTML = '<p class="text-muted">Загрузка…</p>';
|
||||
openModal('modal-lab-assign');
|
||||
refreshAssignModal(btn.getAttribute('data-url')).catch(function (e) {
|
||||
body.innerHTML = '<p class="text-danger">Не удалось загрузить: ' + e.message + '</p>';
|
||||
});
|
||||
};
|
||||
|
||||
window.confirmAssignVariant = function (sel) {
|
||||
var opt = sel.selectedOptions[0];
|
||||
var taken = opt ? parseInt(opt.getAttribute('data-taken') || '0', 10) : 0;
|
||||
if (opt && opt.value && taken > 0 && sel.value !== sel.dataset.prev) {
|
||||
if (!confirm('Вариант уже занят (' + taken + '). Назначить всё равно?')) {
|
||||
sel.value = sel.dataset.prev;
|
||||
return;
|
||||
}
|
||||
}
|
||||
sel.dataset.prev = sel.value;
|
||||
sel.closest('form').requestSubmit();
|
||||
};
|
||||
|
||||
/* Формы внутри модалки сохраняются через fetch — модалка не закрывается и обновляется */
|
||||
document.addEventListener('submit', function (ev) {
|
||||
var form = ev.target;
|
||||
if (!form.classList || !form.classList.contains('js-assign-form')) return;
|
||||
ev.preventDefault();
|
||||
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')); })
|
||||
.catch(function (e) { showToast('Не удалось сохранить: ' + e.message, 'error'); })
|
||||
.finally(function () { if (btn) btn.disabled = false; });
|
||||
});
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
function toggleAllStudents(cb) {
|
||||
document.querySelectorAll('.pick-student').forEach(function (c) { c.checked = cb.checked; });
|
||||
}
|
||||
|
||||
function collectPicked(form) {
|
||||
var picked = Array.prototype.slice.call(document.querySelectorAll('.pick-student:checked'));
|
||||
if (!picked.length) {
|
||||
alert('Отметьте хотя бы одного студента.');
|
||||
return false;
|
||||
}
|
||||
picked.forEach(function (c) {
|
||||
var input = document.createElement('input');
|
||||
input.type = 'hidden';
|
||||
input.name = 'studentIds';
|
||||
input.value = c.value;
|
||||
form.appendChild(input);
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
function confirmOccupied(sel) {
|
||||
var opt = sel.options[sel.selectedIndex];
|
||||
var taken = opt ? parseInt(opt.getAttribute('data-taken') || '0', 10) : 0;
|
||||
if (opt && opt.value && taken > 0 && sel.value !== sel.dataset.prev) {
|
||||
if (!confirm('Вариант уже занят (' + taken + '). Назначить всё равно?')) {
|
||||
if (sel.dataset.prev !== undefined) sel.value = sel.dataset.prev;
|
||||
return;
|
||||
}
|
||||
}
|
||||
sel.dataset.prev = sel.value;
|
||||
if (sel.form) sel.form.submit();
|
||||
}
|
||||
|
||||
window.addEventListener('DOMContentLoaded', function () {
|
||||
document.querySelectorAll('.pick-variant').forEach(function (s) { s.dataset.prev = s.value; });
|
||||
});
|
||||
@@ -239,6 +239,9 @@
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(collectPayload())
|
||||
}).then(function (response) {
|
||||
// после истечения сессии сервер отвечает редиректом на /login: fetch вернёт 200 с HTML —
|
||||
// считать такое успехом нельзя, иначе порядок «сохранится» только на экране
|
||||
if (response.redirected) throw new Error('сессия истекла — обновите страницу');
|
||||
if (!response.ok) throw new Error('HTTP ' + response.status);
|
||||
pending = false;
|
||||
saving = false;
|
||||
|
||||
1
web/src/main/resources/static/js/htmx.min.js
vendored
1
web/src/main/resources/static/js/htmx.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -113,7 +113,8 @@
|
||||
};
|
||||
|
||||
document.addEventListener('input', function (event) {
|
||||
if (event.target && event.target.id === 'article-body') dirty = true;
|
||||
var id = event.target && event.target.id;
|
||||
if (id === 'article-body' || id === 'article-title') dirty = true;
|
||||
});
|
||||
|
||||
/* Сохранение — это осознанный уход со страницы, подтверждение не нужно */
|
||||
|
||||
32
web/src/main/resources/static/js/submit-guard.js
Normal file
32
web/src/main/resources/static/js/submit-guard.js
Normal file
@@ -0,0 +1,32 @@
|
||||
/* Защита от двойной отправки: после сабмита формы кнопки блокируются до перехода.
|
||||
Инлайн-onsubmit с confirm() успевает отработать раньше (обработчик из атрибута
|
||||
регистрируется первым) — если сабмит отменён, кнопки не блокируются. */
|
||||
(function () {
|
||||
function buttonsOf(form) {
|
||||
return form.querySelectorAll('button[type="submit"]');
|
||||
}
|
||||
|
||||
function setDisabled(form, disabled) {
|
||||
buttonsOf(form).forEach(function (btn) { btn.disabled = disabled; });
|
||||
}
|
||||
|
||||
function arm(form) {
|
||||
if (form.dataset.submitGuard) return;
|
||||
form.dataset.submitGuard = '1';
|
||||
form.addEventListener('submit', function (event) {
|
||||
if (event.defaultPrevented) return;
|
||||
window.setTimeout(function () {
|
||||
// кто-то из более поздних обработчиков мог отменить сабмит
|
||||
if (!event.defaultPrevented) setDisabled(form, true);
|
||||
}, 0);
|
||||
});
|
||||
// возврат на страницу по Back/Forward из кэша — разблокируем
|
||||
window.addEventListener('pageshow', function (event) {
|
||||
if (event.persisted) setDisabled(form, false);
|
||||
});
|
||||
}
|
||||
|
||||
window.addEventListener('DOMContentLoaded', function () {
|
||||
document.querySelectorAll('form').forEach(arm);
|
||||
});
|
||||
})();
|
||||
@@ -158,13 +158,26 @@
|
||||
if (th.hasAttribute('data-nosort')) return;
|
||||
th.classList.add('th-sortable');
|
||||
if (!th.title) th.title = 'Сортировать по этому столбцу';
|
||||
th.addEventListener('click', function (event) {
|
||||
if (event.target.closest('form, button, a, select, input')) return;
|
||||
// сортировка с клавиатуры: фокус + Enter/пробел, состояние доступно скринридеру
|
||||
th.tabIndex = 0;
|
||||
if (th.classList.contains('is-asc')) th.setAttribute('aria-sort', 'ascending');
|
||||
function doSort() {
|
||||
var asc = !th.classList.contains('is-asc');
|
||||
clearAllMarkers(table);
|
||||
th.classList.add(asc ? 'is-asc' : 'is-desc');
|
||||
th.setAttribute('aria-sort', asc ? 'ascending' : 'descending');
|
||||
sortColumn(table, index, asc ? 1 : -1);
|
||||
th.title = (th.textContent.trim() || 'Столбец') + ' — ' + (asc ? 'по возрастанию' : 'по убыванию');
|
||||
}
|
||||
th.addEventListener('click', function (event) {
|
||||
if (event.target.closest('form, button, a, select, input')) return;
|
||||
doSort();
|
||||
});
|
||||
th.addEventListener('keydown', function (event) {
|
||||
if (event.target !== th) return;
|
||||
if (event.key !== 'Enter' && event.key !== ' ') return;
|
||||
event.preventDefault();
|
||||
doSort();
|
||||
});
|
||||
});
|
||||
buildFilters(table);
|
||||
|
||||
Reference in New Issue
Block a user