0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-13 22:41:32 -05:00
ghost/core/client/routes/settings/users/index.js
Fabian Becker e886e90b9d Implements setting specific body classes
closes #4116
- Adds css classes to settings views
2014-09-24 15:24:15 +02:00

41 lines
1.2 KiB
JavaScript

import PaginationRouteMixin from 'ghost/mixins/pagination-route';
import styleBody from 'ghost/mixins/style-body';
var paginationSettings = {
page: 1,
limit: 20,
status: 'all'
};
var UsersIndexRoute = Ember.Route.extend(SimpleAuth.AuthenticatedRouteMixin, styleBody, PaginationRouteMixin, {
classNames: ['settings-view-users'],
setupController: function (controller, model) {
this._super(controller, model);
this.setupPagination(paginationSettings);
},
model: function () {
var self = this;
return this.store.find('user', 'me').then(function (currentUser) {
if (currentUser.get('isEditor')) {
// Editors only see authors in the list
paginationSettings.role = 'Author';
}
return self.store.filter('user', paginationSettings, function (user) {
if (currentUser.get('isEditor')) {
return user.get('isAuthor');
}
return true;
});
});
},
actions: {
reload: function () {
this.refresh();
}
}
});
export default UsersIndexRoute;