This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/controllers/user-notifications.js.es6
2016-07-11 12:57:05 -04:00

31 lines
736 B
JavaScript

import { ajax } from 'discourse/lib/ajax';
import { default as computed, observes } from 'ember-addons/ember-computed-decorators';
export default Ember.ArrayController.extend({
needs: ['application'],
@observes('model.canLoadMore')
_showFooter() {
this.set("controllers.application.showFooter", !this.get("model.canLoadMore"));
},
@computed('model.content.length')
hasNotifications(length) {
return length > 0;
},
currentPath: Em.computed.alias('controllers.application.currentPath'),
actions: {
resetNew() {
ajax('/notifications/mark-read', { method: 'PUT' }).then(() => {
this.setEach('read', true);
});
},
loadMore() {
this.get('model').loadMore();
}
}
});