When editing a post, provide more information in the composer title

This commit is contained in:
Robin Ward 2013-03-12 13:34:27 -04:00
parent 1103dde5cd
commit a5a97f88cd
2 changed files with 22 additions and 20 deletions

View file

@ -102,41 +102,43 @@ Discourse.Composer = Discourse.Model.extend({
// Determine the appropriate title for this action
actionTitle: (function() {
var postLink, postNumber, replyAvatar, topic, topicLink;
topic = this.get('topic');
postNumber = this.get('post.post_number');
var topic = this.get('topic');
var postLink;
if (topic) {
var postNumber = this.get('post.post_number');
postLink = "<a href='" + (topic.get('url')) + "/" + postNumber + "'>" +
Em.String.i18n("post.post_number", { number: postNumber }) + "</a>";
Em.String.i18n("post.post_number", { number: postNumber }) + "</a>";
}
var replyAvatar, topicLink;
if (this.get('post')) {
replyAvatar = Discourse.Utilities.avatarImg({
username: this.get('post.username'),
size: 'tiny'
});
} else {
topicLink = "<a href='" + (topic.get('url')) + "'> " + (Handlebars.Utils.escapeExpression(topic.get('title'))) + "</a>";
}
switch (this.get('action')) {
case PRIVATE_MESSAGE:
return Em.String.i18n('topic.private_message');
case CREATE_TOPIC:
return Em.String.i18n('topic.create_long');
case REPLY:
if (this.get('post')) {
replyAvatar = Discourse.Utilities.avatarImg({
username: this.get('post.username'),
size: 'tiny'
});
return Em.String.i18n('post.reply', {
case EDIT:
if (replyAvatar) {
return Em.String.i18n('post.' + this.get('action'), {
link: postLink,
replyAvatar: replyAvatar,
username: this.get('post.username')
});
} else if (topic) {
topicLink = "<a href='" + (topic.get('url')) + "'> " + (Handlebars.Utils.escapeExpression(topic.get('title'))) + "</a>";
return Em.String.i18n('post.reply_topic', {
link: topicLink
});
return Em.String.i18n('post.reply_topic', { link: topicLink });
}
break;
case EDIT:
return Em.String.i18n('post.edit', {
link: postLink
});
}
}).property('action', 'post', 'topic', 'topic.title'),
toggleText: (function() {

View file

@ -515,7 +515,7 @@ en:
post:
reply: "Replying to {{link}} by {{replyAvatar}} {{username}}"
reply_topic: "Reply to {{link}}"
edit: "Edit {{link}}"
edit: "Editing {{link}} by {{replyAvatar}} {{username}}"
post_number: "post {{number}}"
in_reply_to: "in reply to"
reply_as_new_topic: "Reply as new Topic"