diff options
| author | Thibault Delavallée <tde@openerp.com> | 2014-04-11 15:40:52 +0200 |
|---|---|---|
| committer | Thibault Delavallée <tde@openerp.com> | 2014-04-11 15:40:52 +0200 |
| commit | e51049e8edcf34bfbbdf060145acffc82dc18a62 (patch) | |
| tree | b58244aa2b6ce7804c28d8f0b5ad3eba49cccbb8 /addons/website_twitter/static/src/js/website.twitter.editor.js | |
| parent | cd4afee17e77d5d5de8dc27f7dbe56be6d8fe7a2 (diff) | |
| parent | d04ee666ccb0c35bd1c13d9814fdb52f1159e7e9 (diff) | |
[MERGE] Sync with upstream
bzr revid: tde@openerp.com-20140411134052-x74otuwuxoz20qab
Diffstat (limited to 'addons/website_twitter/static/src/js/website.twitter.editor.js')
| -rw-r--r-- | addons/website_twitter/static/src/js/website.twitter.editor.js | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/addons/website_twitter/static/src/js/website.twitter.editor.js b/addons/website_twitter/static/src/js/website.twitter.editor.js new file mode 100644 index 00000000000..69a1896695a --- /dev/null +++ b/addons/website_twitter/static/src/js/website.twitter.editor.js @@ -0,0 +1,51 @@ +(function () { + 'use strict'; + var website = openerp.website, + qweb = openerp.qweb; + + website.snippet.options["twitter"] = website.snippet.options.marginAndResize.extend({ + start: function(){ + this._super(); + this.make_hover_config(); + this.$target.find('.lnk_configure').click(function(e){ + window.location = e.target.href; + }); + if (this.$target.data("snippet-view")) { + this.$target.data("snippet-view").stop(); + } + }, + twitter_reload: function(){ + openerp.jsonRpc('/twitter_reload','call', {}); + }, + make_hover_config: function(){ + var self = this; + var $configuration = $(qweb.render("website.Twitter.Reload")).hide().appendTo(document.body).click(function (e) { + e.preventDefault(); + e.stopPropagation(); + self.twitter_reload(); + }); + this.$target.on('mouseover', '', function () { + var $selected = $(this); + var position = $selected.offset(); + $configuration.show().offset({ + top: $selected.outerHeight() / 2 + + position.top + - $configuration.outerHeight() / 2, + left: $selected.outerWidth() / 2 + + position.left + - $configuration.outerWidth() / 2, + }) + }).on('mouseleave', '', function (e) { + var current = document.elementFromPoint(e.clientX, e.clientY); + if (current === $configuration[0]) { + return; + } + $configuration.hide(); + }); + }, + clean_for_save: function () { + this.$target.find(".twitter_timeline").empty(); + }, + }); + +})(); |
