feat: course creation from ui

This commit is contained in:
Jannat Patel
2022-03-09 12:29:03 +05:30
parent 913e87c4f5
commit 8f9cd72975
16 changed files with 300 additions and 16 deletions
+3
View File
@@ -0,0 +1,3 @@
frappe.ready(function() {
// bind events here
})
+89
View File
@@ -0,0 +1,89 @@
{
"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": 0,
"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-07 18:41:07.058806",
"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
}
]
}
+5
View File
@@ -0,0 +1,5 @@
import frappe
def get_context(context):
# do your magic here
pass
+6 -2
View File
@@ -1,3 +1,7 @@
frappe.ready(function() {
// bind events here
})
frappe.web_form.after_save = () => {
setTimeout(() => {
window.location.href = `/courses/${frappe.web_form.doc.name}`;
})
}
});
+26 -4
View File
@@ -20,7 +20,7 @@
"is_standard": 1,
"login_required": 1,
"max_attachment_size": 0,
"modified": "2022-03-07 14:48:04.889844",
"modified": "2022-03-09 10:10:30.069458",
"modified_by": "Administrator",
"module": "LMS",
"name": "course",
@@ -48,6 +48,29 @@
"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",
@@ -74,10 +97,9 @@
},
{
"allow_read_on_all_link_options": 0,
"fieldname": "tags",
"fieldtype": "Data",
"fieldname": "",
"fieldtype": "Section Break",
"hidden": 0,
"label": "Tags",
"max_length": 0,
"max_value": 0,
"read_only": 0,
+17
View File
@@ -0,0 +1,17 @@
frappe.ready(function() {
frappe.web_form.after_save = () => {
setTimeout(() => {
frappe.call({
method: "school.lms.doctype.course_lesson.course_lesson.get_lesson_info",
args: {
"lesson_name": frappe.web_form.doc.name
},
callback: (data) => {
window.location.href = data.message;
}
});
});
};
});
+91
View File
@@ -0,0 +1,91 @@
{
"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:42.549831",
"custom_css": "",
"doc_type": "Course Lesson",
"docstatus": 0,
"doctype": "Web Form",
"idx": 0,
"introduction_text": "<div class=\"ql-editor read-mode\"><p><br></p><p><br></p><p>Create lessons for your course. 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.</p><p><br></p><table class=\"table table-bordered\"><tbody><tr><td data-row=\"row-wxk1\"><strong>Content Type</strong></td><td data-row=\"row-wxk1\"><strong>Syntax</strong></td></tr><tr><td data-row=\"row-lawj\">Video</td><td data-row=\"row-lawj\">{{ Video(\"url_of_source\") }}</td></tr><tr><td data-row=\"insert-table\">YouTube Video</td><td data-row=\"insert-table\">{{ YouTubeVideo(\"unique_embed_id\") }}</td></tr><tr><td data-row=\"insert-row-below\">Exercise</td><td data-row=\"insert-row-below\">{{ Exercise(\"exercise_name\") }}</td></tr><tr><td data-row=\"row-3b6n\">Quiz</td><td data-row=\"row-3b6n\">{{ Quiz(\"lms_quiz_name\") }}</td></tr><tr><td data-row=\"row-r57s\">Assignment</td><td data-row=\"row-r57s\">{{ Assignment(\"id-filetype\") }}</td></tr></tbody></table></div>",
"is_multi_step_form": 0,
"is_standard": 1,
"login_required": 1,
"max_attachment_size": 0,
"modified": "2022-03-09 09:55:58.406164",
"modified_by": "Administrator",
"module": "LMS",
"name": "lesson",
"owner": "Administrator",
"payment_button_label": "Buy Now",
"published": 1,
"route": "lesson",
"route_to_success_link": 0,
"show_attachments": 0,
"show_in_grid": 0,
"show_sidebar": 0,
"sidebar_items": [],
"success_url": "/lesson",
"title": "Lesson",
"web_form_fields": [
{
"allow_read_on_all_link_options": 1,
"fieldname": "chapter",
"fieldtype": "Link",
"hidden": 0,
"label": "Course Chapter",
"max_length": 0,
"max_value": 0,
"options": "Course Chapter",
"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,
"default": "0",
"fieldname": "include_in_preview",
"fieldtype": "Check",
"hidden": 0,
"label": "Include In Preview",
"max_length": 0,
"max_value": 0,
"read_only": 0,
"reqd": 0,
"show_in_filter": 0
},
{
"allow_read_on_all_link_options": 0,
"fieldname": "body",
"fieldtype": "Data",
"hidden": 0,
"label": "Body",
"max_length": 0,
"max_value": 0,
"read_only": 0,
"reqd": 1,
"show_in_filter": 0
}
]
}
+5
View File
@@ -0,0 +1,5 @@
import frappe
def get_context(context):
# do your magic here
pass