turn on/off charts

master
inpos 2018-08-22 21:48:07 +03:00
parent a467158e65
commit 8403f02718
2 changed files with 11 additions and 3 deletions

3
orun/extjs/app.html vendored
View File

@ -4,8 +4,7 @@
<title>{title}</title>
<script src="{base_url}/ext_620/ext-all.js"></script>
<link rel="stylesheet" href="{base_url}/ext_620/{theme_model}/theme-{theme}/resources/theme-{theme}-all.css">
<script type="text/javascript" src="{base_url}/ext_620/packages/charts/{theme_model}/charts.js"></script>
<link rel="stylesheet" type="text/css" href="{base_url}/ext_620/packages/charts/{chart_theme_model}/resources/charts-all.css">
{packages}
<script>
Ext.onReady(function () {{

View File

@ -10,6 +10,15 @@ CHART_THEME_MODEL = 'classic/classic' if THEME_MODEL == 'classic' else 'modern/m
BASE_URL = ''
ENABLE_CHARTS=False
CHART_HTML_CODE = '''<script type="text/javascript" src="{base_url}/ext_620/packages/charts/{theme_model}/charts.js"></script>
<link rel="stylesheet" type="text/css" href="{base_url}/ext_620/packages/charts/{chart_theme_model}/resources/charts-all.css">
'''.format(base_url=BASE_URL,
theme_model=THEME_MODEL,
chart_theme_model=CHART_THEME_MODEL) if ENABLE_CHARTS else ''
EXTJS_PACKAGES = '' + CHART_HTML_CODE
@cherrypy.expose
class ExtJS:
_cp_config = {
@ -31,7 +40,7 @@ class ExtApplication(cp.Application):
theme=THEME,
theme_model=THEME_MODEL,
script=str(js.js_manager),
chart_theme_model=CHART_THEME_MODEL)
packages=EXTJS_PACKAGES)
@cherrypy.expose
def ajax_callback(self, *args, **kwargs):