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

@ -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() {