-
+
+
+
+
+ {{ Outline(chapters) }}
+ {{ CreateChapter() }}
{{ EmptyState() }}
{% endblock %}
+{% macro Outline(chapters) %}
+{% if chapters %}
+{% for chapter in chapters %}
+
+
+
+
+
+ {{ chapter.title }}
+
+
+
+ {% for lesson in get_lessons(course.name, chapter) %}
+
+
+
+
+ {{ lesson.title }}
+
+
+ {% endfor %}
+
+
+
+
+{% endfor %}
+{% endif %}
+{% endmacro %}
+
+
+{% macro CreateChapter() %}
+
+
+
+
+
+ {{ _("Chapter Title") }}
+
+
+ {{ _("Something Short and Concise") }}
+
+
+
+
+
+
+
+
+
+
+ {{ _("Short Description") }}
+
+
+ {{ _("A breif description about this chapter.") }}
+
+
+
+
+
+
+
+
+{% endmacro %}
+
+
{% macro EmptyState() %}
diff --git a/lms/www/courses/outline.js b/lms/www/courses/outline.js
new file mode 100644
index 00000000..ae5ec9c1
--- /dev/null
+++ b/lms/www/courses/outline.js
@@ -0,0 +1,13 @@
+frappe.ready(() => {
+ pin_header();
+});
+
+const pin_header = () => {
+ const el = document.querySelector(".sticky");
+ const observer = new IntersectionObserver(
+ ([e]) =>
+ e.target.classList.toggle("is-pinned", e.intersectionRatio < 1),
+ { threshold: [1] }
+ );
+ observer.observe(el);
+};
diff --git a/lms/www/courses/outline.py b/lms/www/courses/outline.py
index 873e3656..087fc587 100644
--- a/lms/www/courses/outline.py
+++ b/lms/www/courses/outline.py
@@ -1,4 +1,5 @@
import frappe
+from lms.lms.utils import get_chapters
def get_context(context):
@@ -6,3 +7,4 @@ def get_context(context):
context.course = frappe.db.get_value(
"LMS Course", frappe.form_dict["course"], ["name", "title"], as_dict=True
)
+ context.chapters = get_chapters(context.course.name)