diff --git a/ember/app/views/user.js b/ember/app/views/user.js
index e0f7f18bb..61f8e45f9 100644
--- a/ember/app/views/user.js
+++ b/ember/app/views/user.js
@@ -31,25 +31,28 @@ export default Ember.View.extend(HasItemLists, {
},
populateNav: function(items) {
- items.pushObjectWithTag(NavItem.extend({
+ var HasUser = Ember.Mixin.create({
+ parentController: this.get('controller'),
+ user: Ember.computed.alias('parentController.model')
+ });
+
+ items.pushObjectWithTag(NavItem.extend(HasUser, {
label: 'Activity',
icon: 'user',
layout: precompileTemplate('{{#link-to "user.activity" (query-params filter="")}}{{fa-icon icon}} {{label}}{{/link-to}}')
}), 'activity');
- items.pushObjectWithTag(NavItem.extend({
+ items.pushObjectWithTag(NavItem.extend(HasUser, {
label: 'Discussions',
icon: 'reorder',
- badge: Ember.computed.alias('controller.model.discussionsCount'),
- controller: this.get('controller'),
+ badge: Ember.computed.alias('user.discussionsCount'),
layout: precompileTemplate('{{#link-to "user.activity" (query-params filter="discussions")}}{{fa-icon icon}} {{label}} {{badge}}{{/link-to}}')
}), 'discussions');
- items.pushObjectWithTag(NavItem.extend({
+ items.pushObjectWithTag(NavItem.extend(HasUser, {
label: 'Posts',
icon: 'comment-o',
- badge: Ember.computed.alias('controller.model.commentsCount'),
- controller: this.get('controller'),
+ badge: Ember.computed.alias('parentController.model.commentsCount'),
layout: precompileTemplate('{{#link-to "user.activity" (query-params filter="posts")}}{{fa-icon icon}} {{label}} {{badge}}{{/link-to}}')
}), 'posts');