summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikunj Ladava <nla@odoo.com>2018-03-07 09:10:04 +0100
committerAlexandre Kühn <aku@odoo.com>2018-03-07 09:35:15 +0100
commita44fd6f2df30eab23139824e4971cfaa6ebd16bd (patch)
tree441ceb6e05efad188311c13b09a3925367ffae84
parent97bdc14bce69e64f06f5f73b4556b7e6fca62f95 (diff)
[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.
-rw-r--r--addons/web_settings_dashboard/static/src/js/dashboard.js23
1 files 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',