diff --git a/erpnext/education/doctype/video/video.json b/erpnext/education/doctype/video/video.json
index d10f1968722..d8c3368d93f 100644
--- a/erpnext/education/doctype/video/video.json
+++ b/erpnext/education/doctype/video/video.json
@@ -54,7 +54,7 @@
"collapsible": 0,
"columns": 0,
"fieldname": "description",
- "fieldtype": "Data",
+ "fieldtype": "Text Editor",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
@@ -185,7 +185,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
- "modified": "2018-10-17 06:57:00.219252",
+ "modified": "2018-10-18 12:26:47.709081",
"modified_by": "Administrator",
"module": "Education",
"name": "Video",
diff --git a/erpnext/www/lms/course.html b/erpnext/www/lms/course.html
index 5e2e393ffac..9896b017aa3 100644
--- a/erpnext/www/lms/course.html
+++ b/erpnext/www/lms/course.html
@@ -1,45 +1,41 @@
{% extends "frappe_theme/templates/base.html" %}
{% block title %}ERPNext Academy{% endblock %}
-
{% from "templates/includes/media.html" import media %}
-
{% block head_include %}
{% endblock %}
-
{% block content %}
-
-{% with quiz = quiz, current_content = current_content, next_content = next_content, course_name = course_name, program=current_program%}
-{% include "www/lms/templates/includes/" + current_content.content_type.lower() + ".html" %}
-{% endwith %}
+
+ {% with content = current_content, next_content = next_content, course_name = course_name, program_name = program_name %}
+ {% include "www/lms/templates/includes/" + content_type.lower() + ".html" %}
+ {% endwith %}
-
{% endblock %}
\ No newline at end of file
diff --git a/erpnext/www/lms/course.js b/erpnext/www/lms/course.js
index e8f1dd5d0fe..a25d00e471e 100644
--- a/erpnext/www/lms/course.js
+++ b/erpnext/www/lms/course.js
@@ -34,4 +34,4 @@ function addActivity() {
"program": $('#content-holder').data('program'),
}
})
-}
\ No newline at end of file
+}
diff --git a/erpnext/www/lms/course.py b/erpnext/www/lms/course.py
index 19e495fab3a..9e874273ee4 100644
--- a/erpnext/www/lms/course.py
+++ b/erpnext/www/lms/course.py
@@ -1,23 +1,31 @@
from __future__ import unicode_literals
import erpnext.education.utils as utils
+from urlparse import urlparse, parse_qs
import frappe
def get_context(context):
if frappe.form_dict['course']:
- context.current_content = frappe.get_doc("Content", frappe.form_dict["content"])
- context.course_name = frappe.form_dict["course"]
- context.current_course = utils.get_contents_in_course(context.course_name)
- context.current_program = frappe.form_dict["program"]
- context.next_content = get_next_content(context)
- if context.current_content.content_type == "Quiz":
- context.questions = utils.get_quiz_as_dict(context.current_content.name)
+ # Save form_dict variables
+ program_name = frappe.form_dict["program"]
+ course_name = frappe.form_dict["course"]
+ content_name = frappe.form_dict["content"]
+ content_type = frappe.form_dict["type"]
+ # Get the required doctypes
+ current_course = frappe.get_doc("Course", course_name)
+ current_content = frappe.get_doc(content_type, content_name)
-def get_next_content(context):
- if context.current_course:
- course_data = [content.name for content in context.current_course]
- try:
- return course_data[course_data.index(context.current_content.name) + 1]
- except IndexError:
- return None
\ No newline at end of file
+ # Saving context variables for Jinja
+ context.current_content = current_content
+ context.course_name = course_name
+ context.program_name = program_name
+ context.content_type = content_type
+ context.next_content_type, context.next_content = get_next_content(content_name, content_type, current_course.get_content_info())
+
+def get_next_content(c_name, c_type, content_list):
+ try:
+ next = content_list[content_list.index([c_type, c_name]) + 1]
+ return next[0], next[1]
+ except IndexError:
+ return None, None
\ No newline at end of file
diff --git a/erpnext/www/lms/program.html b/erpnext/www/lms/program.html
index 5c1f15994ce..00e13cb0ca8 100644
--- a/erpnext/www/lms/program.html
+++ b/erpnext/www/lms/program.html
@@ -11,7 +11,7 @@
-
{{ course.name }}
+
{{ course.course_name }}
Course Content
diff --git a/erpnext/www/lms/program.py b/erpnext/www/lms/program.py
index c5bf0188788..10bdd6b1879 100644
--- a/erpnext/www/lms/program.py
+++ b/erpnext/www/lms/program.py
@@ -4,5 +4,8 @@ import frappe
def get_context(context):
- context.program = frappe.get_doc("Program", frappe.form_dict["program"])
- context.course_list = utils.get_courses_in_program(frappe.form_dict["program"])
\ No newline at end of file
+ program = frappe.get_doc("Program", frappe.form_dict["program"])
+ course_list = program.get_course_list()
+
+ context.program = program
+ context.course_list = course_list
\ No newline at end of file
diff --git a/erpnext/www/lms/templates/includes/article.html b/erpnext/www/lms/templates/includes/article.html
index 2ca93fa43b9..15835b816fe 100644
--- a/erpnext/www/lms/templates/includes/article.html
+++ b/erpnext/www/lms/templates/includes/article.html
@@ -2,19 +2,15 @@
-
{{ current_content.name }}
+ {{ content.title }}
- 49 Mins
- — Published on 28th October 2018.
+ Published on {{ content.publish_date }}, by {{ content.author }}
-
Previous
- {% if next_content != None %}
-
Next
- {% else %}
-
Finish Course
- {% endif %}
+ {% with next_content = next_content, course_name = course_name, program_name = program_name %}
+ {% include "www/lms/templates/includes/lms-nav.html" %}
+ {% endwith %}
@@ -23,11 +19,12 @@
- {{ current_content.article_content }}
+ {{ content.content }}
-
-
Previous
-
Next
+
+ {% with next_content = next_content, course_name = course_name, program_name = program_name %}
+ {% include "www/lms/templates/includes/lms-nav.html" %}
+ {% endwith %}
Report a
diff --git a/erpnext/www/lms/templates/includes/lms-nav.html b/erpnext/www/lms/templates/includes/lms-nav.html
new file mode 100644
index 00000000000..64932f65f77
--- /dev/null
+++ b/erpnext/www/lms/templates/includes/lms-nav.html
@@ -0,0 +1,6 @@
+Previous
+{% if next_content != None %}
+
Next
+{% else %}
+
Finish Course
+{% endif %}
\ No newline at end of file
diff --git a/erpnext/www/lms/templates/includes/video.html b/erpnext/www/lms/templates/includes/video.html
index 6727321dec9..e3ddacb54f9 100644
--- a/erpnext/www/lms/templates/includes/video.html
+++ b/erpnext/www/lms/templates/includes/video.html
@@ -1,23 +1,20 @@
-
+
-
{{ current_content.name }}
+ {{ content.name }}
- 49 Mins
- — Published on 28th October 2018.
+ {{ content.duration }} Mins
+ — Published on {{ content.publish_date }}.
-
Previous
- {% if next_content != None %}
-
Next
- {% else %}
-
Finish Course
- {% endif %}
+ {% with next_content = next_content, course_name = course_name, program_name = program_name %}
+ {% include "www/lms/templates/includes/lms-nav.html" %}
+ {% endwith %}
@@ -26,7 +23,7 @@
- {{ current_content.video_description }}
+ {{ content.description }}