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'));
}.property('topicTrackingState.messageCount'),
totalTopicsTitle: function() {
return I18n.t('categories.total_topics', {count: this.get('topic_count')});
topicStatsTitle: function() {
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'),
totalPostsTitle: function() {
return I18n.t('categories.total_posts', {count: this.get('post_count')});
postStatsTitle: function() {
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'),
topicCountStats: function() {

View File

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

View File

@ -188,14 +188,20 @@ en:
all_subcategories: "all subcategories"
no_subcategory: "no subcategory"
category: "Category"
posts: "Posts"
topics: "Topics"
posts: "New Posts"
topics: "New Topics"
latest: "Latest"
latest_by: "latest by"
toggle_ordering: "toggle ordering control"
subcategories: "Subcategories:"
total_topics: "Total topics: %{count}"
total_posts: "Total posts: %{count}"
topic_stats: "The number of new topics."
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:
said: "{{username}} said:"