Improve tooltip on categories stats.

This commit is contained in:
Neil Lalonde 2013-12-17 17:12:35 -05:00
parent 47c6bb4cf2
commit 39a360f6e3
3 changed files with 24 additions and 10 deletions

View File

@ -136,12 +136,20 @@ Discourse.Category = Discourse.Model.extend({
return this.get('topicTrackingState').countNew(this.get('name')); return this.get('topicTrackingState').countNew(this.get('name'));
}.property('topicTrackingState.messageCount'), }.property('topicTrackingState.messageCount'),
totalTopicsTitle: function() { topicStatsTitle: function() {
return I18n.t('categories.total_topics', {count: this.get('topic_count')}); var string = I18n.t('categories.topic_stats');
_.each(this.get('topicCountStats'), function(stat) {
string += ' ' + I18n.t('categories.topic_stat_sentence', {count: stat.value, unit: stat.unit});
}, this);
return string;
}.property('post_count'), }.property('post_count'),
totalPostsTitle: function() { postStatsTitle: function() {
return I18n.t('categories.total_posts', {count: this.get('post_count')}); var string = I18n.t('categories.post_stats');
_.each(this.get('postCountStats'), function(stat) {
string += ' ' + I18n.t('categories.post_stat_sentence', {count: stat.value, unit: stat.unit});
}, this);
return string;
}.property('post_count'), }.property('post_count'),
topicCountStats: function() { topicCountStats: function() {

View File

@ -79,7 +79,7 @@
</div> </div>
{{/each}} {{/each}}
</td> </td>
<td class='stats' {{bindAttr title="totalTopicsTitle"}}> <td class='stats' {{bindAttr title="topicStatsTitle"}}>
<table class="categoryStats"> <table class="categoryStats">
{{#each topicCountStats}} {{#each topicCountStats}}
<tr> <tr>
@ -89,7 +89,7 @@
{{/each}} {{/each}}
</table> </table>
</td> </td>
<td class='stats' {{bindAttr title="totalPostsTitle"}}> <td class='stats' {{bindAttr title="postStatsTitle"}}>
<table class="categoryStats"> <table class="categoryStats">
{{#each postCountStats}} {{#each postCountStats}}
<tr> <tr>

View File

@ -188,14 +188,20 @@ en:
all_subcategories: "all subcategories" all_subcategories: "all subcategories"
no_subcategory: "no subcategory" no_subcategory: "no subcategory"
category: "Category" category: "Category"
posts: "Posts" posts: "New Posts"
topics: "Topics" topics: "New Topics"
latest: "Latest" latest: "Latest"
latest_by: "latest by" latest_by: "latest by"
toggle_ordering: "toggle ordering control" toggle_ordering: "toggle ordering control"
subcategories: "Subcategories:" subcategories: "Subcategories:"
total_topics: "Total topics: %{count}" topic_stats: "The number of new topics."
total_posts: "Total posts: %{count}" topic_stat_sentence:
one: "%{count} new topic in the past %{unit}."
other: "%{count} new topics in the past %{unit}."
post_stats: "The number of new posts."
post_stat_sentence:
one: "%{count} new post in the past %{unit}."
other: "%{count} new posts in the past %{unit}."
user: user:
said: "{{username}} said:" said: "{{username}} said:"