correct count 0 on user filters

This commit is contained in:
Sam 2013-04-08 10:42:18 +10:00
parent 3d3b589b4d
commit fd31f946ee
2 changed files with 18 additions and 10 deletions

View File

@ -1,5 +1,5 @@
<div id='user-info'>
<div id='user-info'>
<nav class='buttons'>
{{#if content.can_edit}}
{{#linkTo "preferences" class="btn"}}{{i18n user.edit}}{{/linkTo}}
@ -13,7 +13,7 @@
{{/if}}
</nav>
<div class='clearfix'></div>
<ul class='action-list nav-stacked side-nav'>
{{view Discourse.ActivityFilterView countBinding="statsCountNonPM"}}
{{#each statsExcludingPms}}
@ -47,7 +47,7 @@
<button class='btn' data-not-implemented='true' disabled title="{{i18n not_implemented}}">{{i18n user.download_archive}}</button>
</div>
{{/if}}
</div>

View File

@ -10,25 +10,33 @@ Discourse.ActivityFilterView = Discourse.View.extend({
tagName: 'li',
classNameBindings: ['active'],
active: (function() {
var content;
if (content = this.get('content')) {
countChanged: function(){
this.rerender();
}.observes('count'),
active: function() {
var content = this.get('content');
if (content) {
return parseInt(this.get('controller.content.streamFilter'), 10) === parseInt(Em.get(content, 'action_type'), 10);
} else {
return this.blank('controller.content.streamFilter');
}
}).property('controller.content.streamFilter', 'content.action_type'),
}.property('controller.content.streamFilter', 'content.action_type'),
render: function(buffer) {
var content, count, description;
if (content = this.get('content')) {
var content = this.get('content');
var count, description;
if (content) {
count = Em.get(content, 'count');
description = Em.get(content, 'description');
} else {
count = this.get('count');
description = Em.String.i18n("user.filters.all");
}
return buffer.push("<a href='#'>" + description + " <span class='count'>(" + count + ")</span><span class='icon-chevron-right'></span></a>");
buffer.push("<a href='#'>" + description +
" <span class='count'>(" + count + ")</span><span class='icon-chevron-right'></span></a>");
},
click: function() {