revert: text editor for lesson and course
This commit is contained in:
@@ -66,7 +66,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "body",
|
"fieldname": "body",
|
||||||
"fieldtype": "Text Editor",
|
"fieldtype": "Markdown Editor",
|
||||||
"ignore_xss_filter": 1,
|
"ignore_xss_filter": 1,
|
||||||
"label": "Body",
|
"label": "Body",
|
||||||
"reqd": 1
|
"reqd": 1
|
||||||
@@ -135,7 +135,7 @@
|
|||||||
],
|
],
|
||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2023-04-05 12:42:16.926753",
|
"modified": "2023-05-02 12:42:16.926753",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "LMS",
|
"module": "LMS",
|
||||||
"name": "Course Lesson",
|
"name": "Course Lesson",
|
||||||
|
|||||||
@@ -57,7 +57,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "description",
|
"fieldname": "description",
|
||||||
"fieldtype": "Text Editor",
|
"fieldtype": "Markdown Editor",
|
||||||
"label": "Description",
|
"label": "Description",
|
||||||
"reqd": 1
|
"reqd": 1
|
||||||
},
|
},
|
||||||
@@ -260,7 +260,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"make_attachments_public": 1,
|
"make_attachments_public": 1,
|
||||||
"modified": "2023-02-23 09:45:54.826328",
|
"modified": "2023-05-02 09:45:54.826328",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "LMS",
|
"module": "LMS",
|
||||||
"name": "LMS Course",
|
"name": "LMS Course",
|
||||||
|
|||||||
@@ -50,7 +50,6 @@ lms.patches.v0_0.video_embed_link
|
|||||||
lms.patches.v0_0.rename_exercise_doctype
|
lms.patches.v0_0.rename_exercise_doctype
|
||||||
lms.patches.v0_0.add_question_type #09-04-2023
|
lms.patches.v0_0.add_question_type #09-04-2023
|
||||||
lms.patches.v0_0.add_evaluator_to_assignment #09-04-2023
|
lms.patches.v0_0.add_evaluator_to_assignment #09-04-2023
|
||||||
lms.patches.v0_0.convert_lesson_markdown_to_html #05-04-2023
|
|
||||||
lms.patches.v0_0.convert_course_description_to_html
|
|
||||||
lms.patches.v0_0.share_certificates
|
lms.patches.v0_0.share_certificates
|
||||||
execute:frappe.delete_doc("Web Form", "class", ignore_missing=True, force=True)
|
execute:frappe.delete_doc("Web Form", "class", ignore_missing=True, force=True)
|
||||||
|
lms.patches.v0_0.amend_course_and_lesson_editor_fields
|
||||||
|
|||||||
37
lms/patches/v0_0/amend_course_and_lesson_editor_fields.py
Normal file
37
lms/patches/v0_0/amend_course_and_lesson_editor_fields.py
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
import frappe
|
||||||
|
from frappe.utils import to_markdown
|
||||||
|
|
||||||
|
|
||||||
|
def execute():
|
||||||
|
amend_lesson_content()
|
||||||
|
amend_course_description()
|
||||||
|
|
||||||
|
|
||||||
|
def amend_lesson_content():
|
||||||
|
lesson_content_field = frappe.db.get_value(
|
||||||
|
"DocField", {"parent": "Course Lesson", "fieldname": "body"}, "fieldtype"
|
||||||
|
)
|
||||||
|
|
||||||
|
if lesson_content_field == "Text Editor":
|
||||||
|
lessons = frappe.get_all("Course Lesson", fields=["name", "body"])
|
||||||
|
|
||||||
|
for lesson in lessons:
|
||||||
|
frappe.db.set_value("Course Lesson", lesson.name, "body", to_markdown(lesson.body))
|
||||||
|
|
||||||
|
frappe.reload_doc("lms", "doctype", "course_lesson")
|
||||||
|
|
||||||
|
|
||||||
|
def amend_course_description():
|
||||||
|
course_description_field = frappe.db.get_value(
|
||||||
|
"DocField", {"parent": "LMS Course", "fieldname": "description"}, "fieldtype"
|
||||||
|
)
|
||||||
|
|
||||||
|
if course_description_field == "Text Editor":
|
||||||
|
courses = frappe.get_all("LMS Course", fields=["name", "description"])
|
||||||
|
|
||||||
|
for course in courses:
|
||||||
|
frappe.db.set_value(
|
||||||
|
"LMS Course", course.name, "description", to_markdown(course.description)
|
||||||
|
)
|
||||||
|
|
||||||
|
frappe.reload_doc("lms", "doctype", "lms_course")
|
||||||
Reference in New Issue
Block a user