feat: added topic page
diff --git a/erpnext/education/doctype/course/course.json b/erpnext/education/doctype/course/course.json
index 234b29d..7d8b073 100644
--- a/erpnext/education/doctype/course/course.json
+++ b/erpnext/education/doctype/course/course.json
@@ -14,7 +14,7 @@
   "course_abbreviation",
   "section_break_6",
   "topics",
-  "course_intro",
+  "description",
   "hero_image",
   "assessment",
   "default_grading_scale",
@@ -69,11 +69,6 @@
    "options": "Course Topic"
   },
   {
-   "fieldname": "course_intro",
-   "fieldtype": "Small Text",
-   "label": "Course Intro"
-  },
-  {
    "fieldname": "hero_image",
    "fieldtype": "Attach Image",
    "label": "Hero Image"
@@ -94,9 +89,14 @@
    "fieldtype": "Table",
    "label": "Assessment Criteria",
    "options": "Course Assessment Criteria"
+  },
+  {
+   "fieldname": "description",
+   "fieldtype": "Small Text",
+   "label": "Description"
   }
  ],
- "modified": "2019-05-20 19:27:09.381482",
+ "modified": "2019-06-05 18:39:11.870605",
  "modified_by": "Administrator",
  "module": "Education",
  "name": "Course",
diff --git a/erpnext/education/doctype/topic/topic.json b/erpnext/education/doctype/topic/topic.json
index f47b10d..6e748fd 100644
--- a/erpnext/education/doctype/topic/topic.json
+++ b/erpnext/education/doctype/topic/topic.json
@@ -1,297 +1,104 @@
 {
- "allow_copy": 0, 
- "allow_events_in_timeline": 0, 
- "allow_guest_to_view": 0, 
- "allow_import": 0, 
- "allow_rename": 0, 
- "autoname": "field:topic_code", 
- "beta": 0, 
- "creation": "2018-12-12 11:37:39.917760", 
- "custom": 0, 
- "docstatus": 0, 
- "doctype": "DocType", 
- "document_type": "", 
- "editable_grid": 1, 
- "engine": "InnoDB", 
+ "autoname": "field:topic_code",
+ "creation": "2018-12-12 11:37:39.917760",
+ "doctype": "DocType",
+ "editable_grid": 1,
+ "engine": "InnoDB",
+ "field_order": [
+  "topic_name",
+  "column_break_2",
+  "topic_code",
+  "section_break_4",
+  "topic_content",
+  "description",
+  "hero_image"
+ ],
  "fields": [
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fetch_if_empty": 0, 
-   "fieldname": "topic_name", 
-   "fieldtype": "Data", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 1, 
-   "in_standard_filter": 0, 
-   "label": "Name", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 1, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "translatable": 0, 
-   "unique": 0
-  }, 
+   "fieldname": "topic_name",
+   "fieldtype": "Data",
+   "in_list_view": 1,
+   "label": "Name",
+   "reqd": 1
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fetch_if_empty": 0, 
-   "fieldname": "column_break_2", 
-   "fieldtype": "Column Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "translatable": 0, 
-   "unique": 0
-  }, 
+   "fieldname": "column_break_2",
+   "fieldtype": "Column Break"
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fetch_if_empty": 0, 
-   "fieldname": "topic_code", 
-   "fieldtype": "Data", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 1, 
-   "in_standard_filter": 0, 
-   "label": "Code", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 1, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "translatable": 0, 
+   "fieldname": "topic_code",
+   "fieldtype": "Data",
+   "in_list_view": 1,
+   "label": "Code",
+   "reqd": 1,
    "unique": 1
