diff options
| author | mge-odoo <mge@odoo.com> | 2015-03-20 17:03:40 +0100 |
|---|---|---|
| committer | Géry Debongnie <ged@odoo.com> | 2015-03-23 11:09:40 +0100 |
| commit | f39fc0926708a03f3b8b458cd281ec5d97b43fd6 (patch) | |
| tree | 945637c44c376012b744d4be0aa133a060d37425 /addons/web/static | |
| parent | 62100da9d39f385c929763544c5297ae461e4054 (diff) | |
[ADD] web: generic widget with iframe
Diffstat (limited to 'addons/web/static')
| -rw-r--r-- | addons/web/static/src/js/framework/misc.js | 43 |
1 files changed, 40 insertions, 3 deletions
diff --git a/addons/web/static/src/js/framework/misc.js b/addons/web/static/src/js/framework/misc.js index a24c64e5a66..300dabd4d87 100644 --- a/addons/web/static/src/js/framework/misc.js +++ b/addons/web/static/src/js/framework/misc.js @@ -204,6 +204,7 @@ function ReloadContext (parent, action) { } core.action_registry.add("reload_context", ReloadContext); + // nvd3 customization //------------------------------------------------------------------------- if ('nv' in window) { @@ -322,9 +323,6 @@ $.extend( proto, { } }); - - - return { blockUI: blockUI, unblockUI: unblockUI, @@ -339,3 +337,42 @@ odoo.define('web.session', function (require) { return new Session(undefined, undefined, {modules:modules}); }); +odoo.define('web.IFrameWidget', function (require) { +"use strict"; + +var Widget = require('web.Widget'); + +/** + * Generic widget to create an iframe that listens for clicks + * + * It should be extended by overwritting the methods: + * init: function(parent) { + * this._super(parent, <url_of_iframe> + * }, + * iframe_clicked: function(e){ + * filter the clicks you want to use and apply + * an action on it + * } + */ +var IFrameWidget = Widget.extend({ + tagName: 'iframe', + init: function(parent, url) { + this._super(parent); + this.url = url; + }, + start: function() { + this.$el.css({height: '100%', width: '100%', border: 0}); + this.$el.attr({src: this.url}); + this.$el.on("load", this.bind_events.bind(this)); + return this._super(); + }, + bind_events: function(){ + this.$el.contents().click(this.iframe_clicked.bind(this)); + }, + iframe_clicked: function(e){ + } +}); + +return IFrameWidget; + +}); |
