NEWSBLUR.Views.UnreadCount = Backbone.View.extend({ className: 'feed_counts_floater', initialize: function() { _.bindAll(this, 'render'); if (!this.options.stale) { if (this.model) { this.model.bind('change:ps', this.render); this.model.bind('change:nt', this.render); this.model.bind('change:ng', this.render); } else if (this.collection) { this.collection.bind('change:counts', this.render); } } }, // ========== // = Render = // ========== render: function() { var unread_class = ""; var counts; if (this.model) { counts = this.model.unread_counts(); } else if (this.collection) { counts = this.collection.unread_counts(); } if (counts['ps']) { unread_class += ' unread_positive'; } if (counts['nt']) { unread_class += ' unread_neutral'; } if (counts['ng']) { unread_class += ' unread_negative'; } this.$el.html(this.template({ ps : counts['ps'], nt : counts['nt'], ng : counts['ng'], unread_class : unread_class })); return this; }, template: _.template('\