refactor: Convert BuiltIn Video Block's html from mako to django template (#37509)
Closes: https://github.com/openedx/public-engineering/issues/427
This commit is contained in:
@@ -30,6 +30,7 @@ from xblock.core import XBlock
|
||||
from xblock.fields import ScopeIds
|
||||
from xblock.runtime import KvsFieldData
|
||||
from xblocks_contrib.video import VideoBlock as _ExtractedVideoBlock
|
||||
from xblock.utils.resources import ResourceLoader
|
||||
|
||||
from common.djangoapps.xblock_django.constants import ATTR_KEY_REQUEST_COUNTRY_CODE, ATTR_KEY_USER_ID
|
||||
from openedx.core.lib.cache_utils import request_cached
|
||||
@@ -37,7 +38,6 @@ from openedx.core.lib.license import LicenseMixin
|
||||
from xmodule.contentstore.content import StaticContent
|
||||
from xmodule.editing_block import EditingMixin
|
||||
from xmodule.exceptions import NotFoundError
|
||||
from xmodule.mako_block import MakoTemplateBlockBase
|
||||
from xmodule.modulestore.inheritance import InheritanceKeyValueStore, own_metadata
|
||||
from xmodule.raw_block import EmptyDataRawMixin
|
||||
from xmodule.util.builtin_assets import add_css_to_fragment, add_webpack_js_to_fragment
|
||||
@@ -95,6 +95,7 @@ except ImportError:
|
||||
edxval_api = None
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
loader = ResourceLoader("lms")
|
||||
|
||||
# Make '_' a no-op so we can scrape strings. Using lambda instead of
|
||||
# `django.utils.translation.ugettext_noop` because Django cannot be imported in this file
|
||||
@@ -497,7 +498,7 @@ class _BuiltInVideoBlock(
|
||||
if video_config_service:
|
||||
template_context.update(video_config_service.get_public_sharing_context(self, self.course_id))
|
||||
|
||||
return self.runtime.service(self, 'mako').render_lms_template('video.html', template_context)
|
||||
return loader.render_django_template("templates/video.html", template_context)
|
||||
|
||||
def is_transcript_feedback_enabled(self):
|
||||
"""
|
||||
@@ -848,7 +849,9 @@ class _BuiltInVideoBlock(
|
||||
"""
|
||||
Extend context by data for transcript basic tab.
|
||||
"""
|
||||
_context = MakoTemplateBlockBase.get_context(self)
|
||||
_context = {
|
||||
'editable_metadata_fields': self.editable_metadata_fields
|
||||
}
|
||||
_context.update({
|
||||
'tabs': self.tabs,
|
||||
'html_id': self.location.html_id(), # element_id
|
||||
|
||||
Reference in New Issue
Block a user