diff options
| author | Dharti Ratani (OpenERP) <dhr@tinyerp.com> | 2012-08-09 10:51:41 +0530 |
|---|---|---|
| committer | Dharti Ratani (OpenERP) <dhr@tinyerp.com> | 2012-08-09 10:51:41 +0530 |
| commit | 95db87558f3442b6fcfa4745381c864c63715bb8 (patch) | |
| tree | e2e14c4cc7e4646f33e1e86dda53887968451354 /addons/web/static/src/js/coresetup.js | |
| parent | 23c2f1fd40c4bbe9e9c9fc21c323e0cee327ffa1 (diff) | |
| parent | 4d88bff8dd527616e96f226e49c13e265daa9c3e (diff) | |
[MERGE]merged with latest trunk
bzr revid: dhr@tinyerp.com-20120809052141-os6yizjk8clv2xmd
Diffstat (limited to 'addons/web/static/src/js/coresetup.js')
| -rw-r--r-- | addons/web/static/src/js/coresetup.js | 59 |
1 files changed, 16 insertions, 43 deletions
diff --git a/addons/web/static/src/js/coresetup.js b/addons/web/static/src/js/coresetup.js index 24441dc509f..6ba62162e93 100644 --- a/addons/web/static/src/js/coresetup.js +++ b/addons/web/static/src/js/coresetup.js @@ -19,15 +19,14 @@ instance.web.OldWidget = instance.web.Widget.extend({ this._super(parent); this.element_id = element_id; this.element_id = this.element_id || _.uniqueId('widget-'); + var tmp = document.getElementById(this.element_id); - this.$element = tmp ? $(tmp) : $(document.createElement(this.tagName)); + this.setElement(tmp || this._make_descriptive()); }, renderElement: function() { var rendered = this.render(); if (rendered) { - var elem = $(rendered); - this.$element.replaceWith(elem); - this.$element = elem; + this.replaceElement($(rendered)); } return this; }, @@ -394,13 +393,13 @@ instance.web.Session = instance.web.JsonRPC.extend( /** @lends instance.web.Sess timer = setTimeout(waitLoop, CHECK_INTERVAL); }, synchronized_mode: function(to_execute) { - var synch = this.synch; - this.synch = true; - try { - return to_execute(); - } finally { - this.synch = synch; - } + var synch = this.synch; + this.synch = true; + try { + return to_execute(); + } finally { + this.synch = synch; + } } }); @@ -416,12 +415,12 @@ instance.web.Bus = instance.web.Class.extend(instance.web.EventDispatcherMixin, // check gtk bindings // http://unixpapa.com/js/key.html _.each('click,dblclick,keydown,keypress,keyup'.split(','), function(evtype) { - $('html').on(evtype, self, function(ev) { + $('html').on(evtype, function(ev) { self.trigger(evtype, ev); }); }); _.each('resize,scroll'.split(','), function(evtype) { - $(window).on(evtype, self, function(ev) { + $(window).on(evtype, function(ev) { self.trigger(evtype, ev); }); }); @@ -541,10 +540,10 @@ $.async_when = function() { // special tweak for the web client var old_async_when = $.async_when; $.async_when = function() { - if (instance.connection.synch) - return $.when.apply(this, arguments); - else - return old_async_when.apply(this, arguments); + if (instance.connection.synch) + return $.when.apply(this, arguments); + else + return old_async_when.apply(this, arguments); }; /** Setup blockui */ @@ -673,32 +672,6 @@ instance.connection.on('module_loaded', this, function () { */ instance.web.client_actions = new instance.web.Registry(); -/** - * Client action to reload the whole interface. - * If params has an entry 'menu_id', it opens the given menu entry. - */ -instance.web.Reload = instance.web.Widget.extend({ - init: function(parent, params) { - this._super(parent); - this.menu_id = (params && params.menu_id) || false; - }, - start: function() { - var l = window.location; - var timestamp = new Date().getTime(); - var search = "?ts=" + timestamp; - if (l.search) { - search = l.search + "&ts=" + timestamp; - } - var hash = l.hash; - if (this.menu_id) { - hash = "#menu_id=" + this.menu_id; - } - var url = l.protocol + "//" + l.host + l.pathname + search + hash; - window.location = url; - } -}); -instance.web.client_actions.add("reload", "instance.web.Reload"); - }; // vim:et fdc=0 fdl=0 foldnestmax=3 fdm=syntax: |
