UPD 2
- add RuTube servise
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
"instructor_notes",
|
||||
"section_break_6",
|
||||
"youtube",
|
||||
"rutube",
|
||||
"column_break_9",
|
||||
"quiz_id",
|
||||
"section_break_16",
|
||||
@@ -104,6 +105,12 @@
|
||||
"fieldtype": "Data",
|
||||
"label": "YouTube Video URL"
|
||||
},
|
||||
{
|
||||
"description": "RuTube Video will appear at the top of the lesson.",
|
||||
"fieldname": "rutube",
|
||||
"fieldtype": "Data",
|
||||
"label": "RuTube Video URL"
|
||||
},
|
||||
{
|
||||
"fieldname": "section_break_16",
|
||||
"fieldtype": "Section Break",
|
||||
|
||||
@@ -35,6 +35,7 @@ def find_macros(text):
|
||||
>>> find_macros(text)
|
||||
[
|
||||
('YouTubeVideo': 'abcd1234')
|
||||
('RuTubeVideo': 'abcd1234')
|
||||
('Exercise', 'two-circles'),
|
||||
('Exercise', 'four-circles')
|
||||
]
|
||||
@@ -119,5 +120,7 @@ def sanitize_html(html, macro):
|
||||
classname = ""
|
||||
if macro == "YouTubeVideo":
|
||||
classname = "lesson-video"
|
||||
elif macro == "RutubeVideo": # Добавлено
|
||||
classname = "rutube-video"
|
||||
|
||||
return "<div class='" + classname + "'>" + "\n".join(str(node) for node in nodes) + "</div>"
|
||||
|
||||
@@ -145,6 +145,7 @@ def get_lesson_details(chapter, progress=False):
|
||||
"body",
|
||||
"creation",
|
||||
"youtube",
|
||||
"rutube",
|
||||
"quiz_id",
|
||||
"question",
|
||||
"file_type",
|
||||
@@ -334,12 +335,17 @@ def render_html(lesson):
|
||||
youtube = lesson.youtube
|
||||
quiz_id = lesson.quiz_id
|
||||
body = lesson.body
|
||||
rutube = lesson.get("rutube")
|
||||
|
||||
if youtube and "/" in youtube:
|
||||
youtube = youtube.split("/")[-1]
|
||||
|
||||
if rutube and "/" in rutube:
|
||||
rutube = rutube.split("/")[-1]
|
||||
|
||||
quiz_id = "{{ Quiz('" + quiz_id + "') }}" if quiz_id else ""
|
||||
youtube = "{{ YouTubeVideo('" + youtube + "') }}" if youtube else ""
|
||||
rutube = "{{ RutubeVideo('" + rutube + "') }}" if rutube else ""
|
||||
text = youtube + body + quiz_id
|
||||
|
||||
if lesson.question:
|
||||
@@ -1276,6 +1282,7 @@ def get_lesson(course, chapter, lesson):
|
||||
"body",
|
||||
"creation",
|
||||
"youtube",
|
||||
"rutube",
|
||||
"quiz_id",
|
||||
"question",
|
||||
"file_type",
|
||||
@@ -1815,6 +1822,7 @@ def get_lesson_creation_details(course, chapter, lesson):
|
||||
"instructor_notes",
|
||||
"instructor_content",
|
||||
"youtube",
|
||||
"rutube",
|
||||
"quiz_id",
|
||||
],
|
||||
as_dict=1,
|
||||
|
||||
Reference in New Issue
Block a user