diff --git a/lms/hooks.py b/lms/hooks.py index a7f3b43d..a6b3e24c 100644 --- a/lms/hooks.py +++ b/lms/hooks.py @@ -63,6 +63,8 @@ after_sync = "lms.install.after_sync" after_uninstall = "lms.install.after_uninstall" +setup_wizard_requires = "assets/lms/js/setup_wizard.js" + # Desk Notifications # ------------------ # See frappe.core.notifications.get_notification_config @@ -285,4 +287,6 @@ profile_url_prefix = "/users/" signup_form_template = "lms.plugins.show_custom_signup" -on_login = "lms.overrides.user.set_country_from_ip" +on_login = "lms.overrides.user.on_login" + +on_session_creation = "lms.overrides.user.on_session_creation" diff --git a/lms/lms/doctype/lms_course_enrollment/lms_course_enrollment.js b/lms/lms/doctype/lms_course_enrollment/lms_course_enrollment.js deleted file mode 100644 index 7d8ffed3..00000000 --- a/lms/lms/doctype/lms_course_enrollment/lms_course_enrollment.js +++ /dev/null @@ -1,7 +0,0 @@ -// Copyright (c) 2021, FOSS United and contributors -// For license information, please see license.txt - -frappe.ui.form.on("LMS Course Enrollment", { - // refresh: function(frm) { - // } -}); diff --git a/lms/lms/doctype/lms_course_enrollment/lms_course_enrollment.json b/lms/lms/doctype/lms_course_enrollment/lms_course_enrollment.json deleted file mode 100644 index 71e15f73..00000000 --- a/lms/lms/doctype/lms_course_enrollment/lms_course_enrollment.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "actions": [], - "creation": "2021-03-03 11:24:08.220185", - "doctype": "DocType", - "editable_grid": 1, - "engine": "InnoDB", - "field_order": [ - "course", - "user" - ], - "fields": [ - { - "fieldname": "course", - "fieldtype": "Link", - "label": "Course", - "options": "LMS Course" - }, - { - "fieldname": "user", - "fieldtype": "Data", - "label": "User", - "options": "Email" - } - ], - "index_web_pages_for_search": 1, - "links": [], - "modified": "2021-03-05 12:59:22.973826", - "modified_by": "Administrator", - "module": "LMS", - "name": "LMS Course Enrollment", - "owner": "Administrator", - "permissions": [ - { - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "print": 1, - "read": 1, - "report": 1, - "role": "System Manager", - "share": 1, - "write": 1 - }, - { - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "print": 1, - "read": 1, - "report": 1, - "role": "Student", - "share": 1, - "write": 1 - } - ], - "sort_field": "modified", - "sort_order": "DESC", - "track_changes": 1 -} \ No newline at end of file diff --git a/lms/lms/doctype/lms_course_enrollment/lms_course_enrollment.py b/lms/lms/doctype/lms_course_enrollment/lms_course_enrollment.py deleted file mode 100644 index ffe29ea2..00000000 --- a/lms/lms/doctype/lms_course_enrollment/lms_course_enrollment.py +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2021, FOSS United and contributors -# For license information, please see license.txt - -# import frappe -from frappe.model.document import Document - - -class LMSCourseEnrollment(Document): - pass diff --git a/lms/lms/doctype/lms_course_enrollment/test_lms_course_enrollment.py b/lms/lms/doctype/lms_course_enrollment/test_lms_course_enrollment.py deleted file mode 100644 index b52ed9ca..00000000 --- a/lms/lms/doctype/lms_course_enrollment/test_lms_course_enrollment.py +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2021, FOSS United and Contributors -# See license.txt - -# import frappe -import unittest - - -class TestLMSCourseEnrollment(unittest.TestCase): - pass diff --git a/lms/lms/doctype/lms_settings/lms_settings.json b/lms/lms/doctype/lms_settings/lms_settings.json index b178e61f..3a2a3ac6 100644 --- a/lms/lms/doctype/lms_settings/lms_settings.json +++ b/lms/lms/doctype/lms_settings/lms_settings.json @@ -7,6 +7,7 @@ "field_order": [ "search_placeholder", "portal_course_creation", + "is_onboarding_complete", "column_break_2", "custom_certificate_template", "livecode_url", @@ -137,12 +138,19 @@ "fieldtype": "Link", "label": "Custom Certificate Template", "options": "Web Template" + }, + { + "default": "0", + "fieldname": "is_onboarding_complete", + "fieldtype": "Check", + "label": "Is Onboarding Complete", + "read_only": 1 } ], "index_web_pages_for_search": 1, "issingle": 1, "links": [], - "modified": "2022-12-15 10:23:08.638117", + "modified": "2022-12-20 11:44:06.317159", "modified_by": "Administrator", "module": "LMS", "name": "LMS Settings", diff --git a/lms/lms/md.py b/lms/lms/md.py index e7830722..1a6b9ed7 100644 --- a/lms/lms/md.py +++ b/lms/lms/md.py @@ -114,7 +114,7 @@ def sanitize_html(html, macro): any broken tags. This makes sures that all those things are fixed before passing to the etree parser. """ - soup = BeautifulSoup(html, features="html5lib") + soup = BeautifulSoup(html, features="lxml") nodes = soup.body.children classname = "" if macro == "YouTubeVideo": diff --git a/lms/lms/doctype/lms_course_enrollment/__init__.py b/lms/lms/page/__init__.py similarity index 100% rename from lms/lms/doctype/lms_course_enrollment/__init__.py rename to lms/lms/page/__init__.py diff --git a/lms/lms/page/lms_home/__init__.py b/lms/lms/page/lms_home/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/lms/lms/page/lms_home/lms_home.js b/lms/lms/page/lms_home/lms_home.js new file mode 100644 index 00000000..4521b64d --- /dev/null +++ b/lms/lms/page/lms_home/lms_home.js @@ -0,0 +1,3 @@ +frappe.pages["lms-home"].on_page_load = function (wrapper) { + window.location.href = "/courses"; +}; diff --git a/lms/lms/page/lms_home/lms_home.json b/lms/lms/page/lms_home/lms_home.json new file mode 100644 index 00000000..f38e3502 --- /dev/null +++ b/lms/lms/page/lms_home/lms_home.json @@ -0,0 +1,19 @@ +{ + "content": null, + "creation": "2022-12-15 13:45:06.602567", + "docstatus": 0, + "doctype": "Page", + "idx": 0, + "modified": "2022-12-15 13:45:06.602567", + "modified_by": "Administrator", + "module": "LMS", + "name": "lms-home", + "owner": "Administrator", + "page_name": "lms-home", + "roles": [], + "script": null, + "standard": "Yes", + "style": null, + "system_page": 1, + "title": "LMS" +} \ No newline at end of file diff --git a/lms/lms/web_template/course_cards/course_cards.html b/lms/lms/web_template/course_cards/course_cards.html index 7d8dc4f1..16aa2b8f 100644 --- a/lms/lms/web_template/course_cards/course_cards.html +++ b/lms/lms/web_template/course_cards/course_cards.html @@ -1,5 +1,4 @@
{{ _(subtitle) }}
diff --git a/lms/overrides/user.py b/lms/overrides/user.py index 6e5051c5..72dbd5ab 100644 --- a/lms/overrides/user.py +++ b/lms/overrides/user.py @@ -8,7 +8,6 @@ from frappe import _ from frappe.core.doctype.user.user import User from frappe.utils import cint, escape_html, random_string from frappe.website.utils import is_signup_disabled - from lms.lms.utils import validate_image from lms.widgets import Widgets @@ -295,6 +294,14 @@ def get_country_code(): return +def on_login(login_manager): + set_country_from_ip() + + +def on_session_creation(login_manager): + frappe.local.response["home_page"] = "/courses" + + @frappe.whitelist(allow_guest=True) def search_users(start=0, text=""): or_filters = get_or_filters(text) diff --git a/lms/patches.txt b/lms/patches.txt index 2f4e6bbc..275ee47a 100644 --- a/lms/patches.txt +++ b/lms/patches.txt @@ -42,3 +42,4 @@ lms.patches.v0_0.quiz_submission_result lms.patches.v0_0.skill_to_user_skill lms.patches.v0_0.rename_instructor_role lms.patches.v0_0.change_course_creation_settings #12-12-2022 +lms.patches.v0_0.check_onboarding_status #21-12-2022 diff --git a/lms/patches/v0_0/check_onboarding_status.py b/lms/patches/v0_0/check_onboarding_status.py new file mode 100644 index 00000000..c1686819 --- /dev/null +++ b/lms/patches/v0_0/check_onboarding_status.py @@ -0,0 +1,11 @@ +import frappe + + +def execute(): + if ( + frappe.db.count("LMS Course") + and frappe.db.count("Course Chapter") + and frappe.db.count("Course Lesson") + and frappe.db.count("LMS Quiz") + ): + frappe.db.set_value("LMS Settings", None, "is_onboarding_complete", True) diff --git a/lms/public/css/style.css b/lms/public/css/style.css index 6445ae04..1f9ea4ac 100644 --- a/lms/public/css/style.css +++ b/lms/public/css/style.css @@ -130,6 +130,10 @@ input[type=checkbox] { stroke: none; } +.onboarding-parent .icon { + stroke: none; +} + .course-card-content { padding: 1rem; display: flex; @@ -1883,3 +1887,34 @@ select { .clickable-row { cursor: pointer; } + +.onboarding-parent { + background-color: var(--primary-light); + padding: 2rem 0; +} + +.onboarding-steps { + display: flex; + justify-content: space-between; + padding-top: 1.5rem; + font-weight: 500; + color: var(--gray-900); +} + +.onboarding-steps-link { + display: flex; + align-items: center; + color: inherit; +} + +.onboarding-steps-link:hover { + text-decoration: none; + color: inherit; +} + +.onboarding-skip { + font-size: var(--text-sm); + float: right; + cursor: pointer; + margin-right: 1rem; +} diff --git a/lms/public/icons/symbol-defs.svg b/lms/public/icons/symbol-defs.svg index 17af9ab2..4e249cdf 100644 --- a/lms/public/icons/symbol-defs.svg +++ b/lms/public/icons/symbol-defs.svg @@ -64,4 +64,12 @@