fix: removed web forms of old course creation flow
This commit is contained in:
@@ -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);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
@@ -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
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
import frappe
|
|
||||||
|
|
||||||
def get_context(context):
|
|
||||||
# do your magic here
|
|
||||||
pass
|
|
||||||
@@ -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;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
@@ -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
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
import frappe
|
|
||||||
|
|
||||||
def get_context(context):
|
|
||||||
# do your magic here
|
|
||||||
pass
|
|
||||||
@@ -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 `
|
|
||||||
<div class="attachments-parent">
|
|
||||||
<div class="attachment-controls">
|
|
||||||
<div class="show-attachments" data-toggle="collapse" data-target="#collapse-attachments" aria-expanded="false">
|
|
||||||
<svg class="icon icon-sm">
|
|
||||||
<use class="" href="#icon-attachment">
|
|
||||||
</svg>
|
|
||||||
<span class="attachment-count" data-count="0">0 {{ _("attachments") }}</span>
|
|
||||||
</div>
|
|
||||||
<div class="add-attachment">
|
|
||||||
<span class="button is-secondary">
|
|
||||||
<svg class="icon icon-sm">
|
|
||||||
<use class="" href="#icon-upload">
|
|
||||||
</svg>
|
|
||||||
{{ _("Upload Attachments") }}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<table class="attachments common-card-style collapse hide" id="collapse-attachments"></table>
|
|
||||||
</div>
|
|
||||||
`;
|
|
||||||
};
|
|
||||||
|
|
||||||
const build_attachment_table = (file_doc) => {
|
|
||||||
return $(`
|
|
||||||
<tr class="attachment-row">
|
|
||||||
<td>${file_doc.file_name}</td>
|
|
||||||
<td class=""><a class="button is-secondary button-links copy-link" data-link=""
|
|
||||||
data-name="${file_doc.file_name}" > {{ _("Copy Link") }} </a></td>
|
|
||||||
</tr>
|
|
||||||
`);
|
|
||||||
};
|
|
||||||
@@ -1,91 +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:42.549831",
|
|
||||||
"custom_css": "#introduction {\n font-size: var(--text-base);\n}",
|
|
||||||
"doc_type": "Course Lesson",
|
|
||||||
"docstatus": 0,
|
|
||||||
"doctype": "Web Form",
|
|
||||||
"idx": 0,
|
|
||||||
"introduction_text": "<div class=\"ql-editor read-mode\">\n <p>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.</p>\n <table class=\"table table-bordered\">\n <tbody>\n <tr>\n <td data-row=\"row-wxk1\">\n <strong>Content Type</strong>\n </td>\n <td data-row=\"row-wxk1\">\n <strong> Syntax </strong>\n </td>\n </tr>\n <tr>\n <td data-row=\"row-r57s\"> Assignment </td>\n <td data-row=\"row-r57s\">{{ Assignment(\"id-filetype\") }}</td>\n </tr>\n <tr>\n <td data-row=\"row-3b6n\"> Quiz </td>\n <td data-row=\"row-3b6n\">{{ Quiz(\"lms_quiz_name\") }}</td>\n </tr>\n <tr>\n <td data-row=\"insert-table\"> YouTube Video </td>\n <td data-row=\"insert-table\">{{ YouTubeVideo(\"unique_embed_id\") }}</td>\n </tr>\n </tbody>\n </table>\n <p> <b> Note: </b> You can also attach videos from Vimeo by including the iframe embed of the video to the lesson. </p>\n</div>",
|
|
||||||
"is_multi_step_form": 0,
|
|
||||||
"is_standard": 1,
|
|
||||||
"login_required": 1,
|
|
||||||
"max_attachment_size": 0,
|
|
||||||
"modified": "2022-04-25 10:26:12.691050",
|
|
||||||
"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": "",
|
|
||||||
"title": "Lesson",
|
|
||||||
"web_form_fields": [
|
|
||||||
{
|
|
||||||
"allow_read_on_all_link_options": 0,
|
|
||||||
"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": "Text",
|
|
||||||
"hidden": 0,
|
|
||||||
"label": "Content",
|
|
||||||
"max_length": 0,
|
|
||||||
"max_value": 0,
|
|
||||||
"read_only": 0,
|
|
||||||
"reqd": 1,
|
|
||||||
"show_in_filter": 0
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
import frappe
|
|
||||||
|
|
||||||
def get_context(context):
|
|
||||||
# do your magic here
|
|
||||||
pass
|
|
||||||
@@ -29,5 +29,5 @@ execute:frappe.delete_doc("Workspace", "School", ignore_missing=True, force=True
|
|||||||
lms.patches.v0_0.move_certification_to_certificate
|
lms.patches.v0_0.move_certification_to_certificate
|
||||||
lms.patches.v0_0.quiz_submission_member
|
lms.patches.v0_0.quiz_submission_member
|
||||||
lms.patches.v0_0.delete_old_module_docs #08-07-2022
|
lms.patches.v0_0.delete_old_module_docs #08-07-2022
|
||||||
lms.patches.v0_0.delete_course_web_forms
|
lms.patches.v0_0.delete_course_web_forms #21-08-2022
|
||||||
lms.patches.v0_0.create_course_instructor_role
|
lms.patches.v0_0.create_course_instructor_role
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import frappe
|
import frappe
|
||||||
|
|
||||||
def execute():
|
def execute():
|
||||||
frappe.delete_doc("Web Form", "lesson", ignore_missing=True, force=True)
|
frappe.db.delete("Web Form", "lesson")
|
||||||
frappe.delete_doc("Web Form", "chapter", ignore_missing=True, force=True)
|
frappe.db.delete("Web Form", "chapter")
|
||||||
frappe.delete_doc("Web Form", "course", ignore_missing=True, force=True)
|
frappe.db.delete("Web Form", "course")
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
frappe.ready(() => {
|
frappe.ready(() => {
|
||||||
|
|
||||||
frappe.provide("frappe.ui.form");
|
|
||||||
|
|
||||||
setup_vue_and_file_size();
|
setup_vue_and_file_size();
|
||||||
|
|
||||||
$(".join-batch").click((e) => {
|
$(".join-batch").click((e) => {
|
||||||
@@ -111,7 +109,7 @@ const add_chapter = (e) => {
|
|||||||
|
|
||||||
let next_index = $("[data-index]").last().data("index") + 1 || 1;
|
let next_index = $("[data-index]").last().data("index") + 1 || 1;
|
||||||
let add_after = $(`.chapter-parent:last`).length ? $(`.chapter-parent:last`) : $("#outline-heading");
|
let add_after = $(`.chapter-parent:last`).length ? $(`.chapter-parent:last`) : $("#outline-heading");
|
||||||
console.log(add_after)
|
|
||||||
$(`<div class="chapter-parent chapter-edit new-chapter">
|
$(`<div class="chapter-parent chapter-edit new-chapter">
|
||||||
<div contenteditable="true" data-placeholder="${__('Chapter Name')}" class="chapter-title-main"></div>
|
<div contenteditable="true" data-placeholder="${__('Chapter Name')}" class="chapter-title-main"></div>
|
||||||
<div class="chapter-description small my-2" contenteditable="true"
|
<div class="chapter-description small my-2" contenteditable="true"
|
||||||
|
|||||||
Reference in New Issue
Block a user