Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow social sharing to specify if a new window is opened #4409

Merged
merged 1 commit into from
Apr 20, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions core/js/sharedialoglinkshareview.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
'</li>' +
'{{#each social}}' +
'<li>' +
'<a href="#" class="shareOption menuitem pop-up" data-url="{{url}}">' +
'<a href="#" class="shareOption menuitem pop-up" data-url="{{url}}" data-window="{{newWindow}}">' +
'<span class="icon {{iconClass}}"' +
'></span><span>{{label}}' +
'</span>' +
Expand Down Expand Up @@ -424,7 +424,8 @@
url: url,
label: t('core', 'Share to {name}', {name: model.get('name')}),
name: model.get('name'),
iconClass: model.get('iconClass')
iconClass: model.get('iconClass'),
newWindow: model.get('newWindow')
});
});

Expand Down Expand Up @@ -515,14 +516,19 @@
event.stopPropagation();

var url = $(event.currentTarget).data('url');
var newWindow = $(event.currentTarget).data('window');
$(event.currentTarget).tooltip('hide');
if (url) {
var width = 600;
var height = 400;
var left = (screen.width/2)-(width/2);
var top = (screen.height/2)-(height/2);
if (newWindow === true) {
var width = 600;
var height = 400;
var left = (screen.width / 2) - (width / 2);
var top = (screen.height / 2) - (height / 2);

window.open(url, 'name', 'width=' + width + ', height=' + height + ', top=' + top + ', left=' + left);
window.open(url, 'name', 'width=' + width + ', height=' + height + ', top=' + top + ', left=' + left);
} else {
window.location.href = url;
}
}
}

Expand Down
4 changes: 3 additions & 1 deletion core/js/sharesocialmanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@
/** Name to show in the tooltip */
name: null,
/** Icon class to display */
iconClass: null
iconClass: null,
/** Open in new windows */
newWindow: true
}
});

Expand Down