From a44fd6f2df30eab23139824e4971cfaa6ebd16bd Mon Sep 17 00:00:00 2001 From: Nikunj Ladava Date: Wed, 7 Mar 2018 09:10:04 +0100 Subject: [PATCH] [FIX] web_settings_dashboard: no redirect on social button click Before this commit, when we click on social tags in the Settings, it opens a pop-up while redirecting to the home page in the main window. The redirection is not intended. This is caused by href="#", which purpose is to show the pointer cursor when hovering on the links. The issue is that href="#" redirects to the index page on click, which is the home page. This commit keeps the href while cancelling the redirection on click in the main window. --- .../static/src/js/dashboard.js | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/addons/web_settings_dashboard/static/src/js/dashboard.js b/addons/web_settings_dashboard/static/src/js/dashboard.js index 8a4af041b20..acdf61a4c68 100644 --- a/addons/web_settings_dashboard/static/src/js/dashboard.js +++ b/addons/web_settings_dashboard/static/src/js/dashboard.js @@ -193,29 +193,40 @@ var DashboardShare = Widget.extend({ 'click .li_share': 'share_linkedin', }, - init: function(parent, data){ + init: function (parent, data) { this.data = data; this.parent = parent; this.share_url = 'https://www.odoo.com'; this.share_text = encodeURIComponent("I am using #Odoo - Awesome open source business apps."); }, - share_twitter: function(){ + /** + * @param {MouseEvent} ev + */ + share_twitter: function (ev) { + ev.preventDefault(); var popup_url = _.str.sprintf( 'https://twitter.com/intent/tweet?tw_p=tweetbutton&text=%s %s',this.share_text,this.share_url); this.sharer(popup_url); }, - - share_facebook: function(){ + /** + * @param {MouseEvent} ev + */ + share_facebook: function (ev) { + ev.preventDefault(); var popup_url = _.str.sprintf('https://www.facebook.com/sharer/sharer.php?u=%s', encodeURIComponent(this.share_url)); this.sharer(popup_url); }, - share_linkedin: function(){ + /** + * @param {MouseEvent} ev + */ + share_linkedin: function (ev) { + ev.preventDefault(); var popup_url = _.str.sprintf('http://www.linkedin.com/shareArticle?mini=true&url=%s&title=I am using odoo&summary=%s&source=www.odoo.com', encodeURIComponent(this.share_url), this.share_text); this.sharer(popup_url); }, - sharer: function(popup_url){ + sharer: function (popup_url) { window.open( popup_url, 'Share Dialog',