feat: added home page

- Refactored the lms_course page and added find_all method to find courses
- Added CourseTeaser widget
- Added /home as a portal page
This commit is contained in:
Anand Chitipothu
2021-04-29 10:48:12 +05:30
parent 20ccc09869
commit e207320721
6 changed files with 89 additions and 1 deletions

View File

@@ -0,0 +1,39 @@
{% extends "templates/base.html" %}
{% block content %}
<div class="container">
{{ HeroSection() }}
{{ ExploreCourses(courses) }}
{{ RecentSketches(recent_sketches) }}
</div>
{% endblock %}
{% macro HeroSection() %}
<div>TODO: Hero
</div>
{% endmacro %}
{% macro ExploreCourses(courses) %}
<div id="explore-courses">
<h2>Explore Courses</h2>
<div class="row">
{% for course in courses %}
<div class="col-md-6">
{{ widgets.CoursePreview(course=course) }}
</div>
{% endfor %}
</div>
{% endmacro %}
{% macro RecentSketches(sketches) %}
<div id="recet-sketches">
<h2>Recent Sketches</h2>
<div class="row">
{% for sketch in sketches %}
<div class="col-md-3">
{{ widgets.SketchPreview(sketch=sketch) }}
</div>
{% endfor %}
</div>
</div>
{% endmacro %}

View File

@@ -0,0 +1,7 @@
import frappe
from community.lms.models import Course, Sketch
def get_context(context):
context.no_cache = 1
context.courses = Course.find_all()
context.recent_sketches = Sketch.get_recent_sketches(limit=8)