-  }, 
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fetch_if_empty": 0, 
-   "fieldname": "section_break_4", 
-   "fieldtype": "Section Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "translatable": 0, 
-   "unique": 0
-  }, 
+   "fieldname": "section_break_4",
+   "fieldtype": "Section Break"
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fetch_if_empty": 0, 
-   "fieldname": "topic_content", 
-   "fieldtype": "Table", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Topic Content", 
-   "length": 0, 
-   "no_copy": 0, 
-   "options": "Topic Content", 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "translatable": 0, 
-   "unique": 0
-  }, 
+   "fieldname": "topic_content",
+   "fieldtype": "Table",
+   "label": "Topic Content",
+   "options": "Topic Content"
+  },
   {
-   "allow_bulk_edit": 0, 
-   "allow_in_quick_entry": 0, 
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "columns": 0, 
-   "fetch_if_empty": 0, 
-   "fieldname": "hero_image", 
-   "fieldtype": "Attach Image", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "ignore_xss_filter": 0, 
-   "in_filter": 0, 
-   "in_global_search": 0, 
-   "in_list_view": 0, 
-   "in_standard_filter": 0, 
-   "label": "Hero Image", 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "print_hide_if_no_value": 0, 
-   "read_only": 0, 
-   "remember_last_selected_value": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "translatable": 0, 
-   "unique": 0
+   "fieldname": "hero_image",
+   "fieldtype": "Attach Image",
+   "label": "Hero Image"
+  },
+  {
+   "fieldname": "description",
+   "fieldtype": "Small Text",
+   "label": "Description"
   }
- ], 
- "has_web_view": 0, 
- "hide_toolbar": 0, 
- "idx": 0, 
- "in_create": 0, 
- "is_submittable": 0, 
- "issingle": 0, 
- "istable": 0, 
- "max_attachments": 0, 
- "menu_index": 0, 
- "modified": "2019-04-09 11:35:34.137040", 
- "modified_by": "Administrator", 
- "module": "Education", 
- "name": "Topic", 
- "name_case": "", 
- "owner": "Administrator", 
+ ],
+ "modified": "2019-06-05 18:38:44.029711",
+ "modified_by": "Administrator",
+ "module": "Education",
+ "name": "Topic",
+ "owner": "Administrator",
  "permissions": [
   {
-   "amend": 0, 
-   "cancel": 0, 
-   "create": 1, 
-   "delete": 1, 
-   "email": 1, 
-   "export": 1, 
-   "if_owner": 0, 
-   "import": 0, 
-   "permlevel": 0, 
-   "print": 1, 
-   "read": 1, 
-   "report": 1, 
-   "role": "System Manager", 
-   "set_user_permissions": 0, 
-   "share": 1, 
-   "submit": 0, 
+   "create": 1,
+   "delete": 1,
+   "email": 1,
+   "export": 1,
+   "print": 1,
+   "read": 1,
+   "report": 1,
+   "role": "System Manager",
+   "share": 1,
    "write": 1
-  }, 
+  },
   {
-   "amend": 0, 
-   "cancel": 0, 
-   "create": 1, 
-   "delete": 1, 
-   "email": 1, 
-   "export": 1, 
-   "if_owner": 0, 
-   "import": 0, 
-   "permlevel": 0, 
-   "print": 1, 
-   "read": 1, 
-   "report": 1, 
-   "role": "Administrator", 
-   "set_user_permissions": 0, 
-   "share": 1, 
-   "submit": 0, 
+   "create": 1,
+   "delete": 1,
+   "email": 1,
+   "export": 1,
+   "print": 1,
+   "read": 1,
+   "report": 1,
+   "role": "Administrator",
+   "share": 1,
    "write": 1
-  }, 
+  },
   {
-   "amend": 0, 
-   "cancel": 0, 
-   "create": 1, 
-   "delete": 1, 
-   "email": 1, 
-   "export": 1, 
-   "if_owner": 0, 
-   "import": 0, 
-   "permlevel": 0, 
-   "print": 1, 
-   "read": 1, 
-   "report": 1, 
-   "role": "Instructor", 
-   "set_user_permissions": 0, 
-   "share": 1, 
-   "submit": 0, 
+   "create": 1,
+   "delete": 1,
+   "email": 1,
+   "export": 1,
+   "print": 1,
+   "read": 1,
+   "report": 1,
+   "role": "Instructor",
+   "share": 1,
    "write": 1
   }
