feat: Added ChapterTeaser widget

This commit is contained in:
Anand Chitipothu
2021-05-03 06:17:56 +05:30
parent a52a01ef7f
commit 62cfc0fb24
4 changed files with 32 additions and 22 deletions

View File

@@ -0,0 +1,8 @@
<div class="chapter-teaser">
<div class="teaser-body">
<h3 class="chapter-title">{{ chapter.title }}</h3>
<div class="chapter-description">
{{ chapter.description or "" }}
</div>
</div>
</div>

View File

@@ -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;
}
}

View File

@@ -131,25 +131,9 @@
{% endmacro %}
{% macro CourseOutline(course) %}
<h2>Course Outline</h2>
<h2>Course Outline</h2>
{% for chapter in course.topics %}
<div class="chapter-plan">
<h3><span class="chapter-number">{{loop.index}}</span> {{chapter.title}}</h3>
<div class="chapter-description">
{{chapter.preview | markdown}}
</div>
{#
<div class="lessons">
{% for lesson in chapter.lessons %}
<div class="lesson">
<span class="lesson-type"><i class="{{lesson.icon}}"></i></span>
<span class="lesson-title">{{lesson.title}}</span>
</div>
{% endfor %}
</div>
#}
</div>
{% endfor %}
{% for chapter in course.chapters %}
{{ widgets.ChapterTeaser(chapter=chapter)}}
{% endfor %}
{% endmacro %}

View File

@@ -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