fix: branding, course, lesson and certificate creation
This commit is contained in:
@@ -278,3 +278,13 @@ def get_file_info(file_url):
|
||||
"File", {"file_url": file_url}, ["file_name", "file_size", "file_url"], as_dict=1
|
||||
)
|
||||
return file_info
|
||||
|
||||
|
||||
@frappe.whitelist(allow_guest=True)
|
||||
def get_branding():
|
||||
"""Get branding details."""
|
||||
return {
|
||||
"brand_name": frappe.db.get_single_value("Website Settings", "app_name"),
|
||||
"brand_html": frappe.db.get_single_value("Website Settings", "brand_html"),
|
||||
"favicon": frappe.db.get_single_value("Website Settings", "favicon"),
|
||||
}
|
||||
|
||||
@@ -15,7 +15,11 @@ class LMSCertificate(Document):
|
||||
|
||||
def after_insert(self):
|
||||
if not frappe.flags.in_test:
|
||||
self.send_mail()
|
||||
outgoing_email_account = frappe.get_cached_value(
|
||||
"Email Account", {"default_outgoing": 1, "enable_outgoing": 1}, "name"
|
||||
)
|
||||
if outgoing_email_account:
|
||||
self.send_mail()
|
||||
|
||||
def send_mail(self):
|
||||
subject = _("Congratulations on getting certified!")
|
||||
|
||||
@@ -161,7 +161,6 @@ def get_lesson_details(chapter):
|
||||
)
|
||||
lesson_details.number = f"{chapter.idx}.{row.idx}"
|
||||
lesson_details.icon = get_lesson_icon(lesson_details.body)
|
||||
lesson_details.is_complete = get_progress(lesson_details.course, lesson_details.name)
|
||||
lessons.append(lesson_details)
|
||||
return lessons
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
{{ _("With this certification, you can now showcase your updated skills and share your achievement with your colleagues and on LinkedIn. To access your certificate, please click on the link provided below. Make sure you are logged in to the portal.") }}
|
||||
</p>
|
||||
<br>
|
||||
<a href="/api/method/frappe.utils.print_format.download_pdf?doctype=LMS+Certificate&name={{certificate_name}}&format={{encodeURIComponent(template)}}">{{ _("Certificate Link") }}</a>
|
||||
<a href="/api/method/frappe.utils.print_format.download_pdf?doctype=LMS+Certificate&name={{certificate_name}}&format={{template | urlencode }}">{{ _("Certificate Link") }}</a>
|
||||
<br>
|
||||
<p>
|
||||
{{ _("Once again, congratulations on this significant accomplishment.")}}
|
||||
|
||||
Reference in New Issue
Block a user