2014-07-20 12:42:03 -04:00
|
|
|
import PaginationRouteMixin from 'ghost/mixins/pagination-route';
|
|
|
|
|
|
|
|
var activeUsersPaginationSettings = {
|
|
|
|
include: 'roles',
|
|
|
|
page: 1,
|
|
|
|
limit: 20
|
|
|
|
};
|
|
|
|
|
|
|
|
var invitedUsersPaginationSettings = {
|
|
|
|
include: 'roles',
|
|
|
|
limit: 'all',
|
|
|
|
status: 'invited'
|
|
|
|
};
|
|
|
|
|
|
|
|
var UsersIndexRoute = Ember.Route.extend(Ember.SimpleAuth.AuthenticatedRouteMixin, PaginationRouteMixin, {
|
|
|
|
setupController: function (controller, model) {
|
|
|
|
this._super(controller, model.active);
|
|
|
|
this.setupPagination(activeUsersPaginationSettings);
|
|
|
|
},
|
2014-07-01 23:44:39 -04:00
|
|
|
|
|
|
|
model: function () {
|
2014-07-20 12:42:03 -04:00
|
|
|
// using `.filter` allows the template to auto-update when new models are pulled in from the server.
|
|
|
|
// we just need to 'return true' to allow all models by default.
|
|
|
|
return Ember.RSVP.hash({
|
|
|
|
inactive: this.store.filter('user', invitedUsersPaginationSettings, function () {
|
|
|
|
return true;
|
|
|
|
}),
|
|
|
|
active: this.store.filter('user', activeUsersPaginationSettings, function () {
|
|
|
|
return true;
|
|
|
|
})
|
|
|
|
});
|
2014-07-01 23:44:39 -04:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
export default UsersIndexRoute;
|