BUGFIX: do not show PMs counters when the value is 0

This commit is contained in:
Régis Hanol 2014-05-03 00:40:57 +02:00
parent b6dd0cfb7d
commit 63c4f24319
2 changed files with 7 additions and 3 deletions

View File

@ -8,6 +8,10 @@
**/
Discourse.User = Discourse.Model.extend({
hasPMs: Em.computed.gt("private_messages_stats.all", 0),
hasStartedPMs: Em.computed.gt("private_messages_stats.mine", 0),
hasUnreadPMs: Em.computed.gt("private_messages_stats.unread", 0),
/**
The user's stream

View File

@ -31,21 +31,21 @@
<li {{bind-attr class=":noGlyph privateMessagesActive:active"}}>
{{#link-to 'userPrivateMessages.index' model}}
{{i18n user.messages.all}}
<span class='count'>({{private_messages_stats.all}})</span>
{{#if hasPMs}}<span class='count'>({{private_messages_stats.all}})</span>{{/if}}
<span class='fa fa-chevron-right'></span>
{{/link-to}}
</li>
<li {{bind-attr class=":noGlyph privateMessagesMineActive:active"}}>
{{#link-to 'userPrivateMessages.mine' model}}
{{i18n user.messages.mine}}
<span class='count'>({{private_messages_stats.mine}})</span>
{{#if hasStartedPMs}}<span class='count'>({{private_messages_stats.mine}})</span>{{/if}}
<span class='fa fa-chevron-right'></span>
{{/link-to}}
</li>
<li {{bind-attr class=":noGlyph privateMessagesUnreadActive:active"}}>
{{#link-to 'userPrivateMessages.unread' model}}
{{i18n user.messages.unread}}
<span class='count'>({{private_messages_stats.unread}})</span>
{{#if hasUnreadPMs}}<span class='count'>({{private_messages_stats.unread}})</span>{{/if}}
<span class='fa fa-chevron-right'></span>
{{/link-to}}
</li>