From 62cfc0fb24be7bfc62b36a813332292a6846957c Mon Sep 17 00:00:00 2001 From: Anand Chitipothu Date: Mon, 3 May 2021 06:17:56 +0530 Subject: [PATCH] feat: Added ChapterTeaser widget --- community/lms/widgets/ChapterTeaser.html | 8 ++++++++ community/public/css/style.less | 18 ++++++++++++++++++ community/www/courses/course.html | 24 ++++-------------------- community/www/courses/course.py | 4 ++-- 4 files changed, 32 insertions(+), 22 deletions(-) create mode 100644 community/lms/widgets/ChapterTeaser.html diff --git a/community/lms/widgets/ChapterTeaser.html b/community/lms/widgets/ChapterTeaser.html new file mode 100644 index 00000000..12e0569c --- /dev/null +++ b/community/lms/widgets/ChapterTeaser.html @@ -0,0 +1,8 @@ +
+
+

{{ chapter.title }}

+
+ {{ chapter.description or "" }} +
+
+
diff --git a/community/public/css/style.less b/community/public/css/style.less index a138e984..197be4ad 100644 --- a/community/public/css/style.less +++ b/community/public/css/style.less @@ -4,6 +4,13 @@ background: white; border-radius: 10px; border: 1px solid #ddd; + + .teaser-body { + padding: 20px; + } + .teaser-footer { + padding: 20px; + } } .sketch-teaser { @@ -66,3 +73,14 @@ section.lightgray { #hero .jumbotron { background: inherit; } + +.chapter-teaser { + .teaser(); + color: #444; + margin: 20px 0px; + + h3, h4 { + color: black; + font-weight: bold; + } +} diff --git a/community/www/courses/course.html b/community/www/courses/course.html index 5989e0f6..e9300de3 100644 --- a/community/www/courses/course.html +++ b/community/www/courses/course.html @@ -131,25 +131,9 @@ {% endmacro %} {% macro CourseOutline(course) %} -

Course Outline

+

Course Outline

-{% for chapter in course.topics %} -
-

{{loop.index}} {{chapter.title}}

-
- {{chapter.preview | markdown}} -
- - {# -
- {% for lesson in chapter.lessons %} -
- - {{lesson.title}} -
- {% endfor %} -
- #} -
-{% endfor %} + {% for chapter in course.chapters %} + {{ widgets.ChapterTeaser(chapter=chapter)}} + {% endfor %} {% endmacro %} diff --git a/community/www/courses/course.py b/community/www/courses/course.py index e0418096..70658252 100644 --- a/community/www/courses/course.py +++ b/community/www/courses/course.py @@ -29,11 +29,11 @@ def get_course(slug): course = frappe.db.get_value("LMS Course", {"slug": slug}, ["name", "slug", "title", "description", "short_introduction", "video_link", "owner"], as_dict=1) - course["topics"] = frappe.db.get_all("LMS Topic", + course["chapters"] = frappe.db.get_all("Chapter", filters={ "course": course["name"] }, - fields=["name", "slug", "title", "preview"], + fields=["name", "title", "description"], order_by="creation" ) return course