fix: refactor MakoService to allow specifying namespace per template (#33061)

This commit is contained in:
Braden MacDonald
2023-08-21 10:05:38 -07:00
committed by GitHub
parent bb28c27f96
commit d60cdc2305
25 changed files with 113 additions and 55 deletions

View File

@@ -381,7 +381,7 @@ class LTIBlock(
# Add our specific template information (the raw data body)
context.update({'data': self.data})
fragment = Fragment(
self.runtime.service(self, 'mako').render_template(self.mako_template, context)
self.runtime.service(self, 'mako').render_cms_template(self.mako_template, context)
)
add_sass_to_fragment(fragment, 'LTIBlockEditor.scss')
add_webpack_js_to_fragment(fragment, 'LTIBlockEditor')
@@ -498,7 +498,7 @@ class LTIBlock(
Return the student view.
"""
fragment = Fragment()
fragment.add_content(self.runtime.service(self, 'mako').render_template('lti.html', self.get_context()))
fragment.add_content(self.runtime.service(self, 'mako').render_lms_template('lti.html', self.get_context()))
add_webpack_js_to_fragment(fragment, 'LTIBlockDisplay')
shim_xmodule_js(fragment, 'LTI')
return fragment
@@ -508,7 +508,7 @@ class LTIBlock(
"""
This is called to get context with new oauth params to iframe.
"""
template = self.runtime.service(self, 'mako').render_template('lti_form.html', self.get_context())
template = self.runtime.service(self, 'mako').render_lms_template('lti_form.html', self.get_context())
return Response(template, content_type='text/html')
def get_user_id(self):