From d7e8298a5f58e200a393a541d1210ff474f00632 Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Mon, 20 May 2019 11:55:17 +0530 Subject: [PATCH] feat: added program and course pages --- erpnext/www/lms/course.html | 77 ++++++++++++++++++++++++++++++++++++ erpnext/www/lms/course.py | 11 ++++++ erpnext/www/lms/program.html | 25 ++++++------ 3 files changed, 99 insertions(+), 14 deletions(-) create mode 100644 erpnext/www/lms/course.html create mode 100644 erpnext/www/lms/course.py diff --git a/erpnext/www/lms/course.html b/erpnext/www/lms/course.html new file mode 100644 index 00000000000..2e414a03695 --- /dev/null +++ b/erpnext/www/lms/course.html @@ -0,0 +1,77 @@ +{% extends "templates/base.html" %} +{% block title %}{{ course.course_name }}{% endblock %} + +{% block head_include %} + +{% endblock %} + + +{% macro card(topic, index, length) %} +
+ +
+{% endmacro %} + +{% block content %} +
+
+

{{ course.course_name }}

+

{{ course.course_intro }}

+

+ Sign Up +

+
+
+
+ {% for topic in topics %} + {{ card(topic.as_dict(), loop.index, topics|length) }} + {% endfor %} +
+
+
+{% endblock %} \ No newline at end of file diff --git a/erpnext/www/lms/course.py b/erpnext/www/lms/course.py new file mode 100644 index 00000000000..d8670e69776 --- /dev/null +++ b/erpnext/www/lms/course.py @@ -0,0 +1,11 @@ +from __future__ import unicode_literals +import erpnext.education.utils as utils +import frappe + +no_cache = 1 + +def get_context(context): + context.education_settings = frappe.get_single("Education Settings") + course = frappe.get_doc('Course', frappe.form_dict['name']) + context.course = course + context.topics = course.get_topics() \ No newline at end of file diff --git a/erpnext/www/lms/program.html b/erpnext/www/lms/program.html index 60104e72d1f..35f7f8a69c0 100644 --- a/erpnext/www/lms/program.html +++ b/erpnext/www/lms/program.html @@ -31,23 +31,20 @@ {% endblock %} -{% macro card(program, is_enrolled) %} -
-
- - {% if program.hero_image %} -
+{% macro card(course, index, length) %} +
- {% for program in all_programs %} - {{ card(program.program, program.is_enrolled) }} + {% for course in program.courses %} + {{ card(frappe.get_doc("Course", course.course), loop.index, program.courses|length) }} {% endfor %}