[IMP] Rename EmbedClient to EmbeddedClient and move it to chrome.js.
[IMP] move the currentScript function to root namespace bzr revid: chs@openerp.com-20111214125658-huw4955d7zo2y37g
This commit is contained in:
@@ -53,7 +53,6 @@
|
||||
"static/src/js/view_list_editable.js",
|
||||
"static/src/js/view_tree.js",
|
||||
"static/src/js/view_editor.js",
|
||||
"static/src/js/embed.js",
|
||||
],
|
||||
'css' : [
|
||||
"static/lib/jquery.superfish/css/superfish.css",
|
||||
|
||||
@@ -59,7 +59,7 @@ openerp.web = function(instance) {
|
||||
openerp.web.formats(instance);
|
||||
openerp.web.chrome(instance);
|
||||
openerp.web.data(instance);
|
||||
var files = ["views","search","list","form", "page","list_editable","web_mobile","view_tree","data_export","data_import","view_editor","embed"];
|
||||
var files = ["views","search","list","form", "page","list_editable","web_mobile","view_tree","data_export","data_import","view_editor"];
|
||||
for(var i=0; i<files.length; i++) {
|
||||
if(openerp.web[files[i]]) {
|
||||
openerp.web[files[i]](instance);
|
||||
|
||||
@@ -1112,6 +1112,48 @@ openerp.web.WebClient = openerp.web.Widget.extend(/** @lends openerp.web.WebClie
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
openerp.currentScript = function() {
|
||||
var currentScript = document.currentScript;
|
||||
if (!currentScript) {
|
||||
var sc = document.getElementsByTagName('script');
|
||||
currentScript = sc[sc.length-1];
|
||||
}
|
||||
return currentScript;
|
||||
};
|
||||
|
||||
openerp.web.EmbeddedClient = openerp.web.Widget.extend({
|
||||
template: 'EmptyComponent',
|
||||
init: function(action_id, options) {
|
||||
this._super();
|
||||
// TODO take the xmlid of a action instead of its id
|
||||
this.action_id = action_id;
|
||||
this.options = options || {};
|
||||
this.am = new openerp.web.ActionManager(this);
|
||||
},
|
||||
|
||||
start: function() {
|
||||
var self = this;
|
||||
|
||||
this.am.appendTo(this.$element.addClass('openerp'));
|
||||
|
||||
return this.rpc("/web/action/load", { action_id: this.action_id }, function(result) {
|
||||
var action = result.result;
|
||||
action.flags = _.extend({
|
||||
//views_switcher : false,
|
||||
search_view : false,
|
||||
action_buttons : false,
|
||||
sidebar : false
|
||||
//pager : false
|
||||
}, self.options, action.flags || {});
|
||||
|
||||
self.am.do_action(action);
|
||||
});
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
|
||||
// vim:et fdc=0 fdl=0 foldnestmax=3 fdm=syntax:
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
openerp.web.embed = function(session) {
|
||||
|
||||
session.util = session.util || {}
|
||||
session.util.currentScript = function() {
|
||||
var currentScript = document.currentScript;
|
||||
if (!currentScript) {
|
||||
var sc = document.getElementsByTagName('script');
|
||||
currentScript = sc[sc.length-1];
|
||||
}
|
||||
return currentScript;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
session.connection.on_session_invalid.add_last(function() {
|
||||
console.error("invalid session", arguments);
|
||||
});
|
||||
// */
|
||||
|
||||
|
||||
session.web.EmbedClient = session.web.Widget.extend({
|
||||
template: 'EmptyComponent',
|
||||
init: function(action_id, options) {
|
||||
this._super();
|
||||
this.action_id = action_id;
|
||||
this.options = options || {};
|
||||
this.am = new session.web.ActionManager();
|
||||
},
|
||||
|
||||
start: function() {
|
||||
var self = this;
|
||||
|
||||
this.am.appendTo(this.$element.addClass('openerp'));
|
||||
|
||||
return this.rpc("/web/action/load", { action_id: this.action_id }, function(result) {
|
||||
var action = result.result;
|
||||
action.flags = _.extend({
|
||||
//views_switcher : false,
|
||||
search_view : false,
|
||||
action_buttons : false,
|
||||
sidebar : false
|
||||
//pager : false
|
||||
}, self.options, action.flags || {});
|
||||
|
||||
self.am.do_action(action);
|
||||
});
|
||||
},
|
||||
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user