ES6: User activity views
This commit is contained in:
parent
939e8505a9
commit
71c67c43a1
|
@ -1,11 +1 @@
|
||||||
/**
|
export default Ember.ObjectController.extend();
|
||||||
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']
|
|
||||||
});
|
|
||||||
|
|
|
@ -5,7 +5,8 @@ var deprecatedViewHelpers = {
|
||||||
userSelector: 'user-selector',
|
userSelector: 'user-selector',
|
||||||
combobox: 'combo-box',
|
combobox: 'combo-box',
|
||||||
categoryChooser: 'category-chooser',
|
categoryChooser: 'category-chooser',
|
||||||
chooseTopic: 'choose-topic'
|
chooseTopic: 'choose-topic',
|
||||||
|
'discourse-activity-filter': 'activity-filter'
|
||||||
};
|
};
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
|
@ -4,7 +4,8 @@ var helpers = ['input-tip',
|
||||||
'user-selector',
|
'user-selector',
|
||||||
'category-chooser',
|
'category-chooser',
|
||||||
'combo-box',
|
'combo-box',
|
||||||
'choose-topic'];
|
'choose-topic',
|
||||||
|
'activity-filter'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Creates view helpers for some views. Many of these should probably be converted
|
Creates view helpers for some views. Many of these should probably be converted
|
||||||
|
|
|
@ -9,9 +9,9 @@
|
||||||
<section class='user-navigation'>
|
<section class='user-navigation'>
|
||||||
|
|
||||||
<ul class='action-list nav-stacked'>
|
<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}}
|
{{#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}}
|
{{/each}}
|
||||||
{{#if showBadges}}
|
{{#if showBadges}}
|
||||||
{{#link-to 'user.badges' tagName="li"}}
|
{{#link-to 'user.badges' tagName="li"}}
|
||||||
|
|
|
@ -1,12 +1,4 @@
|
||||||
/**
|
export default Ember.Component.extend({
|
||||||
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({
|
|
||||||
tagName: 'li',
|
tagName: 'li',
|
||||||
classNameBindings: ['active', 'noGlyph'],
|
classNameBindings: ['active', 'noGlyph'],
|
||||||
|
|
||||||
|
@ -64,7 +56,4 @@ Discourse.ActivityFilterView = Ember.Component.extend({
|
||||||
case Discourse.UserAction.TYPES.starred: return "star";
|
case Discourse.UserAction.TYPES.starred: return "star";
|
||||||
}
|
}
|
||||||
}.property("content.action_type")
|
}.property("content.action_type")
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Discourse.View.registerHelper('discourse-activity-filter', Discourse.ActivityFilterView);
|
|
|
@ -1,17 +1,14 @@
|
||||||
/**
|
export default Ember.View.extend(Discourse.LoadMore, {
|
||||||
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, {
|
|
||||||
loading: false,
|
loading: false,
|
||||||
eyelineSelector: '.user-stream .item',
|
eyelineSelector: '.user-stream .item',
|
||||||
classNames: ['user-stream'],
|
classNames: ['user-stream'],
|
||||||
|
|
||||||
|
_scrollTopOnModelChange: function() {
|
||||||
|
Em.run.schedule('afterRender', function() {
|
||||||
|
$(document).scrollTop(0);
|
||||||
|
});
|
||||||
|
}.observes('controller.model.user.id'),
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
loadMore: function() {
|
loadMore: function() {
|
||||||
var self = this;
|
var self = this;
|
|
@ -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);
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue