Show post number in the share dialog
This commit is contained in:
parent
10547848f0
commit
2ea6a61a17
|
@ -13,6 +13,7 @@ Discourse.ShareController = Discourse.Controller.extend({
|
|||
// Close the share controller
|
||||
close: function() {
|
||||
this.set('link', '');
|
||||
this.set('postNumber', '');
|
||||
return false;
|
||||
},
|
||||
|
||||
|
|
|
@ -167,7 +167,8 @@ Discourse.PostMenuView = Discourse.View.extend({
|
|||
renderShare: function(post, buffer) {
|
||||
buffer.push("<button title=\"" +
|
||||
I18n.t("post.controls.share") +
|
||||
"\" data-share-url=\"" + post.get('shareUrl') + "\" class='share'><i class=\"icon-link\"></i></button>");
|
||||
"\" data-share-url=\"" + post.get('shareUrl') + "\" data-post-number=\"" + post.get('post_number') +
|
||||
"\" class='share'><i class=\"icon-link\"></i></button>");
|
||||
},
|
||||
|
||||
// Reply button
|
||||
|
|
|
@ -13,8 +13,8 @@ Discourse.ShareView = Discourse.View.extend({
|
|||
|
||||
title: function() {
|
||||
if (this.get('controller.type') === 'topic') return I18n.t('share.topic');
|
||||
return I18n.t('share.post');
|
||||
}.property('controller.type'),
|
||||
return I18n.t('share.post', {postNumber: this.get('controller.postNumber')});
|
||||
}.property('controller.type', 'controller.postNumber'),
|
||||
|
||||
hasLink: function() {
|
||||
if (this.present('controller.link')) return 'visible';
|
||||
|
@ -48,6 +48,7 @@ Discourse.ShareView = Discourse.View.extend({
|
|||
e.preventDefault();
|
||||
var $currentTarget = $(e.currentTarget);
|
||||
var url = $currentTarget.data('share-url');
|
||||
var postNumber = $currentTarget.data('post-number');
|
||||
// Relative urls
|
||||
|
||||
if (url.indexOf("/") === 0) {
|
||||
|
@ -64,6 +65,7 @@ Discourse.ShareView = Discourse.View.extend({
|
|||
top: "" + (e.pageY - 100) + "px"
|
||||
});
|
||||
shareView.set('controller.link', url);
|
||||
shareView.set('controller.postNumber', postNumber);
|
||||
return false;
|
||||
});
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ en:
|
|||
other: "%{count} days ago"
|
||||
share:
|
||||
topic: 'share a link to this topic'
|
||||
post: 'share a link to this post'
|
||||
post: 'share a link to post #%{postNumber}'
|
||||
close: 'close'
|
||||
twitter: 'share this link on Twitter'
|
||||
facebook: 'share this link on Facebook'
|
||||
|
|
Loading…
Reference in New Issue