2014-07-20 20:42:03 +04:00
|
|
|
import PaginationControllerMixin from 'ghost/mixins/pagination-controller';
|
|
|
|
|
|
|
|
var UsersIndexController = Ember.ArrayController.extend(PaginationControllerMixin, {
|
|
|
|
init: function () {
|
|
|
|
//let the PaginationControllerMixin know what type of model we will be paginating
|
2014-07-23 10:13:20 +04:00
|
|
|
//this is necessary because we do not have access to the model inside the Controller::init method
|
2014-07-20 20:42:03 +04:00
|
|
|
this._super({'modelType': 'user'});
|
|
|
|
},
|
|
|
|
|
2014-07-05 12:06:10 +04:00
|
|
|
users: Ember.computed.alias('model'),
|
2014-07-02 07:44:39 +04:00
|
|
|
|
2014-07-23 10:13:20 +04:00
|
|
|
activeUsers: Ember.computed.filter('users', function (user) {
|
|
|
|
return /^active|warn-[1-4]|locked$/.test(user.get('status'));
|
|
|
|
}),
|
2014-07-02 07:44:39 +04:00
|
|
|
|
2014-07-23 10:13:20 +04:00
|
|
|
invitedUsers: Ember.computed.filter('users', function (user) {
|
|
|
|
var status = user.get('status');
|
|
|
|
|
|
|
|
return status === 'invited' || status === 'invited-pending';
|
|
|
|
})
|
2014-07-02 07:44:39 +04:00
|
|
|
});
|
|
|
|
|
|
|
|
export default UsersIndexController;
|