diff --git a/lms/lms/web_form/chapter/__init__.py b/lms/lms/web_form/chapter/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/lms/lms/web_form/chapter/chapter.js b/lms/lms/web_form/chapter/chapter.js deleted file mode 100644 index da98bb5e..00000000 --- a/lms/lms/web_form/chapter/chapter.js +++ /dev/null @@ -1,11 +0,0 @@ -frappe.ready(function() { - frappe.web_form.after_save = () => { - frappe.show_alert({ - message:__("Chapter has been saved successfully. Go back to the course and add this chapter to the chapters table."), - indicator:'green' - }, 3); - setTimeout(() => { - window.location.href = `/courses/${frappe.web_form.doc.course}`; - }, 3000); - } -}); diff --git a/lms/lms/web_form/chapter/chapter.json b/lms/lms/web_form/chapter/chapter.json deleted file mode 100644 index fc2b8afc..00000000 --- a/lms/lms/web_form/chapter/chapter.json +++ /dev/null @@ -1,89 +0,0 @@ -{ - "accept_payment": 0, - "allow_comments": 0, - "allow_delete": 0, - "allow_edit": 1, - "allow_incomplete": 0, - "allow_multiple": 1, - "allow_print": 0, - "amount": 0.0, - "amount_based_on_field": 0, - "apply_document_permissions": 1, - "button_label": "Save", - "creation": "2022-03-07 18:41:07.058806", - "doc_type": "Course Chapter", - "docstatus": 0, - "doctype": "Web Form", - "idx": 0, - "is_multi_step_form": 0, - "is_standard": 1, - "login_required": 1, - "max_attachment_size": 0, - "modified": "2022-03-14 18:48:01.704325", - "modified_by": "Administrator", - "module": "LMS", - "name": "chapter", - "owner": "Administrator", - "payment_button_label": "Buy Now", - "published": 1, - "route": "chapter", - "route_to_success_link": 0, - "show_attachments": 0, - "show_in_grid": 0, - "show_sidebar": 0, - "sidebar_items": [], - "success_url": "/chapter", - "title": "Chapter", - "web_form_fields": [ - { - "allow_read_on_all_link_options": 0, - "fieldname": "course", - "fieldtype": "Link", - "hidden": 0, - "label": "Course", - "max_length": 0, - "max_value": 0, - "options": "LMS Course", - "read_only": 0, - "reqd": 1, - "show_in_filter": 0 - }, - { - "allow_read_on_all_link_options": 0, - "fieldname": "title", - "fieldtype": "Data", - "hidden": 0, - "label": "Title", - "max_length": 0, - "max_value": 0, - "read_only": 0, - "reqd": 1, - "show_in_filter": 0 - }, - { - "allow_read_on_all_link_options": 0, - "fieldname": "description", - "fieldtype": "Small Text", - "hidden": 0, - "label": "Description", - "max_length": 0, - "max_value": 0, - "read_only": 0, - "reqd": 0, - "show_in_filter": 0 - }, - { - "allow_read_on_all_link_options": 0, - "fieldname": "lessons", - "fieldtype": "Table", - "hidden": 0, - "label": "Lessons", - "max_length": 0, - "max_value": 0, - "options": "Lesson Reference", - "read_only": 0, - "reqd": 0, - "show_in_filter": 0 - } - ] -} \ No newline at end of file diff --git a/lms/lms/web_form/chapter/chapter.py b/lms/lms/web_form/chapter/chapter.py deleted file mode 100644 index e1ada619..00000000 --- a/lms/lms/web_form/chapter/chapter.py +++ /dev/null @@ -1,5 +0,0 @@ -import frappe - -def get_context(context): - # do your magic here - pass diff --git a/lms/lms/web_form/course/__init__.py b/lms/lms/web_form/course/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/lms/lms/web_form/course/course.js b/lms/lms/web_form/course/course.js deleted file mode 100644 index ff539e0a..00000000 --- a/lms/lms/web_form/course/course.js +++ /dev/null @@ -1,6 +0,0 @@ -frappe.ready(function() { - frappe.web_form.after_save = () => { - let route = frappe.web_form.doc.name ? `/courses/${frappe.web_form.doc.name}` : `/course`; - window.location.href = route; - } -}); diff --git a/lms/lms/web_form/course/course.json b/lms/lms/web_form/course/course.json deleted file mode 100644 index f12d692e..00000000 --- a/lms/lms/web_form/course/course.json +++ /dev/null @@ -1,147 +0,0 @@ -{ - "accept_payment": 0, - "allow_comments": 0, - "allow_delete": 0, - "allow_edit": 1, - "allow_incomplete": 0, - "allow_multiple": 1, - "allow_print": 0, - "amount": 0.0, - "amount_based_on_field": 0, - "apply_document_permissions": 1, - "button_label": "Save", - "creation": "2022-03-07 14:40:41.262163", - "custom_css": "", - "doc_type": "LMS Course", - "docstatus": 0, - "doctype": "Web Form", - "idx": 0, - "is_multi_step_form": 0, - "is_standard": 1, - "login_required": 1, - "max_attachment_size": 0, - "modified": "2022-03-11 12:32:22.512115", - "modified_by": "Administrator", - "module": "LMS", - "name": "course", - "owner": "Administrator", - "payment_button_label": "Buy Now", - "published": 1, - "route": "course", - "route_to_success_link": 0, - "show_attachments": 0, - "show_in_grid": 0, - "show_sidebar": 0, - "sidebar_items": [], - "success_url": "/course", - "title": "Course", - "web_form_fields": [ - { - "allow_read_on_all_link_options": 0, - "fieldname": "title", - "fieldtype": "Data", - "hidden": 0, - "label": "Title", - "max_length": 0, - "max_value": 0, - "read_only": 0, - "reqd": 1, - "show_in_filter": 0 - }, - { - "allow_read_on_all_link_options": 0, - "fieldname": "tags", - "fieldtype": "Data", - "hidden": 0, - "label": "Tags", - "max_length": 0, - "max_value": 0, - "read_only": 0, - "reqd": 0, - "show_in_filter": 0 - }, - { - "allow_read_on_all_link_options": 0, - "fieldname": "", - "fieldtype": "Column Break", - "hidden": 0, - "max_length": 0, - "max_value": 0, - "read_only": 0, - "reqd": 0, - "show_in_filter": 0 - }, - { - "allow_read_on_all_link_options": 0, - "fieldname": "video_link", - "fieldtype": "Data", - "hidden": 0, - "label": "Video Embed Link", - "max_length": 0, - "max_value": 0, - "read_only": 0, - "reqd": 0, - "show_in_filter": 0 - }, - { - "allow_read_on_all_link_options": 0, - "fieldname": "image", - "fieldtype": "Attach Image", - "hidden": 0, - "label": "Preview Image", - "max_length": 0, - "max_value": 0, - "read_only": 0, - "reqd": 0, - "show_in_filter": 0 - }, - { - "allow_read_on_all_link_options": 0, - "fieldname": "", - "fieldtype": "Section Break", - "hidden": 0, - "max_length": 0, - "max_value": 0, - "read_only": 0, - "reqd": 0, - "show_in_filter": 0 - }, - { - "allow_read_on_all_link_options": 0, - "fieldname": "short_introduction", - "fieldtype": "Small Text", - "hidden": 0, - "label": "Short Introduction", - "max_length": 0, - "max_value": 0, - "read_only": 0, - "reqd": 1, - "show_in_filter": 0 - }, - { - "allow_read_on_all_link_options": 0, - "fieldname": "description", - "fieldtype": "Text", - "hidden": 0, - "label": "Description", - "max_length": 0, - "max_value": 0, - "read_only": 0, - "reqd": 1, - "show_in_filter": 0 - }, - { - "allow_read_on_all_link_options": 0, - "fieldname": "chapters", - "fieldtype": "Table", - "hidden": 0, - "label": "Chapters", - "max_length": 0, - "max_value": 0, - "options": "Chapter Reference", - "read_only": 0, - "reqd": 0, - "show_in_filter": 0 - } - ] -} \ No newline at end of file diff --git a/lms/lms/web_form/course/course.py b/lms/lms/web_form/course/course.py deleted file mode 100644 index e1ada619..00000000 --- a/lms/lms/web_form/course/course.py +++ /dev/null @@ -1,5 +0,0 @@ -import frappe - -def get_context(context): - # do your magic here - pass diff --git a/lms/lms/web_form/lesson/__init__.py b/lms/lms/web_form/lesson/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/lms/lms/web_form/lesson/lesson.js b/lms/lms/web_form/lesson/lesson.js deleted file mode 100644 index 82214a05..00000000 --- a/lms/lms/web_form/lesson/lesson.js +++ /dev/null @@ -1,97 +0,0 @@ -frappe.ready(function() { - - frappe.web_form.after_load = () => { - add_file_upload_component(); - fetch_course(); - }; - - frappe.web_form.after_save = () => { - show_success_message(); - }; - - $(document).on("click", ".add-attachment", (e) => { - show_upload_modal(); - }); - - $(document).on("click", ".copy-link", (e) => { - frappe.utils.copy_to_clipboard($(e.currentTarget).data("link")); - $(".attachments").collapse("hide"); - }); - -}); - -const fetch_course = () => { - frappe.call({ - method: "lms.lms.doctype.course_lesson.course_lesson.get_lesson_info", - args: { - "chapter": frappe.web_form.doc.chapter - }, - callback: (data) => { - this.course = data.message; - } - }); -} - -const show_upload_modal = () => { - new frappe.ui.FileUploader({ - folder: "Home/Attachments", - restrictions: { - allowed_file_types: ['image/*'] - }, - on_success: (file_doc) => { - $(".attachments").append(build_attachment_table(file_doc)); - let count = $(".attachment-count").data("count") + 1; - $(".attachment-count").data("count", count); - $(".attachment-count").html(__(`${count} attachments`)); - $(".attachments").removeClass("hide"); - }, - }); -}; - -const show_success_message = () => { - frappe.show_alert({ - message: __(`Lesson has been saved successfully. Go back to the chapter and add this lesson to the lessons table.`), - indicator:'green' - }, 3); - setTimeout(() => { - window.location.href = `/courses/${this.course}`; - }, 3000); -}; - -const add_file_upload_component = () => { - $(get_attachment_controls_html()).insertBefore($(`[data-fieldname="include_in_preview"]`).first()); -}; - -const get_attachment_controls_html = () => { - return ` -
- `; -}; - -const build_attachment_table = (file_doc) => { - return $(` -Create lessons for your course. For adding content, use markdown syntax. You can add some additional content to the lesson using a special syntax. The table below mentions all types of dynamic content that you can add to the lessons and the syntax for the same.
\n| \n Content Type\n | \n\n Syntax \n | \n
| Assignment | \n{{ Assignment(\"id-filetype\") }} | \n
| Quiz | \n{{ Quiz(\"lms_quiz_name\") }} | \n
| YouTube Video | \n{{ YouTubeVideo(\"unique_embed_id\") }} | \n
Note: You can also attach videos from Vimeo by including the iframe embed of the video to the lesson.
\n