Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
plugin_dbui
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
w2pext
plugin_dbui
Commits
76571ed3
Commit
76571ed3
authored
13 years ago
by
Renaud Le Gac
Browse files
Options
Downloads
Patches
Plain Diff
Polish the loading of the MathJax plugin (replace None by undefined).
Polish the documentation of appbase.js
parent
6d2fbc0a
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
controllers/plugin_dbui.py
+8
-4
8 additions, 4 deletions
controllers/plugin_dbui.py
static/plugin_dbui/src/appbase.js
+14
-9
14 additions, 9 deletions
static/plugin_dbui/src/appbase.js
with
22 additions
and
13 deletions
controllers/plugin_dbui.py
+
8
−
4
View file @
76571ed3
...
...
@@ -27,7 +27,7 @@ App.REMOTE_API = {
'
actions
'
: %s
};
App.storeCfgs = %s;
App.mathJax =
'
%s
/MathJax.js
'
;
"""
App.mathJax = %s;
"""
def
call
():
...
...
@@ -168,9 +168,13 @@ def get_api():
for
table
in
cfgSvc
.
get_tables
()[
'
tables
'
]:
storeCfgs
[
table
]
=
cfgSvc
.
get_jsonstore
(
table
)
#
determine if
the MathJax plugin
is there
# 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
,
...
...
@@ -178,7 +182,7 @@ def get_api():
app
,
json
.
dumps
(
di
),
json
.
dumps
(
storeCfgs
),
str
(
p_mathjax
)
)
p_mathjax
)
# return the response as a javascript
response
.
headers
[
'
Content-Type
'
]
=
'
text/javascript
'
...
...
This diff is collapsed.
Click to expand it.
static/plugin_dbui/src/appbase.js
+
14
−
9
View file @
76571ed3
...
...
@@ -21,15 +21,17 @@ Ext.namespace('App');
/**
* @cfg {Boolean} App.mathJax
* The path of the plugin MathJax. It is equal to None id not present.
* This constants is defined by the server.
* The path of the MathJax.js script.
* It is equal to undefined if it does not exist.
* This constants is defined by the server and should not be used directly.
* The plugin should be loaded with the function App.loadMathJax.
*/
/**
* Helper function mimicking the encode_field function running on the server
* (table, field) → TableField
* @param {
Object
} table
* @param {
Object
} field
* @param {
String
} table
* @param {
String
} field
*/
App
.
encodeField
=
function
(
table
,
field
)
{
var
t
,
f
;
...
...
@@ -42,13 +44,12 @@ App.encodeField = function (table, field) {
* Helper function returning the App.data.DirectStore identifies by its id.
* If the store does not exit it is created and register in the store manager.
*
* NOTE: The storeId is defined by the server as a configuration option
* for each widget: combobox, form and grid.
* NOTE: The storeId is defined by the server for each widget.
* The syntax of the storeId is "tableStore".
* If the store does not exist, its configuration is extract from
* the application constant App.storeCfgs.Then it is created and registered.
* In the current frame work a unique store is associated to a database table.
* This property garanty that widget share the same store.
* This property g
u
aranty that widget share the same store.
*
* @param {String} storeId
*/
...
...
@@ -116,11 +117,15 @@ App.isPlugin = function (component, ptype) {
/**
* Helper function to load the MathJax library
* @param {Object} callback
* The loading is an asynchronous operation.
* When finished the function callback is executed.
* If the library is not there the callback is executed to.
* @param {Function} callback
* @param {Object} scope scope for the callback
*/
App
.
loadMathJax
=
function
(
callback
,
scope
)
{
if
(
App
.
mathJax
!==
'
None
'
)
{
if
(
App
.
mathJax
)
{
Ext
.
Loader
.
load
([
App
.
mathJax
],
callback
,
scope
);
}
else
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment