feat: embed pdf

This commit is contained in:
Jannat Patel
2023-08-31 23:29:56 +05:30
parent 833e714a1f
commit ffd9d56896
5 changed files with 35 additions and 15 deletions

View File

@@ -156,9 +156,17 @@ def youtube_video_renderer(video_id):
def embed_renderer(details):
type = details.split("|||")[0]
src = details.split("|||")[1]
width = "100%"
height = "400"
if type == "pdf":
width = "75%"
height = "600"
return f"""
<iframe width="100%" height="400"
<iframe width={width} height={height}
src={src}
title="Embedded Content"
frameborder="0"
@@ -175,20 +183,21 @@ def video_renderer(src):
)
def assignment_renderer(detail):
supported_types = {
"Document": ".doc,.docx,.xml,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"PDF": ".pdf",
"Image": ".png, .jpg, .jpeg",
"Video": "video/*",
def assignment_renderer(name):
"""supported_types = {
"Document": ".doc,.docx,.xml,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"PDF": ".pdf",
"Image": ".png, .jpg, .jpeg",
"Video": "video/*",
}
question = detail.split("-")[0]
file_type = detail.split("-")[1]
accept = supported_types[file_type] if file_type else ""
return frappe.render_template(
"templates/assignment.html",
{"question": question, "accept": accept, "file_type": file_type},
)
"templates/assignment.html",
{"question": question, "accept": accept, "file_type": file_type},
)"""
def show_custom_signup():