[IMP] web_preload js part
bzr revid: al@openerp.com-20110927111402-teb8bpavj4atghle
This commit is contained in:
commit
5dfc14d359
|
@ -119,7 +119,7 @@ home_template = textwrap.dedent("""<!DOCTYPE html>
|
|||
%(javascript)s
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
var c = new openerp.init();
|
||||
var c = new openerp.init(%(modules)s);
|
||||
var wc = new c.web.WebClient("oe");
|
||||
wc.start();
|
||||
});
|
||||
|
@ -166,9 +166,11 @@ class WebClient(openerpweb.Controller):
|
|||
if req.debug:
|
||||
csslist = [i + '?debug=' + str(time.time()) for i in manifest_glob(None, 'css')]
|
||||
css = "\n ".join(['<link rel="stylesheet" href="%s">'%i for i in csslist])
|
||||
|
||||
r = home_template % {
|
||||
'javascript': js,
|
||||
'css': css
|
||||
'css': css,
|
||||
'modules': simplejson.dumps(manifest_preload()),
|
||||
}
|
||||
return r
|
||||
|
||||
|
|
|
@ -19,9 +19,9 @@
|
|||
/**
|
||||
* OpenERP instance constructor
|
||||
*
|
||||
* @param {Boolean} skip_init if true, skips the built-in initialization
|
||||
* @param {Array} modules list of modules to initialize
|
||||
*/
|
||||
init: function(skip_init) {
|
||||
init: function(modules) {
|
||||
var new_instance = {
|
||||
// links to the global openerp
|
||||
_openerp: openerp,
|
||||
|
@ -35,8 +35,9 @@
|
|||
web_mobile: {}
|
||||
};
|
||||
openerp.sessions[new_instance._session_id] = new_instance;
|
||||
if (!skip_init){
|
||||
openerp.web(new_instance);
|
||||
modules = modules || ["web"];
|
||||
for(var i=0; i < modules.length; i++) {
|
||||
openerp[modules[i]](new_instance);
|
||||
}
|
||||
return new_instance;
|
||||
}
|
||||
|
|
|
@ -5,4 +5,5 @@
|
|||
"js": ["static/*/*.js", "static/*/js/*.js"],
|
||||
"css": [],
|
||||
'active': False,
|
||||
'web_preload': True,
|
||||
}
|
||||
|
|
|
@ -13,6 +13,13 @@ openerp.web.SearchView = openerp.web.SearchView.extend({
|
|||
|
||||
// here you may tweak globals object, if any, and play with on_* or do_* callbacks on them
|
||||
|
||||
openerp.web.Login = openerp.web.Login.extend({
|
||||
start: function() {
|
||||
console.log('Hello there');
|
||||
this._super.apply(this,arguments);
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
// vim:et fdc=0 fdl=0:
|
||||
|
|
Loading…
Reference in New Issue