- ], 
- "quick_entry": 1, 
- "read_only": 0, 
- "show_name_in_global_search": 0, 
- "sort_field": "modified", 
- "sort_order": "DESC", 
- "track_changes": 1, 
- "track_seen": 0, 
- "track_views": 0
+ ],
+ "quick_entry": 1,
+ "sort_field": "modified",
+ "sort_order": "DESC",
+ "track_changes": 1
 }
\ No newline at end of file
diff --git a/erpnext/www/lms/course.html b/erpnext/www/lms/course.html
index 1182eb9..d046ac8 100644
--- a/erpnext/www/lms/course.html
+++ b/erpnext/www/lms/course.html
@@ -36,7 +36,7 @@
 <div class="col-sm-{{ 12 if length%3 == 1 and index == 1 else 6 if length%3 == 2 and index in [1,2] else 4}} mb-4 text-left">
 	<div class="card h-100">
 		{% if has_access %}
-			<a href="/lms/content?program={{ program }}&course={{ course.name }}&topic={{ topic.name }}&type={{ topic.topic_content[0].content_type }}&content={{ topic.topic_content[0].content }}" class="no-decoration no-underline">
+			<a href="/lms/topic?program={{ program }}&course={{ course.name }}&topic={{ topic.name }}" class="no-decoration no-underline">
 		{% else %}
 			<div>
 		{% endif %}
@@ -72,7 +72,7 @@
 				{% elif progress[topic.name].started %}
 					<span class="indicator orange">In Progress</span>
 				{% else %}
-					<span class="indicator blue">Open</span>
+					<span class="indicator blue">Start</span>
 				{% endif %}
 			</div>
 			</a>
@@ -85,11 +85,11 @@
 
 {% block content %}
 <section class="section ">
-	{{ hero(course.course_name, course.course_intro, has_access, {'name': 'Program', 'url': '/lms/program?program=' + program }) }}
+	{{ hero(course.course_name, course.description, has_access, {'name': 'Program', 'url': '/lms/program?program=' + program }) }}
 	<div class='container'>
 		<div class="row mt-5">
 			{% for topic in topics %}
-				{{ card(topic.as_dict(), loop.index, topics|length) }}
+				{{ card(topic, loop.index, topics|length) }}
 			{% endfor %}
 		</div>
 	</div>
diff --git a/erpnext/www/lms/macros/hero.html b/erpnext/www/lms/macros/hero.html
index d9c4059..85052e1 100644
--- a/erpnext/www/lms/macros/hero.html
+++ b/erpnext/www/lms/macros/hero.html
@@ -2,7 +2,7 @@
 	<div class='container pb-5'>
 		<div class="mb-3">
 			<a href="{{ back.url }}" class="text-muted">
-				<i class="fa fa-chevron-left"></i> Back to {{ back.name }}
+				<i class="octicon octicon-chevron-left"></i> Back to {{ back.name }}
 			</a>
 		</div>
 		<h1>{{ title }}</h1>
diff --git a/erpnext/www/lms/program.html b/erpnext/www/lms/program.html
index 07536da..615abd5 100644
--- a/erpnext/www/lms/program.html
+++ b/erpnext/www/lms/program.html
@@ -45,7 +45,7 @@
 		{% endif %}
 		<div class='card-body'>
 			<h5 class='card-title'>{{ course.course_name }}</h5>
-			<div>{{ course.course_intro or '' }}</div>
+			<div>{{ course.description or '' }}</div>
 		</div>
 		{% if has_access and progress[course.name] %}
 		<div class='card-footer'>
@@ -54,7 +54,7 @@
 			{% elif progress[course.name].started %}
 			<span class="indicator orange">In Progress</span>
 			{% else %}
