fix: certificate, profile, quiz, and video markdown
This commit is contained in:
@@ -17,6 +17,15 @@ frappe.ui.form.on('Lesson', {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<div class="col-sm-4">
|
||||
Video
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
{{ Video("url_of_source") }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<div class="col-sm-4">
|
||||
YouTube Video
|
||||
|
||||
@@ -29,13 +29,17 @@ def create_certificate(course):
|
||||
return certificate
|
||||
|
||||
else:
|
||||
expires_after_yrs = course_details.expiry
|
||||
expires_after_yrs = int(course_details.expiry)
|
||||
expiry_date = None
|
||||
if expires_after_yrs:
|
||||
expiry_date = add_years(nowdate(), expires_after_yrs)
|
||||
|
||||
certificate = frappe.get_doc({
|
||||
"doctype": "LMS Certification",
|
||||
"student": frappe.session.user,
|
||||
"course": course,
|
||||
"issue_date": nowdate(),
|
||||
"expiry_date": add_years(nowdate(), int(expires_after_yrs))
|
||||
"expiry_date": expiry_date
|
||||
})
|
||||
certificate.save(ignore_permissions=True)
|
||||
return certificate.name
|
||||
|
||||
@@ -29,7 +29,10 @@
|
||||
"section_break_5",
|
||||
"short_introduction",
|
||||
"description",
|
||||
"chapters"
|
||||
"chapters",
|
||||
"certification_section",
|
||||
"enable_certification",
|
||||
"expiry"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
@@ -119,6 +122,25 @@
|
||||
{
|
||||
"fieldname": "column_break_11",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "certification_section",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Certification"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"fieldname": "enable_certification",
|
||||
"fieldtype": "Check",
|
||||
"label": "Enable Certification"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"depends_on": "enable_certification",
|
||||
"fieldname": "expiry",
|
||||
"fieldtype": "Select",
|
||||
"label": "Certification Expires After Years",
|
||||
"options": "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10"
|
||||
}
|
||||
],
|
||||
"index_web_pages_for_search": 1,
|
||||
@@ -140,7 +162,7 @@
|
||||
"link_fieldname": "course"
|
||||
}
|
||||
],
|
||||
"modified": "2021-08-20 11:01:15.795219",
|
||||
"modified": "2021-08-25 11:04:57.211898",
|
||||
"modified_by": "Administrator",
|
||||
"module": "LMS",
|
||||
"name": "LMS Course",
|
||||
|
||||
@@ -20,6 +20,7 @@ import markdown
|
||||
from markdown import Extension
|
||||
from markdown.inlinepatterns import InlineProcessor
|
||||
import xml.etree.ElementTree as etree
|
||||
import html as HTML
|
||||
|
||||
def markdown_to_html(text):
|
||||
"""Renders markdown text into html.
|
||||
@@ -109,4 +110,5 @@ def sanitize_html(html, macro):
|
||||
classname = ""
|
||||
if macro == "YouTubeVideo":
|
||||
classname = "lesson-video"
|
||||
|
||||
return "<div class='" + classname + "'>" + "\n".join(str(node) for node in nodes) + "</div>"
|
||||
|
||||
Reference in New Issue
Block a user