diff --git a/.gitignore b/.gitignore index c6895f5..c1797a1 100644 --- a/.gitignore +++ b/.gitignore @@ -36,3 +36,4 @@ venv/ Thumbs.db apps/homepage/config/logs/ +apps/learning/learning.db diff --git a/apps/learning/app/static/index.html b/apps/learning/app/static/index.html deleted file mode 100644 index bfb4a50..0000000 --- a/apps/learning/app/static/index.html +++ /dev/null @@ -1,70 +0,0 @@ - - -
- - -${course.description || ''}
- - `; - - card.addEventListener('dragstart', (e) => { - e.dataTransfer.setData('text/plain', course.id); - card.classList.add('dragging'); - }); - - card.addEventListener('dragend', () => { - card.classList.remove('dragging'); - }); - - return card; -} - -function allowDrop(e) { - e.preventDefault(); -} - -async function drop(e) { - e.preventDefault(); - const courseId = e.dataTransfer.getData('text/plain'); - const newStatus = e.currentTarget.id; // The column ID - - const course = courses.find(c => c.id == courseId); - if (course && course.status !== newStatus) { - course.status = newStatus; - await updateCourseOnServer(course); - renderBoard(); - } -} - -async function updateCourseOnServer(course) { - await fetch(`/api/courses/${course.id}`, { - method: 'PUT', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify(course) - }); -} - -async function deleteCourse(id) { - if (confirm('Are you sure?')) { - await fetch(`/api/courses/${id}`, { method: 'DELETE' }); - await fetchCourses(); - } -} - -// Modal Logic -const modal = document.getElementById('course-modal'); -const form = document.getElementById('course-form'); - -function showModal(id = null) { - modal.style.display = 'block'; - if (id) { - const course = courses.find(c => c.id == id); - document.getElementById('modal-title').innerText = 'Edit Course'; - document.getElementById('course-id').value = course.id; - document.getElementById('title').value = course.title; - document.getElementById('description').value = course.description || ''; - document.getElementById('main_link').value = course.main_link; - document.getElementById('last_link').value = course.last_link || ''; - document.getElementById('status').value = course.status; - } else { - document.getElementById('modal-title').innerText = 'Add New Course'; - form.reset(); - document.getElementById('course-id').value = ''; - } -} - -function closeModal() { - modal.style.display = 'none'; -} - -form.onsubmit = async (e) => { - e.preventDefault(); - const id = document.getElementById('course-id').value; - const courseData = { - title: document.getElementById('title').value, - description: document.getElementById('description').value, - main_link: document.getElementById('main_link').value, - last_link: document.getElementById('last_link').value, - status: document.getElementById('status').value - }; - - if (id) { - await fetch(`/api/courses/${id}`, { - method: 'PUT', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify(courseData) - }); - } else { - await fetch('/api/courses', { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify(courseData) - }); - } - - closeModal(); - await fetchCourses(); -}; - -window.onclick = (e) => { - if (e.target == modal) closeModal(); -}; - -function editCourse(id) { - showModal(id); -} - -// Initial fetch -fetchCourses(); diff --git a/apps/learning/app/static/style.css b/apps/learning/app/static/style.css deleted file mode 100644 index c7dc8c7..0000000 --- a/apps/learning/app/static/style.css +++ /dev/null @@ -1,175 +0,0 @@ -:root { - --bg: #f3f4f6; - --column-bg: #e5e7eb; - --card-bg: #ffffff; - --primary: #2563eb; - --text: #1f2937; - --border: #d1d5db; -} - -body { - font-family: -apple-system, sans-serif; - background: var(--bg); - color: var(--text); - margin: 0; - padding: 20px; -} - -header { - display: flex; - justify-content: space-between; - align-items: center; - margin-bottom: 2rem; -} - -h1 { margin: 0; } - -#add-course-btn { - background: var(--primary); - color: white; - border: none; - padding: 10px 20px; - border-radius: 6px; - cursor: pointer; - font-weight: bold; -} - -.kanban-board { - display: flex; - gap: 20px; - align-items: flex-start; -} - -.column { - background: var(--column-bg); - border-radius: 8px; - width: 300px; - min-height: 500px; - padding: 15px; - flex-shrink: 0; -} - -.column h2 { - font-size: 1.1rem; - margin-top: 0; - margin-bottom: 1rem; - color: #4b5563; - text-transform: uppercase; - letter-spacing: 0.05em; -} - -.course-list { - min-height: 400px; -} - -.course-card { - background: var(--card-bg); - border-radius: 6px; - padding: 15px; - margin-bottom: 12px; - box-shadow: 0 1px 3px rgba(0,0,0,0.1); - cursor: grab; - position: relative; - border: 1px solid transparent; -} - -.course-card:hover { - border-color: var(--primary); -} - -.course-card.dragging { - opacity: 0.5; -} - -.course-card h3 { - margin: 0 0 8px 0; - font-size: 1rem; -} - -.course-card p { - font-size: 0.85rem; - color: #6b7280; - margin: 0 0 12px 0; -} - -.card-links { - display: flex; - gap: 10px; - font-size: 0.8rem; -} - -.card-links a { - color: var(--primary); - text-decoration: none; -} - -.card-actions { - position: absolute; - top: 10px; - right: 10px; - display: flex; - gap: 5px; -} - -.card-actions button { - background: none; - border: none; - color: #9ca3af; - cursor: pointer; - padding: 2px; -} - -.card-actions button:hover { - color: var(--text); -} - -/* Modal Styles */ -.modal { - display: none; - position: fixed; - z-index: 100; - left: 0; - top: 0; - width: 100%; - height: 100%; - background: rgba(0,0,0,0.5); -} - -.modal-content { - background: white; - margin: 10% auto; - padding: 2rem; - width: 400px; - border-radius: 8px; -} - -.form-group { - margin-bottom: 1rem; -} - -.form-group label { - display: block; - margin-bottom: 5px; - font-size: 0.9rem; -} - -.form-group input, .form-group textarea, .form-group select { - width: 100%; - padding: 8px; - border: 1px solid var(--border); - border-radius: 4px; - box-sizing: border-box; -} - -.modal-actions { - display: flex; - justify-content: flex-end; - gap: 10px; - margin-top: 1.5rem; -} - -.modal-actions button { - padding: 8px 16px; - border-radius: 4px; - cursor: pointer; -}