diff options
| author | Thibault Delavallée <tde@openerp.com> | 2012-06-21 10:16:13 +0200 |
|---|---|---|
| committer | Thibault Delavallée <tde@openerp.com> | 2012-06-21 10:16:13 +0200 |
| commit | cefce78cb664e1285dfcabe3702bc5aa1b40925f (patch) | |
| tree | 59215bfe4b4a06c0858890c4eaa345310201ef3d /addons/web/static/src/js/coresetup.js | |
| parent | 896fd9fdf90470b84b106e6c76463966f39afc9d (diff) | |
| parent | da7c964068ed317f94f2e55624b94388583c861c (diff) | |
[MERGE] Merged with main web.
bzr revid: tde@openerp.com-20120611083449-fjcy5injx0wydrlm
bzr revid: tde@openerp.com-20120612074745-zmfq9i0h3gcqz2z1
bzr revid: tde@openerp.com-20120613153033-8yhiis0mk7a91rfu
bzr revid: tde@openerp.com-20120614083859-eo4gpuvxuqhw9ob1
bzr revid: tde@openerp.com-20120615081833-tyv0wl56wcppwstp
bzr revid: tde@openerp.com-20120618075747-tvealk8do8h1sigb
bzr revid: tde@openerp.com-20120619073535-rgleb9j9g5xy2xeg
bzr revid: tde@openerp.com-20120620073852-xatt6u4855i5g681
bzr revid: tde@openerp.com-20120621081613-hfu05ia738euiarr
Diffstat (limited to 'addons/web/static/src/js/coresetup.js')
| -rw-r--r-- | addons/web/static/src/js/coresetup.js | 38 |
1 files changed, 33 insertions, 5 deletions
diff --git a/addons/web/static/src/js/coresetup.js b/addons/web/static/src/js/coresetup.js index 4defde54a3c..9b40b62e825 100644 --- a/addons/web/static/src/js/coresetup.js +++ b/addons/web/static/src/js/coresetup.js @@ -400,6 +400,29 @@ instance.web.Session = instance.web.JsonRPC.extend( /** @lends instance.web.Sess } }); +/** + * Event Bus used to bind events scoped in the current instance + */ +instance.web.bus = new (instance.web.Class.extend(instance.web.EventDispatcherMixin, { + init: function() { + instance.web.EventDispatcherMixin.init.call(this, parent); + var self = this; + // TODO fme: allow user to bind keys for some global actions. + // check gtk bindings + // http://unixpapa.com/js/key.html + _.each('click,dblclick,keydown,keypress,keyup'.split(','), function(evtype) { + $('html').on(evtype, self, function(ev) { + self.trigger(evtype, ev); + }); + }); + _.each('resize,scroll'.split(','), function(evtype) { + $(window).on(evtype, self, function(ev) { + self.trigger(evtype, ev); + }); + }); + } +}))(); + /** OpenERP Translations */ instance.web.TranslationDataBase = instance.web.Class.extend(/** @lends instance.web.TranslationDataBase# */{ /** @@ -597,13 +620,18 @@ instance.web.Reload = instance.web.Widget.extend({ 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) { - // open the given menu id - var url_without_fragment = window.location.toString().split("#", 1)[0]; - window.location = url_without_fragment + "#menu_id=" + this.menu_id; - } else { - window.location.reload(); + hash = "#menu_id=" + this.menu_id; } + var url = l.protocol + "//" + l.host + l.pathname + search + hash; + window.location = url; } }); |