-			<span class="indicator blue">Open</span>
+			<span class="indicator blue">Start</span>
 			{% endif %}
 		</div>
 		{% endif %}
diff --git a/erpnext/www/lms/topic.html b/erpnext/www/lms/topic.html
new file mode 100644
index 0000000..bb96007
--- /dev/null
+++ b/erpnext/www/lms/topic.html
@@ -0,0 +1,44 @@
+{% extends "templates/base.html" %}
+{% block title %}Topic Title{% endblock %}
+{% from "www/lms/macros/hero.html" import hero %}
+
+
+{% macro card(content, index, length) %}
+<div class="col-sm-{{ 12 if length%3 == 1 and index == 1 else 6 if length%3 == 2 and index in [1,2] else 4}} mb-4 text-left">
+	<a href="/lms/content?program={{ program }}&course={{ course }}&topic={{ topic.name }}&type={{ content.content_type }}&content={{ content.content.name }}" class="no-decoration no-underline">
+	<div class="card h-100">
+		<div class='card-body'>
+			<div>{{ content.content_type or '' }}</div>
+			<h5 class='card-title'>{{ content.content.name }}</h5>
+		</div>
+		{% if has_access %}
+		<div class='card-footer'>
+			{% if content.content_type == 'Quiz' %}
+				{% if content.result == 'Fail' %} <span class="indicator red">Fail <span class="text-muted">({{ content.score }}/100)</span></span>
+				{% elif content.result == 'Pass' %} <span class="indicator green">Pass <span class="text-muted">({{ content.score }}/100)</span>
+				{% else %} <span class="indicator blue">Start</span>
+				{% endif %}
+			{% else %}
+				{% if content.completed %} <span class="indicator green">Completed</span>
+				{% else %} <span class="indicator blue">Start</span>
+				{% endif %}
+			{% endif %}
+		</div>
+		{% endif %}
+	</div>
+	</a>
+</div>
+{% endmacro %}
+
+{% block content %}
+<section class="section">
+	{{ hero(topic.topic_name, topic.description, has_access, {'name': 'Course', 'url': '/lms/course?name=' + course +'&program=' + program}) }}
+	<div class='container'>
+		<div class="row mt-5">
+			{% for content in contents %}
+				{{ card(content, loop.index, topic.contents|length) }}
+			{% endfor %}
+		</div>
+	</div>
+</section>
+{% endblock %}
\ No newline at end of file
diff --git a/erpnext/www/lms/topic.py b/erpnext/www/lms/topic.py
new file mode 100644
index 0000000..d2c6da3
--- /dev/null
+++ b/erpnext/www/lms/topic.py
@@ -0,0 +1,34 @@
+from __future__ import unicode_literals
+import erpnext.education.utils as utils
+import frappe
+
+no_cache = 1
+
+def get_context(context):
+	course = frappe.form_dict['course']
+	program = frappe.form_dict['program']
+	topic = frappe.form_dict['topic']
+
+	context.program = program
+	context.course = course
+	context.topic = frappe.get_doc("Topic", topic)
+	context.contents = get_contents(context.topic, course, program)
+	context.has_access =  utils.allowed_program_access(program)
+
+def get_contents(topic, course, program):
+	student = utils.get_current_student()
+	if not student:
+		return None
+	course_enrollment = utils.get_or_create_course_enrollment(course, program)
+	contents = topic.get_contents()
+	progress = []
+	if contents:
+		for content in contents:
+			if content.doctype in ('Article', 'Video'):
+				status = utils.check_content_completion(content.name, content.doctype, course_enrollment.name)
+				progress.append({'content': content, 'content_type': content.doctype, 'completed': status})
+			elif content.doctype == 'Quiz':
+				status, score, result = utils.check_quiz_completion(content, course_enrollment.name)
+				progress.append({'content': content, 'content_type': content.doctype, 'completed': status, 'score': score, 'result': result})
+
+	return progress
\ No newline at end of file