Skip to content
Snippets Groups Projects
Commit 7e33ff02 authored by Renaud Le Gac's avatar Renaud Le Gac
Browse files

Modify controller and view in order to load the mathjax library as the other javascript libraries

parent 08607adb
No related branches found
No related tags found
No related merge requests found
......@@ -26,8 +26,7 @@ App.REMOTE_API = {
'type': 'remoting',
'actions': %s
};
App.storeCfgs = %s;
App.mathJax = %s; """
App.storeCfgs = %s; """
def call():
......@@ -107,9 +106,10 @@ def debug():
"""
# check the presence of the ExtJS plugin
# check the presence of the ExtJS and MathJax plugins
dbui = local_import('plugin_dbui')
pextjs = dbui.get_plugin_path(globals(), 'plugin_extjs')
pmathjax = dbui.get_plugin_path(globals(), 'plugin_mathjax')
# internationalization (fr, fr-fr, fr-ca, ...)
lg = dbui.get_language(globals())
......@@ -135,7 +135,7 @@ def debug():
# return the ExtJS path, the language
# and a list of files in response.files
return dict(pextjs=pextjs, lg=lg)
return dict(pextjs=pextjs, pmathjax=pmathjax, lg=lg)
......@@ -168,21 +168,13 @@ def get_api():
for table in cfgSvc.get_tables()['tables']:
storeCfgs[table] = cfgSvc.get_jsonstore(table)
# the MathJax plugin
p_mathjax = dbui.get_plugin_path(globals(), 'plugin_mathjax')
if p_mathjax:
p_mathjax = "'%s'" % os.path.join(p_mathjax, 'MathJax.js')
else:
p_mathjax = 'undefined'
# fill the javascript template
app = request.application
script = SCRIPT % (app,
app,
app,
json.dumps(di),
json.dumps(storeCfgs),
p_mathjax)
json.dumps(storeCfgs))
# return the response as a javascript
response.headers['Content-Type'] = 'text/javascript'
......@@ -220,10 +212,11 @@ def index():
is launched.
"""
# check the presence of the ExtJS plugin
# check the presence of the ExtJS and MathJax plugins
dbui = local_import('plugin_dbui')
pextjs = dbui.get_plugin_path(globals(), 'plugin_extjs')
pmathjax = dbui.get_plugin_path(globals(), 'plugin_mathjax')
# internationalization (fr, fr-fr, fr-ca, ...)
lg = dbui.get_language(globals())
......@@ -243,9 +236,8 @@ def index():
# switch off the debug mode on the server side
session.debug = False
# return the ExtJS path, the language
# and a list of files in response.files
return dict(pextjs=pextjs, lg=lg)
# return the ExtJS, MathJax paths and the language
return dict(pextjs=pextjs, pmathjax=pmathjax, lg=lg)
def status():
......
......@@ -9,7 +9,22 @@
<meta name="description" content="{{=response.description}}" />
<title>{{=request.application}}</title>
<!-- mathjax library -->
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
extensions: ["tex2jax.js"],
jax: ["input/TeX", "output/HTML-CSS"],
tex2jax: {
inlineMath: [ ['$','$'], ["\\(","\\)"] ],
displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
processEscapes: true
},
"HTML-CSS": { availableFonts: ["TeX"] }
});
</script>
<script type="text/javascript" src="{{=pmathjax}}/MathJax.js"></script>
<!-- extjs css -->
<link rel="stylesheet" type="text/css" href="{{=pextjs}}/resources/css/ext-all.css"/>
<link rel="stylesheet" type="text/css" href="{{=pextjs}}/examples/shared/icons/silk.css"/>
......
......@@ -9,7 +9,22 @@
<meta name="description" content="{{=response.description}}" />
<title>{{=request.application}}</title>
<!-- mathjax library -->
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
extensions: ["tex2jax.js"],
jax: ["input/TeX", "output/HTML-CSS"],
tex2jax: {
inlineMath: [ ['$','$'], ["\\(","\\)"] ],
displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
processEscapes: true
},
"HTML-CSS": { availableFonts: ["TeX"] }
});
</script>
<script type="text/javascript" src="{{=pmathjax}}/MathJax.js"></script>
<!-- extjs css -->
<link rel="stylesheet" type="text/css" href="{{=pextjs}}/resources/css/ext-all.css"/>
<link rel="stylesheet" type="text/css" href="{{=pextjs}}/examples/shared/icons/silk.css"/>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment