Minor ES6 tweaks

This commit is contained in:
Robin Ward 2015-02-18 14:21:36 -05:00
parent 0fca0e9758
commit fed9943d90
3 changed files with 8 additions and 9 deletions

View File

@ -5,7 +5,7 @@ export default Ember.ArrayController.extend({
adminActiveFlagsView: Em.computed.equal("query", "active"),
actions: {
disagreeFlags: function (flaggedPost) {
disagreeFlags(flaggedPost) {
var self = this;
flaggedPost.disagreeFlags().then(function () {
self.removeObject(flaggedPost);
@ -14,7 +14,7 @@ export default Ember.ArrayController.extend({
});
},
deferFlags: function (flaggedPost) {
deferFlags(flaggedPost) {
var self = this;
flaggedPost.deferFlags().then(function () {
self.removeObject(flaggedPost);
@ -23,12 +23,12 @@ export default Ember.ArrayController.extend({
});
},
doneTopicFlags: function(item) {
doneTopicFlags(item) {
this.send("disagreeFlags", item);
},
},
loadMore: function(){
loadMore(){
var flags = this.get("model");
return Discourse.FlaggedPost.findAll(this.get("query"),flags.length+1).then(function(data){
if(data.length===0){

View File

@ -174,7 +174,7 @@ var controllerOpts = {
});
}.property('allLoaded', 'topics.length'),
loadMoreTopics: function() {
loadMoreTopics() {
return this.get('model').loadMore();
}
};

View File

@ -5,7 +5,7 @@ export default Discourse.View.extend(LoadMore, UrlRefresh, {
eyelineSelector: '.topic-list-item',
actions: {
loadMore: function() {
loadMore() {
var self = this;
Discourse.notifyTitle(0);
this.get('controller').loadMoreTopics().then(function (hasMoreResults) {
@ -34,14 +34,13 @@ export default Discourse.View.extend(LoadMore, UrlRefresh, {
}.observes('controller.topicTrackingState.incomingCount'),
// Remember where we were scrolled to
saveScrollPosition: function() {
saveScrollPosition() {
this.session.set('topicListScrollPosition', $(window).scrollTop());
},
// When the topic list is scrolled
scrolled: function() {
scrolled() {
this._super();
this.saveScrollPosition();
}
});