From 26a7701968ab3a2573dadbd62b9d6c979413792a Mon Sep 17 00:00:00 2001 From: Michael Sitz Date: Thu, 20 Aug 2026 20:16:07 -0400 Subject: [PATCH] Moved the add manually box from the main page to the settings page --- templates/course_dashboard.html | 112 +------------------------------- templates/settings.html | 55 ++++++++++++++++ 2 files changed, 58 insertions(+), 109 deletions(-) diff --git a/templates/course_dashboard.html b/templates/course_dashboard.html index 2ebc061..affcfb3 100644 --- a/templates/course_dashboard.html +++ b/templates/course_dashboard.html @@ -38,18 +38,15 @@ [data-density="compact"] .container { padding: 10px; } [data-density="compact"] .card, [data-density="compact"] .lesson-item, - [data-density="compact"] .tree-header, - [data-density="compact"] .course-selector { padding: 10px; margin-bottom: 8px; } + [data-density="compact"] .tree-header { padding: 10px; margin-bottom: 8px; } [data-card-style="elevated"] .card, [data-card-style="elevated"] .lesson-item, - [data-card-style="elevated"] .tree-header, - [data-card-style="elevated"] .course-selector { + [data-card-style="elevated"] .tree-header { box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35); } [data-card-style="bordered"] .card, [data-card-style="bordered"] .lesson-item, - [data-card-style="bordered"] .tree-header, - [data-card-style="bordered"] .course-selector { + [data-card-style="bordered"] .tree-header { border: 1px solid var(--border-color); } @@ -415,36 +412,6 @@ color: #666; } - .course-selector { - border: 2px dashed #666; - padding: 40px; - text-align: center; - margin: 40px 0; - border-radius: 10px; - background: var(--bg-secondary); - } - - .course-selector input { - background: var(--bg-tertiary); - border: 1px solid #666; - color: var(--text-primary); - padding: 12px; - font-size: 14px; - border-radius: var(--radius); - width: 80%; - margin-right: 10px; - } - - .course-selector input::placeholder { - color: var(--text-muted); - } - - .course-selector input:focus { - outline: none; - border-color: var(--accent); - box-shadow: 0 0 0 2px rgba(0, 122, 204, 0.2); - } - .last-accessed { background: #2d5a2d; border-left-color: #28a745; @@ -468,12 +435,6 @@ align-items: flex-start; } - .course-selector input { - width: 100%; - margin-right: 0; - margin-bottom: 10px; - } - .tree-content { margin-left: 15px; } @@ -613,23 +574,6 @@

- -
-

- - Don't see it? Enter a path manually - -

- -
{% endif %} @@ -671,12 +615,6 @@ } } - function toggleManualPath(e) { - e.preventDefault(); - const box = document.getElementById('manual-path-box'); - box.style.display = box.style.display === 'none' ? 'block' : 'none'; - } - function loadLibrary() { const libraryCard = document.getElementById('library-card'); if (!libraryCard) return; @@ -776,50 +714,6 @@ document.addEventListener('DOMContentLoaded', loadLibrary); - function loadCourseFromPath() { - const pathInput = document.getElementById('course-path'); - const statusDiv = document.getElementById('course-status'); - const coursePath = pathInput.value.trim(); - - if (!coursePath) { - statusDiv.innerHTML = '

Please enter a course path.

'; - return; - } - - // Show loading status - statusDiv.innerHTML = '

Loading course...

'; - - fetch('/load_course', { - method: 'POST', - headers: {'Content-Type': 'application/json'}, - body: JSON.stringify({course_path: coursePath}) - }) - .then(r => r.json()) - .then(data => { - if (data.success) { - statusDiv.innerHTML = '

Course loaded successfully! Redirecting...

'; - setTimeout(() => location.reload(), 1000); - } else { - statusDiv.innerHTML = `

Error: ${data.error}

`; - } - }) - .catch(error => { - console.error('Error loading course:', error); - statusDiv.innerHTML = '

Error loading course. Please check the path and try again.

'; - }); - } - - // Allow Enter key to submit - document.addEventListener('DOMContentLoaded', function() { - const pathInput = document.getElementById('course-path'); - if (pathInput) { - pathInput.addEventListener('keypress', function(e) { - if (e.key === 'Enter') { - loadCourseFromPath(); - } - }); - } - }); diff --git a/templates/settings.html b/templates/settings.html index 01ebcf2..7cee9c0 100644 --- a/templates/settings.html +++ b/templates/settings.html @@ -331,6 +331,21 @@ +
+

Load a Course Manually

+
+ +
+ + +
+ +
+
+

Video Player

@@ -441,6 +456,46 @@ }); } + function loadCourseFromPath() { + const input = document.getElementById('manual-course-path'); + const status = document.getElementById('manual-course-status'); + const coursePath = input.value.trim(); + + if (!coursePath) { + status.style.color = '#ff6b6b'; + status.textContent = 'Please enter a course path.'; + return; + } + + status.style.color = 'var(--text-muted)'; + status.textContent = 'Loading course...'; + + fetch('/load_course', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ course_path: coursePath }) + }) + .then(r => r.json()) + .then(data => { + if (data.success) { + status.style.color = '#28a745'; + status.textContent = `✓ Loaded "${data.course_name}" — redirecting...`; + setTimeout(() => { window.location.href = '/'; }, 1000); + } else { + status.style.color = '#ff6b6b'; + status.textContent = data.error || 'Could not load course'; + } + }) + .catch(() => { + status.style.color = '#ff6b6b'; + status.textContent = 'Could not reach the server'; + }); + } + + document.getElementById('manual-course-path').addEventListener('keypress', (e) => { + if (e.key === 'Enter') loadCourseFromPath(); + }); + function resetVideoSize() { fetch('/api/settings', { method: 'POST',