summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorChristophe Simonis <chs@openerp.com>2011-12-14 13:56:58 +0100
committerChristophe Simonis <chs@openerp.com>2011-12-14 13:56:58 +0100
commit6da5e9245e5f680866e4bf64c92e653127dfbb55 (patch)
tree781240582c02e030e1481638f23eea8bb3a2f351 /addons/web/static/src
parent5cd5755495df46fbddf271d3664e38586c9b674c (diff)
[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
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/js/boot.js2
-rw-r--r--addons/web/static/src/js/chrome.js42
-rw-r--r--addons/web/static/src/js/embed.js50
3 files changed, 43 insertions, 51 deletions
diff --git a/addons/web/static/src/js/boot.js b/addons/web/static/src/js/boot.js
index 14f50adb473..c2aea24276b 100644
--- a/addons/web/static/src/js/boot.js
+++ b/addons/web/static/src/js/boot.js
@@ -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);
diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js
index 9d83e188555..4910d794876 100644
--- a/addons/web/static/src/js/chrome.js
+++ b/addons/web/static/src/js/chrome.js
@@ -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:
diff --git a/addons/web/static/src/js/embed.js b/addons/web/static/src/js/embed.js
deleted file mode 100644
index 1c261060da8..00000000000
--- a/addons/web/static/src/js/embed.js
+++ /dev/null
@@ -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);
- });
- },
-
- });
-};