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
app/assets/javascripts/discourse/models
config/locales

View file

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

View file

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