diff options
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(); + }, + }); + +})(); |
