From ad084389cc8e89d7cb3a796174178cb22bf3f064 Mon Sep 17 00:00:00 2001 From: Jannat Patel Date: Thu, 29 Dec 2022 11:31:52 +0530 Subject: [PATCH 1/2] fix: minor issues --- .../doctype/course_lesson/course_lesson.json | 6 +-- lms/lms/md.py | 2 +- lms/lms/workspace/lms/lms.json | 51 ++++++++++++++----- lms/patches.txt | 1 + lms/patches/v0_0/assignment_file_type.py | 10 ++++ lms/public/css/style.css | 5 +- lms/templates/search_course/search_course.js | 6 +++ lms/www/batch/learn.html | 2 - lms/www/batch/learn.js | 9 +--- lms/www/batch/quiz_list.html | 2 +- lms/www/courses/course.html | 2 +- 11 files changed, 65 insertions(+), 31 deletions(-) create mode 100644 lms/patches/v0_0/assignment_file_type.py diff --git a/lms/lms/doctype/course_lesson/course_lesson.json b/lms/lms/doctype/course_lesson/course_lesson.json index ac1ef99c..d1e19c44 100644 --- a/lms/lms/doctype/course_lesson/course_lesson.json +++ b/lms/lms/doctype/course_lesson/course_lesson.json @@ -126,7 +126,7 @@ "fieldtype": "Select", "label": "File Type", "mandatory_depends_on": "question", - "options": "Image\nDocument\nPDF" + "options": "\nImage\nDocument\nPDF" }, { "fieldname": "column_break_15", @@ -135,7 +135,7 @@ ], "index_web_pages_for_search": 1, "links": [], - "modified": "2022-10-28 12:36:01.978641", + "modified": "2022-12-28 16:01:42.191123", "modified_by": "Administrator", "module": "LMS", "name": "Course Lesson", @@ -173,4 +173,4 @@ "sort_order": "DESC", "states": [], "track_changes": 1 -} +} \ No newline at end of file diff --git a/lms/lms/md.py b/lms/lms/md.py index 1a6b9ed7..e7830722 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="lxml") + soup = BeautifulSoup(html, features="html5lib") nodes = soup.body.children classname = "" if macro == "YouTubeVideo": diff --git a/lms/lms/workspace/lms/lms.json b/lms/lms/workspace/lms/lms.json index 02924879..044a77d5 100644 --- a/lms/lms/workspace/lms/lms.json +++ b/lms/lms/workspace/lms/lms.json @@ -9,7 +9,7 @@ "label": "Enrollments" } ], - "content": "[{\"type\":\"header\",\"data\":{\"text\":\"Get Started\",\"col\":12}},{\"type\":\"paragraph\",\"data\":{\"text\":\"Visit LMS Portal\",\"col\":4}},{\"type\":\"paragraph\",\"data\":{\"text\":\"Create a Course\",\"col\":4}},{\"type\":\"paragraph\",\"data\":{\"text\":\"Setup a Home Page\",\"col\":4}},{\"type\":\"paragraph\",\"data\":{\"text\":\"Website Settings\",\"col\":4}},{\"type\":\"paragraph\",\"data\":{\"text\":\"Documentation\",\"col\":4}},{\"type\":\"paragraph\",\"data\":{\"text\":\"Video Tutorials\",\"col\":4}},{\"type\":\"spacer\",\"data\":{\"col\":12}},{\"type\":\"chart\",\"data\":{\"chart_name\":\"Signups\",\"col\":6}},{\"type\":\"chart\",\"data\":{\"chart_name\":\"Enrollments\",\"col\":6}},{\"type\":\"spacer\",\"data\":{\"col\":12}},{\"type\":\"header\",\"data\":{\"text\":\"Statistics\",\"col\":12}},{\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Course\",\"col\":4}},{\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Course Enrollments\",\"col\":4}},{\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Course Completed\",\"col\":4}},{\"type\":\"spacer\",\"data\":{\"col\":12}},{\"type\":\"header\",\"data\":{\"text\":\"Master\",\"col\":12}},{\"type\":\"card\",\"data\":{\"card_name\":\"Course Data\",\"col\":4}},{\"type\":\"card\",\"data\":{\"card_name\":\"Course Stats\",\"col\":4}},{\"type\":\"card\",\"data\":{\"card_name\":\"Certification\",\"col\":4}}]", + "content": "[{\"type\":\"header\",\"data\":{\"text\":\"Get Started\",\"col\":12}},{\"type\":\"paragraph\",\"data\":{\"text\":\"Visit LMS Portal\",\"col\":4}},{\"type\":\"paragraph\",\"data\":{\"text\":\"Create a Course\",\"col\":4}},{\"type\":\"paragraph\",\"data\":{\"text\":\"Setup a Home Page\",\"col\":4}},{\"type\":\"paragraph\",\"data\":{\"text\":\"Website Settings\",\"col\":4}},{\"type\":\"paragraph\",\"data\":{\"text\":\"Documentation\",\"col\":4}},{\"type\":\"paragraph\",\"data\":{\"text\":\"Video Tutorials\",\"col\":4}},{\"type\":\"spacer\",\"data\":{\"col\":12}},{\"type\":\"chart\",\"data\":{\"chart_name\":\"Signups\",\"col\":6}},{\"type\":\"chart\",\"data\":{\"chart_name\":\"Enrollments\",\"col\":6}},{\"type\":\"spacer\",\"data\":{\"col\":12}},{\"type\":\"header\",\"data\":{\"text\":\"Statistics\",\"col\":12}},{\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Users\",\"col\":4}},{\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Course\",\"col\":4}},{\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Enrollments\",\"col\":4}},{\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Course Completed\",\"col\":4}},{\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Certificate\",\"col\":4}},{\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Evaluation\",\"col\":4}},{\"type\":\"spacer\",\"data\":{\"col\":12}},{\"type\":\"header\",\"data\":{\"text\":\"Master\",\"col\":12}},{\"type\":\"card\",\"data\":{\"card_name\":\"Course Data\",\"col\":4}},{\"type\":\"card\",\"data\":{\"card_name\":\"Course Stats\",\"col\":4}},{\"type\":\"card\",\"data\":{\"card_name\":\"Certification\",\"col\":4}}]", "creation": "2021-10-21 17:20:01.358903", "docstatus": 0, "doctype": "Workspace", @@ -143,7 +143,7 @@ "type": "Link" } ], - "modified": "2022-11-09 17:16:03.973258", + "modified": "2022-12-28 17:45:18.539185", "modified_by": "Administrator", "module": "LMS", "name": "LMS", @@ -155,16 +155,16 @@ "sequence_id": 1.0, "shortcuts": [ { - "color": "Green", + "color": "Yellow", "doc_view": "List", - "format": "{} Published", - "label": "Course", - "link_to": "LMS Course", - "stats_filter": "{\"published\":[\"=\",1]}", + "format": "{} Enrolled", + "label": "Enrollments", + "link_to": "LMS Batch Membership", + "stats_filter": "{\"member_type\":[\"=\",\"Student\"]}", "type": "DocType" }, { - "color": "Orange", + "color": "Blue", "doc_view": "List", "format": "{} Completed", "label": "Course Completed", @@ -172,13 +172,40 @@ "stats_filter": "{\"progress\":[\"like\",\"%100%\"]}", "type": "DocType" }, + { + "color": "Cyan", + "doc_view": "List", + "format": "{} Passed", + "label": "Evaluation", + "link_to": "LMS Certificate Evaluation", + "stats_filter": "{\"status\":[\"=\",\"Pass\"]}", + "type": "DocType" + }, + { + "color": "Red", + "doc_view": "List", + "format": "{} Active", + "label": "Users", + "link_to": "User", + "stats_filter": "{\"enabled\":[\"=\",1]}", + "type": "DocType" + }, + { + "color": "Pink", + "doc_view": "List", + "format": "{} Granted", + "label": "Certificate", + "link_to": "LMS Certificate", + "stats_filter": "{\"name\":[\"is\",\"set\"]}", + "type": "DocType" + }, { "color": "Green", "doc_view": "List", - "format": "{} Enrolled", - "label": "Course Enrollments", - "link_to": "LMS Batch Membership", - "stats_filter": "{\"member_type\":[\"=\",\"Student\"]}", + "format": "{} Published", + "label": "Course", + "link_to": "LMS Course", + "stats_filter": "{\"published\":[\"=\",1]}", "type": "DocType" } ], diff --git a/lms/patches.txt b/lms/patches.txt index 275ee47a..ff4db784 100644 --- a/lms/patches.txt +++ b/lms/patches.txt @@ -43,3 +43,4 @@ 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 +lms.patches.v0_0.assignment_file_type diff --git a/lms/patches/v0_0/assignment_file_type.py b/lms/patches/v0_0/assignment_file_type.py new file mode 100644 index 00000000..1acd24eb --- /dev/null +++ b/lms/patches/v0_0/assignment_file_type.py @@ -0,0 +1,10 @@ +import frappe + +def execute(): + assignment_lessons = frappe.get_all("Course Lesson", { + "file_type": ["is", "set"] + }, ["name", "question"]) + + for lesson in assignment_lessons: + if not lesson.question: + frappe.db.set_value("Course Lesson", lesson.name, "file_type", "") diff --git a/lms/public/css/style.css b/lms/public/css/style.css index 2392a81b..5448cd2c 100644 --- a/lms/public/css/style.css +++ b/lms/public/css/style.css @@ -948,6 +948,7 @@ pre { font-size: var(--text-base); padding: 1.5rem; width: 100%; + box-shadow: none; } .search:focus { @@ -1472,10 +1473,6 @@ pre { border-spacing: 1rem 0.5rem; } -.attachments-parent { - color: var(--text-color); -} - li { line-height: 1.7; } diff --git a/lms/templates/search_course/search_course.js b/lms/templates/search_course/search_course.js index 9d2580fa..6aacfed4 100644 --- a/lms/templates/search_course/search_course.js +++ b/lms/templates/search_course/search_course.js @@ -10,6 +10,12 @@ frappe.ready(() => { $("#search-modal").on("hidden.bs.modal", () => { hide_search_bar(); }); + + $(document).keydown(function(e) { + if ((e.metaKey || e.ctrlKey) && e.key == "k") { + show_search_bar(e); + } + }); }); const search_course = (e) => { diff --git a/lms/www/batch/learn.html b/lms/www/batch/learn.html index 19cd430d..373ae966 100644 --- a/lms/www/batch/learn.html +++ b/lms/www/batch/learn.html @@ -191,8 +191,6 @@ - -