Merge pull request #19290 from edx/dsheraz/educator_2234
Educator 2234 - Avoid multiple mathjax loading on the discussion user profile page
This commit is contained in:
@@ -5,8 +5,11 @@
|
||||
## MathJax configuration for Studio lives in
|
||||
## cms/js/require-config.js.
|
||||
|
||||
<%page args="disable_fast_preview=True" expression_filter="h"/>
|
||||
|
||||
<%page args="disable_fast_preview=True"/>
|
||||
## Avoid loading mathjax if already loaded on the page
|
||||
|
||||
%if context.get('load_mathjax', True):
|
||||
|
||||
%if disable_fast_preview:
|
||||
<script type="text/javascript">
|
||||
@@ -77,3 +80,4 @@
|
||||
It can't be run through static.url because MathJax uses crazy url introspection to do lazy loading of
|
||||
MathJax extension libraries -->
|
||||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-MML-AM_SVG"></script>
|
||||
%endif
|
||||
|
||||
@@ -629,6 +629,10 @@ class CourseTabView(EdxFragmentView):
|
||||
'uses_pattern_library': not uses_bootstrap,
|
||||
'disable_courseware_js': True,
|
||||
}
|
||||
# Avoid Multiple Mathjax loading on the 'user_profile'
|
||||
if 'profile_page_context' in kwargs:
|
||||
context['load_mathjax'] = kwargs['profile_page_context'].get('load_mathjax', True)
|
||||
|
||||
context.update(
|
||||
get_experiment_user_metadata_context(
|
||||
course,
|
||||
|
||||
@@ -581,6 +581,12 @@ def user_profile(request, course_key, user_id):
|
||||
})
|
||||
else:
|
||||
tab_view = CourseTabView()
|
||||
|
||||
# To avoid mathjax loading from 'mathjax_include.html'
|
||||
# as that file causes multiple loadings of Mathjax on
|
||||
# 'user_profile' page
|
||||
context['load_mathjax'] = False
|
||||
|
||||
return tab_view.get(request, unicode(course_key), 'discussion', profile_page_context=context)
|
||||
except User.DoesNotExist:
|
||||
raise Http404
|
||||
|
||||
@@ -1426,7 +1426,6 @@ dashboard_js = (
|
||||
sorted(rooted_glob(PROJECT_ROOT / 'static', 'js/dashboard/**/*.js'))
|
||||
)
|
||||
discussion_js = (
|
||||
rooted_glob(COMMON_ROOT / 'static', 'common/js/discussion/mathjax_include.js') +
|
||||
rooted_glob(PROJECT_ROOT / 'static', 'js/customwmd.js') +
|
||||
rooted_glob(PROJECT_ROOT / 'static', 'js/mathjax_accessible.js') +
|
||||
rooted_glob(PROJECT_ROOT / 'static', 'js/mathjax_delay_renderer.js') +
|
||||
|
||||
Reference in New Issue
Block a user