ES6: User activity views

This commit is contained in:
Robin Ward 2014-07-16 13:19:47 -04:00
parent 939e8505a9
commit 71c67c43a1
7 changed files with 15 additions and 55 deletions

View File

@ -1,11 +1 @@
/**
This controller supports all actions on a user's activity stream
@class UserActivityController
@extends Discourse.Controller
@namespace Discourse
@module Discourse
**/
export default Discourse.ObjectController.extend({
needs: ['composer']
});
export default Ember.ObjectController.extend();

View File

@ -5,7 +5,8 @@ var deprecatedViewHelpers = {
userSelector: 'user-selector',
combobox: 'combo-box',
categoryChooser: 'category-chooser',
chooseTopic: 'choose-topic'
chooseTopic: 'choose-topic',
'discourse-activity-filter': 'activity-filter'
};
export default {

View File

@ -4,7 +4,8 @@ var helpers = ['input-tip',
'user-selector',
'category-chooser',
'combo-box',
'choose-topic'];
'choose-topic',
'activity-filter'];
/**
Creates view helpers for some views. Many of these should probably be converted

View File

@ -9,9 +9,9 @@
<section class='user-navigation'>
<ul class='action-list nav-stacked'>
{{discourse-activity-filter count=statsCountNonPM user=model userActionType=userActionType indexStream=indexStream}}
{{activity-filter count=statsCountNonPM user=model userActionType=userActionType indexStream=indexStream}}
{{#each stat in statsExcludingPms}}
{{discourse-activity-filter content=stat user=model userActionType=userActionType indexStream=indexStream}}
{{activity-filter content=stat user=model userActionType=userActionType indexStream=indexStream}}
{{/each}}
{{#if showBadges}}
{{#link-to 'user.badges' tagName="li"}}

View File

@ -1,12 +1,4 @@
/**
This view handles rendering of an activity in a user's profile
@class ActivityFilterView
@extends Ember.Component
@namespace Discourse
@module Discourse
**/
Discourse.ActivityFilterView = Ember.Component.extend({
export default Ember.Component.extend({
tagName: 'li',
classNameBindings: ['active', 'noGlyph'],
@ -64,7 +56,4 @@ Discourse.ActivityFilterView = Ember.Component.extend({
case Discourse.UserAction.TYPES.starred: return "star";
}
}.property("content.action_type")
});
Discourse.View.registerHelper('discourse-activity-filter', Discourse.ActivityFilterView);

View File

@ -1,17 +1,14 @@
/**
This view handles rendering of a user's stream
@class UserStreamView
@extends Discourse.View
@namespace Discourse
@uses Discourse.LoadMore
@module Discourse
**/
Discourse.UserStreamView = Discourse.View.extend(Discourse.LoadMore, {
export default Ember.View.extend(Discourse.LoadMore, {
loading: false,
eyelineSelector: '.user-stream .item',
classNames: ['user-stream'],
_scrollTopOnModelChange: function() {
Em.run.schedule('afterRender', function() {
$(document).scrollTop(0);
});
}.observes('controller.model.user.id'),
actions: {
loadMore: function() {
var self = this;

View File

@ -1,18 +0,0 @@
/**
This view handles rendering of a user's activity stream
@class UserActivityView
@extends Discourse.View
@namespace Discourse
@module Discourse
**/
Discourse.UserActivityView = Discourse.View.extend({
userBinding: 'controller.content',
didInsertElement: function() {
window.scrollTo(0, 0);
}
});