diff --git a/erpnext/public/js/education/lms/call.js b/erpnext/public/js/education/lms/call.js index e35acbdd75..4edcaaa6d6 100644 --- a/erpnext/public/js/education/lms/call.js +++ b/erpnext/public/js/education/lms/call.js @@ -2,7 +2,7 @@ frappe.ready(() => { frappe.provide('lms'); lms.call = (method, args) => { - const method_path = 'erpnext.www.lms.' + method; + const method_path = 'erpnext.www.lms_legacy.' + method; return new Promise((resolve, reject) => { return frappe.call({ method: method_path, diff --git a/erpnext/www/lms/__init__.py b/erpnext/www/lms/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/www/lms/all-programs.html b/erpnext/www/lms/all-programs.html new file mode 100644 index 0000000000..1003e5e087 --- /dev/null +++ b/erpnext/www/lms/all-programs.html @@ -0,0 +1,76 @@ +{% extends "templates/base.html" %} +{% block title %}All Programs{% endblock %} + +{% block head_include %} + +{% endblock %} + + +{% macro card(program, is_enrolled) %} +
+
+ + {% if program.hero_image %} +
+ {% else %} +
+
{{ program.program_name }}
+
+ {% endif %} +
+
{{ program.program_name }}
+
{{ program.description }}
+
+
+ +
+
+{% endmacro %} + +{% block content %} +
+
+

All Programs

+

+ Start Learning +

+
+
+
+ {% for program in all_programs %} + {{ card(program.program, program.is_enrolled) }} + {% endfor %} +
+

+ View All Programs +

+
+
+{% endblock %} \ No newline at end of file diff --git a/erpnext/www/lms/all_programs.py b/erpnext/www/lms/all_programs.py new file mode 100644 index 0000000000..aa10e2b039 --- /dev/null +++ b/erpnext/www/lms/all_programs.py @@ -0,0 +1,15 @@ +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") + context.all_programs = get_all_programs() + +def get_all_programs(): + program_names = frappe.get_all("Program", filters={"is_published": True}) + if program_names: + program_list = [utils.get_program_and_enrollment_status(program['name']) for program in program_names] + return program_list diff --git a/erpnext/www/lms/index.html b/erpnext/www/lms/index.html new file mode 100644 index 0000000000..f4756993cf --- /dev/null +++ b/erpnext/www/lms/index.html @@ -0,0 +1,118 @@ +{% extends "templates/base.html" %} +{% block title %}{{ education_settings.portal_title }}{% endblock %} + +{% block head_include %} + + + +{% endblock %} + + +{% macro card(program, is_enrolled) %} +
+
+ + {% if program.hero_image %} +
+ {% else %} +
+
{{ program.program_name }}
+
+ {% endif %} +
+
{{ program.program_name }}
+
{{ program.description }}
+
+
+ +
+
+{% endmacro %} + +{% block content %} +
+
+

{{ education_settings.portal_title }}

+

{{ education_settings.description }}

+

+ Start Learning +

+ Go to erpnext.com +
+
+
+ {% for program in featured_programs %} + {{ card(program.program, program.is_enrolled) }} + {% endfor %} +
+

+ View All Programs +

+
+
+
+
+
+
+ +
+
Curated Courses
+
Start with a 14 day trial to get instant access to your own ERPNext Instance. Get expert support and world class hosting too.
+
+
+ +
+ +
+
Built by Experts
+
For self hosted users, ERPNext Support provides you the priority support and bug fix guarantee, so you can stop worrying.
+
+
+ +
+ +
+
Learn from the OEMs
+
ERPNext is open source and infinitely extensible. Customize it, build upon it, add your own apps built with Frappe Framework.
+
+
+
+
+
+
+
+

About ERPNext

+

ERPNext is the world's best 100% open source ERP used by over 5000 companies worldwide.

+ +
+
+{% endblock %} \ No newline at end of file diff --git a/erpnext/www/lms/index.py b/erpnext/www/lms/index.py new file mode 100644 index 0000000000..99dcb651aa --- /dev/null +++ b/erpnext/www/lms/index.py @@ -0,0 +1,24 @@ +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") + context.featured_programs = get_featured_programs() + + +def get_featured_programs(): + featured_program_names = frappe.get_all("Program", filters={"is_published": True, "is_featured": True}) + if featured_program_names: + featured_list = [utils.get_program_and_enrollment_status(program['name']) for program in featured_program_names] + return featured_list + else: + return get_all_programs()[:2] + +def get_all_programs(): + program_names = frappe.get_all("Program", filters={"is_published": True}) + if program_names: + program_list = [utils.get_program_and_enrollment_status(program['name']) for program in program_names] + return program_list diff --git a/erpnext/www/lms/program.html b/erpnext/www/lms/program.html new file mode 100644 index 0000000000..60104e72d1 --- /dev/null +++ b/erpnext/www/lms/program.html @@ -0,0 +1,74 @@ +{% extends "templates/base.html" %} +{% block title %}{{ program.program_name }}{% endblock %} + +{% block head_include %} + +{% endblock %} + + +{% macro card(program, is_enrolled) %} +
+
+ + {% if program.hero_image %} +
+ {% else %} +
+
{{ program.program_name }}
+
+ {% endif %} +
+
{{ program.program_name }}
+
{{ program.description }}
+
+
+ +
+
+{% endmacro %} + +{% block content %} +
+
+

{{ program.program_name }}

+

{{ program.description }}

+

+ Sign Up +

+
+
+
+ {% for program in all_programs %} + {{ card(program.program, program.is_enrolled) }} + {% endfor %} +
+
+
+{% endblock %} \ No newline at end of file diff --git a/erpnext/www/lms/program.py b/erpnext/www/lms/program.py new file mode 100644 index 0000000000..f38e65246b --- /dev/null +++ b/erpnext/www/lms/program.py @@ -0,0 +1,15 @@ +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") + context.program = get_program(frappe.form_dict['name']) + +def get_program(program_name): + try: + return frappe.get_doc('Program', program_name) + except frappe.DoesNotExistError: + frappe.throw(_("Program {0} does not exist.".format(program_name))) \ No newline at end of file diff --git a/erpnext/www/lms.py b/erpnext/www/lms_legacy.py similarity index 100% rename from erpnext/www/lms.py rename to erpnext/www/lms_legacy.py diff --git a/erpnext/www/lms.html b/erpnext/www/lms_old.html similarity index 100% rename from erpnext/www/lms.html rename to erpnext/www/lms_old.html