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

add the plugin parameter user_src_path and user_libmin to handle additional user javascript code.

parent 0f7f31b3
No related branches found
No related tags found
No related merge requests found
......@@ -45,6 +45,20 @@ def index():
script_path
The relative path where scripts are located.
By default static/plugin_dbui/scripts
user_src_path
the relative path to a directory containing additional
javascript source code for user application classes and plugins.
By default static/src
user_libmin
The relative path to the file containing the additional
javascript library for user application classes and plugins.
It is the minified version of the source code.
If the library exits it is loaded otherwise the source
code is loaded. When the debug flag is activate the source
code is always loaded.
PRIVATE PARAMETERS
......@@ -128,7 +142,25 @@ def index():
li.sort()
response.files.extend(li)
# minified version of the user library
if not debug and plugins.dbui.user_libmin:
if os.path.exists(os.path.join(server_path, plugins.dbui.user_libmin)):
response.files.append(os.path.join(base, plugins.dbui.user_libmin))
# user source code -- respect alphabetic order
else:
li = []
appdir = os.path.join(base, plugins.dbui.user_src_path)
svcdir = os.path.join(server_path, plugins.dbui.user_src_path)
if os.path.exists(svcdir):
for file in os.listdir(svcdir):
if file.endswith(".js"):
li.append(os.path.join(appdir, file))
li.sort()
response.files.extend(li)
# main application script
response.files.append(os.path.join(base, plugins.dbui.script_path, script))
......
......@@ -12,7 +12,9 @@ plugins = PluginManager('dbui',
grid_modifiers={},
viewport_modifiers=Storage(hidden_tables=[]),
page_view='plugin_dbui.html',
script_path='static/plugin_dbui/scripts')
script_path='static/plugin_dbui/scripts',
user_src_path='static/src',
user_libmin=None)
# Start common services
dbSvc = dbui.DbSvc(db)
......
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