Add counts to new / unread in hamburger
This commit is contained in:
parent
035e263356
commit
531ab65ccf
|
@ -58,7 +58,8 @@ export default Ember.Component.extend({
|
|||
if (label) {
|
||||
if (icon) { buffer.push(" "); }
|
||||
|
||||
buffer.push(I18n.t(label));
|
||||
const count = this.get('count');
|
||||
buffer.push(I18n.t(label, { count }));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,26 @@ export default Ember.Component.extend({
|
|||
return this.siteSettings.faq_url ? this.siteSettings.faq_url : Discourse.getURL('/faq');
|
||||
},
|
||||
|
||||
@computed()
|
||||
topicTrackingState() {
|
||||
return Discourse.TopicTrackingState.current();
|
||||
},
|
||||
|
||||
_lookupCount(type) {
|
||||
const state = this.get('topicTrackingState');
|
||||
return state ? state.lookupCount(type) : 0;
|
||||
},
|
||||
|
||||
@computed('topicTrackingState.messageCount')
|
||||
newCount() {
|
||||
return this._lookupCount('new');
|
||||
},
|
||||
|
||||
@computed('topicTrackingState.messageCount')
|
||||
unreadCount() {
|
||||
return this._lookupCount('unread');
|
||||
},
|
||||
|
||||
@computed()
|
||||
categories() {
|
||||
const hideUncategorized = !this.siteSettings.allow_uncategorized_topics;
|
||||
|
|
|
@ -31,8 +31,12 @@
|
|||
<li>{{d-link route="discovery.latest" class="latest-topics-link" label="filters.latest.title.zero"}}</li>
|
||||
|
||||
{{#if currentUser}}
|
||||
<li>{{d-link route="discovery.new" class="new-topics-link" label="filters.new.title.zero"}}</li>
|
||||
<li>{{d-link route="discovery.unread" class="unread-topics-link" label="filters.unread.title.zero"}}</li>
|
||||
<li>
|
||||
{{d-link route="discovery.new" class="new-topics-link" label="filters.new.title" count=newCount}}
|
||||
</li>
|
||||
<li>
|
||||
{{d-link route="discovery.unread" class="unread-topics-link" label="filters.unread.title" count=unreadCount}}
|
||||
</li>
|
||||
{{/if}}
|
||||
<li>{{d-link route="discovery.top" class="top-topics-link" label="filters.top.title"}}</li>
|
||||
|
||||
|
|
Loading…
Reference in New Issue