Minor ES6 tweaks
This commit is contained in:
parent
0fca0e9758
commit
fed9943d90
|
@ -5,7 +5,7 @@ export default Ember.ArrayController.extend({
|
||||||
adminActiveFlagsView: Em.computed.equal("query", "active"),
|
adminActiveFlagsView: Em.computed.equal("query", "active"),
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
disagreeFlags: function (flaggedPost) {
|
disagreeFlags(flaggedPost) {
|
||||||
var self = this;
|
var self = this;
|
||||||
flaggedPost.disagreeFlags().then(function () {
|
flaggedPost.disagreeFlags().then(function () {
|
||||||
self.removeObject(flaggedPost);
|
self.removeObject(flaggedPost);
|
||||||
|
@ -14,7 +14,7 @@ export default Ember.ArrayController.extend({
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
deferFlags: function (flaggedPost) {
|
deferFlags(flaggedPost) {
|
||||||
var self = this;
|
var self = this;
|
||||||
flaggedPost.deferFlags().then(function () {
|
flaggedPost.deferFlags().then(function () {
|
||||||
self.removeObject(flaggedPost);
|
self.removeObject(flaggedPost);
|
||||||
|
@ -23,12 +23,12 @@ export default Ember.ArrayController.extend({
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
doneTopicFlags: function(item) {
|
doneTopicFlags(item) {
|
||||||
this.send("disagreeFlags", item);
|
this.send("disagreeFlags", item);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
loadMore: function(){
|
loadMore(){
|
||||||
var flags = this.get("model");
|
var flags = this.get("model");
|
||||||
return Discourse.FlaggedPost.findAll(this.get("query"),flags.length+1).then(function(data){
|
return Discourse.FlaggedPost.findAll(this.get("query"),flags.length+1).then(function(data){
|
||||||
if(data.length===0){
|
if(data.length===0){
|
||||||
|
|
|
@ -174,7 +174,7 @@ var controllerOpts = {
|
||||||
});
|
});
|
||||||
}.property('allLoaded', 'topics.length'),
|
}.property('allLoaded', 'topics.length'),
|
||||||
|
|
||||||
loadMoreTopics: function() {
|
loadMoreTopics() {
|
||||||
return this.get('model').loadMore();
|
return this.get('model').loadMore();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -5,7 +5,7 @@ export default Discourse.View.extend(LoadMore, UrlRefresh, {
|
||||||
eyelineSelector: '.topic-list-item',
|
eyelineSelector: '.topic-list-item',
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
loadMore: function() {
|
loadMore() {
|
||||||
var self = this;
|
var self = this;
|
||||||
Discourse.notifyTitle(0);
|
Discourse.notifyTitle(0);
|
||||||
this.get('controller').loadMoreTopics().then(function (hasMoreResults) {
|
this.get('controller').loadMoreTopics().then(function (hasMoreResults) {
|
||||||
|
@ -34,14 +34,13 @@ export default Discourse.View.extend(LoadMore, UrlRefresh, {
|
||||||
}.observes('controller.topicTrackingState.incomingCount'),
|
}.observes('controller.topicTrackingState.incomingCount'),
|
||||||
|
|
||||||
// Remember where we were scrolled to
|
// Remember where we were scrolled to
|
||||||
saveScrollPosition: function() {
|
saveScrollPosition() {
|
||||||
this.session.set('topicListScrollPosition', $(window).scrollTop());
|
this.session.set('topicListScrollPosition', $(window).scrollTop());
|
||||||
},
|
},
|
||||||
|
|
||||||
// When the topic list is scrolled
|
// When the topic list is scrolled
|
||||||
scrolled: function() {
|
scrolled() {
|
||||||
this._super();
|
this._super();
|
||||||
this.saveScrollPosition();
|
this.saveScrollPosition();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue