mirror of
https://github.com/codeninjasllc/discourse.git
synced 2025-04-28 23:14:04 -04:00
When editing a post that is in reply to another post, show display meta data to that effect.
This commit is contained in:
parent
8e6a8eae66
commit
42c7a65a05
2 changed files with 23 additions and 14 deletions
app/assets/javascripts/discourse
|
@ -78,6 +78,10 @@ Discourse.Utilities = {
|
||||||
(extraClasses || "") + "' title='" + (Handlebars.Utils.escapeExpression(title || "")) + "'>";
|
(extraClasses || "") + "' title='" + (Handlebars.Utils.escapeExpression(title || "")) + "'>";
|
||||||
},
|
},
|
||||||
|
|
||||||
|
tinyAvatar: function(username) {
|
||||||
|
return Discourse.Utilities.avatarImg({ username: username, size: 'tiny' });
|
||||||
|
},
|
||||||
|
|
||||||
postUrl: function(slug, topicId, postNumber) {
|
postUrl: function(slug, topicId, postNumber) {
|
||||||
var url;
|
var url;
|
||||||
url = "/t/";
|
url = "/t/";
|
||||||
|
|
|
@ -112,12 +112,24 @@ Discourse.Composer = Discourse.Model.extend({
|
||||||
topicLink = "<a href='" + (topic.get('url')) + "'> " + (Handlebars.Utils.escapeExpression(topic.get('title'))) + "</a>";
|
topicLink = "<a href='" + (topic.get('url')) + "'> " + (Handlebars.Utils.escapeExpression(topic.get('title'))) + "</a>";
|
||||||
}
|
}
|
||||||
|
|
||||||
var replyAvatar;
|
var postDescription,
|
||||||
if (this.get('post')) {
|
post = this.get('post');
|
||||||
replyAvatar = Discourse.Utilities.avatarImg({
|
|
||||||
username: this.get('post.username'),
|
if (post) {
|
||||||
size: 'tiny'
|
|
||||||
|
postDescription = Em.String.i18n('post.' + this.get('action'), {
|
||||||
|
link: postLink,
|
||||||
|
replyAvatar: Discourse.Utilities.tinyAvatar(post.get('username')),
|
||||||
|
username: this.get('post.username')
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var replyUsername = post.get('reply_to_user.username');
|
||||||
|
if (replyUsername && this.get('action') === EDIT) {
|
||||||
|
postDescription += " " + Em.String.i18n("post.in_reply_to") + " " +
|
||||||
|
Discourse.Utilities.tinyAvatar(replyUsername) + " " + replyUsername;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (this.get('action')) {
|
switch (this.get('action')) {
|
||||||
|
@ -127,15 +139,8 @@ Discourse.Composer = Discourse.Model.extend({
|
||||||
return Em.String.i18n('topic.create_long');
|
return Em.String.i18n('topic.create_long');
|
||||||
case REPLY:
|
case REPLY:
|
||||||
case EDIT:
|
case EDIT:
|
||||||
if (replyAvatar) {
|
if (postDescription) return postDescription;
|
||||||
return Em.String.i18n('post.' + this.get('action'), {
|
if (topic) return Em.String.i18n('post.reply_topic', { link: topicLink });
|
||||||
link: postLink,
|
|
||||||
replyAvatar: replyAvatar,
|
|
||||||
username: this.get('post.username')
|
|
||||||
});
|
|
||||||
} else if (topic) {
|
|
||||||
return Em.String.i18n('post.reply_topic', { link: topicLink });
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}).property('action', 'post', 'topic', 'topic.title'),
|
}).property('action', 'post', 'topic', 'topic.title'),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue