mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 11:13:22 +08:00
FIX: After sharing links and navigating long topics sometimes you'd have a lot of blank space.
This commit is contained in:
parent
3d7e46b42a
commit
7546a29d10
|
@ -10,21 +10,6 @@ Discourse.ShareController = Discourse.Controller.extend({
|
|||
|
||||
needs: ['topic'],
|
||||
|
||||
// When the user clicks the post number, we pop up a share box
|
||||
shareLink: function(e, url) {
|
||||
var x;
|
||||
x = e.pageX - 150;
|
||||
if (x < 25) {
|
||||
x = 25;
|
||||
}
|
||||
$('#share-link').css({
|
||||
left: "" + x + "px",
|
||||
top: "" + (e.pageY - 100) + "px"
|
||||
});
|
||||
this.set('link', url);
|
||||
return false;
|
||||
},
|
||||
|
||||
// Close the share controller
|
||||
close: function() {
|
||||
this.set('link', '');
|
||||
|
|
|
@ -13,9 +13,7 @@ Discourse.ShareLink = Discourse.Model.extend({
|
|||
return Discourse.ShareLink.urlFor(this.get('target'), this.get('link'), this.get('topicTitle'));
|
||||
}.property('target', 'link', 'topicTitle'),
|
||||
|
||||
title: function() {
|
||||
return I18n.t("share." + this.get('target'));
|
||||
}.property('target'),
|
||||
title: Discourse.computed.i18n('target', 'share.%@'),
|
||||
|
||||
iconClass: function() {
|
||||
return Discourse.ShareLink.iconClasses[this.get('target')];
|
||||
|
|
|
@ -166,7 +166,7 @@ Discourse.PostMenuView = Discourse.View.extend({
|
|||
// Share button
|
||||
renderShare: function(post, buffer) {
|
||||
buffer.push("<button title=\"" +
|
||||
(I18n.t("post.controls.share")) +
|
||||
I18n.t("post.controls.share") +
|
||||
"\" data-share-url=\"" + post.get('shareUrl') + "\" class='share'><i class=\"icon-link\"></i></button>");
|
||||
},
|
||||
|
||||
|
|
|
@ -30,6 +30,8 @@ Discourse.ShareView = Discourse.View.extend({
|
|||
window.setTimeout(function() {
|
||||
$linkInput.select().focus();
|
||||
}, 160);
|
||||
} else {
|
||||
$('#share-link').css('top', 0);
|
||||
}
|
||||
}.observes('controller.link'),
|
||||
|
||||
|
@ -53,7 +55,17 @@ Discourse.ShareView = Discourse.View.extend({
|
|||
if (url.indexOf("/") === 0) {
|
||||
url = window.location.protocol + "//" + window.location.host + url;
|
||||
}
|
||||
shareView.get('controller').shareLink(e, url);
|
||||
|
||||
var x = e.pageX - 150;
|
||||
if (x < 25) {
|
||||
x = 25;
|
||||
}
|
||||
|
||||
$('#share-link').css({
|
||||
left: "" + x + "px",
|
||||
top: "" + (e.pageY - 100) + "px"
|
||||
});
|
||||
shareView.set('controller.link', url);
|
||||
return false;
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user