From a5a97f88cd9a44b3bd3c2450c1fa613b9cf7eb8b Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Tue, 12 Mar 2013 13:34:27 -0400 Subject: [PATCH] When editing a post, provide more information in the composer title --- .../javascripts/discourse/models/composer.js | 40 ++++++++++--------- config/locales/client.en.yml | 2 +- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/app/assets/javascripts/discourse/models/composer.js b/app/assets/javascripts/discourse/models/composer.js index 5f5ec67c75a..d531de812e5 100644 --- a/app/assets/javascripts/discourse/models/composer.js +++ b/app/assets/javascripts/discourse/models/composer.js @@ -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 = "" + - Em.String.i18n("post.post_number", { number: postNumber }) + ""; + Em.String.i18n("post.post_number", { number: postNumber }) + ""; } + + var replyAvatar, topicLink; + if (this.get('post')) { + replyAvatar = Discourse.Utilities.avatarImg({ + username: this.get('post.username'), + size: 'tiny' + }); + } else { + topicLink = " " + (Handlebars.Utils.escapeExpression(topic.get('title'))) + ""; + } + 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 = " " + (Handlebars.Utils.escapeExpression(topic.get('title'))) + ""; - 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() { diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index b0e51ceeb98..70241de4297 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -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"