feat(lessons): «Быстрый урок» — одиночный урок без ручного создания курса
Учитель жмёт «Быстрый урок» в каталоге (theory.html) → урок создаётся в скрытом личном курсе-контейнере и сразу открывается редактор. Возни с курсом нет. - Миграция 059: courses.is_personal (ADD COLUMN). - POST /api/lessons/quick (teacher/admin): get-or-create личный контейнер (is_personal=1, один на учителя, опубликован) + создаёт урок, возвращает lessonId. - Каталог курсов скрывает личные контейнеры от всех, кроме владельца (courseController.list). - Свои быстрые уроки учитель видит как курс «Мои материалы» (открыв его в каталоге). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -304,6 +304,9 @@
|
||||
<button class="btn-new-course" id="btn-from-tpl" style="display:none;background:transparent;border:1.5px solid rgba(255,255,255,0.2);box-shadow:none;color:rgba(255,255,255,0.7)" onclick="openTplBrowser()">
|
||||
<i data-lucide="clipboard" style="width:16px;height:16px"></i> Из шаблона
|
||||
</button>
|
||||
<button class="btn-new-course" id="btn-quick-lesson" style="display:none;background:rgba(255,255,255,0.14);box-shadow:none;color:#fff" onclick="createQuickLesson()" title="Создать отдельный урок без курса">
|
||||
<i data-lucide="file-plus" style="width:16px;height:16px"></i> Быстрый урок
|
||||
</button>
|
||||
<button class="btn-new-course" id="btn-new-course" style="display:none" onclick="openNewCourseModal()">
|
||||
<i data-lucide="plus" style="width:16px;height:16px"></i> Новый курс
|
||||
</button>
|
||||
@@ -350,6 +353,7 @@
|
||||
document.getElementById('btn-classes').style.display = '';
|
||||
document.getElementById('btn-new-course').style.display = '';
|
||||
document.getElementById('btn-from-tpl').style.display = '';
|
||||
document.getElementById('btn-quick-lesson').style.display = '';
|
||||
}
|
||||
if (isAdmin) {
|
||||
document.getElementById('btn-admin').style.display = '';
|
||||
@@ -586,6 +590,24 @@
|
||||
}
|
||||
}
|
||||
|
||||
/* Быстрый урок: создаёт отдельный урок в личном курсе-контейнере и сразу
|
||||
открывает редактор — без ручного создания курса. */
|
||||
async function createQuickLesson() {
|
||||
const btn = document.getElementById('btn-quick-lesson');
|
||||
if (btn) btn.disabled = true;
|
||||
try {
|
||||
const res = await LS.api('/api/lessons/quick', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({}),
|
||||
});
|
||||
location.href = '/lesson-editor.html?id=' + res.lessonId;
|
||||
} catch (e) {
|
||||
LS.toast(e.message || 'Ошибка', 'error');
|
||||
if (btn) btn.disabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
/* ══════════════════════════════════════════════════════════════════
|
||||
TEMPLATE BROWSER
|
||||
══════════════════════════════════════════════════════════════════ */
|
||||
|
||||
Reference in New Issue
Block a user