diff --git a/app/assets/javascripts/discourse/controllers/user_activity_controller.js b/app/assets/javascripts/discourse/controllers/user_activity_controller.js index 0328b7a1051..ff08f7ca8fe 100644 --- a/app/assets/javascripts/discourse/controllers/user_activity_controller.js +++ b/app/assets/javascripts/discourse/controllers/user_activity_controller.js @@ -35,30 +35,17 @@ Discourse.UserActivityRoute = Discourse.Route.extend({ } }); -/** - A route for showing a user's activity - - @class UserIndexRoute - @extends Discourse.Route - @namespace Discourse - @module Discourse -**/ Discourse.UserActivityIndexRoute = Discourse.Route.extend({ - privateMessageRoute: function() { - return (this.get('userActionType') === Discourse.UserAction.TYPES.messages_sent) || - (this.get('userActionType') === Discourse.UserAction.TYPES.messages_received); - }.property('userActionType'), - model: function() { return this.modelFor('user').findStream(this.get('userActionType')); }, - setupController: function(controller, model) { - this.controllerFor('userActivity').setProperties({ - model: this.modelFor('user'), - stream: model, - privateMessageView: this.get('privateMessageRoute') - }); + renderTemplate: function() { + this.render('user_stream', {into: 'user_activity', outlet: 'activity'}); + }, + + setupController: function() { + this.controllerFor('user_activity').set('userActionType', this.get('userActionType')); } }); @@ -69,35 +56,11 @@ Object.keys(Discourse.UserAction.TYPES).forEach(function (userAction) { }); }); -// Build the private message routes +// // Build the private message routes Discourse.UserPrivateMessagesRoute = Discourse.UserActivityRoute.extend({}); Discourse.UserPrivateMessagesIndexRoute = Discourse.UserActivityMessagesReceivedRoute; Discourse.UserPrivateMessagesSentRoute = Discourse.UserActivityMessagesSentRoute; - -/** - Show the user's default route - - @class UserIndexRoute - @extends Discourse.Route - @namespace Discourse - @module Discourse -**/ -Discourse.UserIndexRoute = Discourse.Route.extend({ - renderTemplate: function() { - this.render('user_activity', {into: 'user', outlet: 'userOutlet' }); - }, - - model: function() { - return this.modelFor('user').findStream(); - }, - - setupController: function(controller, stream) { - var userActivity = this.controllerFor('userActivity'); - userActivity.setProperties({ model: this.modelFor('user'), stream: stream }); - } -}); - /** This controller supports all actions on a user's activity stream @@ -109,6 +72,11 @@ Discourse.UserIndexRoute = Discourse.Route.extend({ Discourse.UserActivityController = Discourse.ObjectController.extend({ needs: ['composer'], + privateMessageView: function() { + return (this.get('userActionType') === Discourse.UserAction.TYPES.messages_sent) || + (this.get('userActionType') === Discourse.UserAction.TYPES.messages_received); + }.property('userActionType'), + composePrivateMessage: function() { return this.get('controllers.composer').open({ action: Discourse.Composer.PRIVATE_MESSAGE, diff --git a/app/assets/javascripts/discourse/templates/user/activity.js.handlebars b/app/assets/javascripts/discourse/templates/user/activity.js.handlebars index 9a844ef2ff6..691e1147716 100644 --- a/app/assets/javascripts/discourse/templates/user/activity.js.handlebars +++ b/app/assets/javascripts/discourse/templates/user/activity.js.handlebars @@ -58,4 +58,5 @@ -{{userStream stream=stream}} +{{outlet activity}} + diff --git a/app/assets/javascripts/discourse/views/user/activity_filter_view.js b/app/assets/javascripts/discourse/views/user/activity_filter_view.js index 7977d2ad6c3..a238f0d4273 100644 --- a/app/assets/javascripts/discourse/views/user/activity_filter_view.js +++ b/app/assets/javascripts/discourse/views/user/activity_filter_view.js @@ -1,5 +1,5 @@ /** - This view handles rendering of an activity in a user's stream + This view handles rendering of an activity in a user's profile @class ActivityFilterView @extends Discourse.View @@ -10,18 +10,18 @@ Discourse.ActivityFilterView = Discourse.View.extend({ tagName: 'li', classNameBindings: ['active', 'noGlyph'], - stream: Em.computed.alias('controller.stream'), + userActionType: Em.computed.alias('controller.userActionType'), shouldRerender: Discourse.View.renderIfChanged('count'), noGlyph: Em.computed.empty('icon'), active: function() { var content = this.get('content'); if (content) { - return parseInt(this.get('stream.filter'), 10) === parseInt(Em.get(content, 'action_type'), 10); + return parseInt(this.get('userActionType'), 10) === parseInt(Em.get(content, 'action_type'), 10); } else { - return this.blank('stream.filter'); + return this.blank('userActionType'); } - }.property('stream.filter', 'content.action_type'), + }.property('userActionType', 'content.action_type'), activityCount: function() { return this.get('content.count') || this.get('count'); diff --git a/app/assets/javascripts/discourse/views/user/user_stream_view.js b/app/assets/javascripts/discourse/views/user/user_stream_view.js index df790a3fb63..af0c6f0a24a 100644 --- a/app/assets/javascripts/discourse/views/user/user_stream_view.js +++ b/app/assets/javascripts/discourse/views/user/user_stream_view.js @@ -10,7 +10,7 @@ Discourse.UserStreamView = Ember.CollectionView.extend(Discourse.Scrolling, { loading: false, elementId: 'user-stream', - content: Em.computed.alias('controller.stream.content'), + content: Em.computed.alias('controller.model.content'), itemViewClass: Ember.View.extend({ templateName: 'user/stream_item' }), scrolled: function(e) {