2013-07-16 13:24:59 -04:00
|
|
|
Discourse.AdminUserRoute = Discourse.Route.extend({
|
2014-03-19 02:32:27 -04:00
|
|
|
serialize: function(model) {
|
|
|
|
return { username: model.get('username').toLowerCase() };
|
2013-05-07 13:30:12 -04:00
|
|
|
},
|
|
|
|
|
2013-06-05 12:40:06 -04:00
|
|
|
model: function(params) {
|
|
|
|
return Discourse.AdminUser.find(Em.get(params, 'username').toLowerCase());
|
2013-05-14 12:03:15 -04:00
|
|
|
},
|
|
|
|
|
2013-06-05 12:40:06 -04:00
|
|
|
renderTemplate: function() {
|
2013-06-03 16:12:24 -04:00
|
|
|
this.render({into: 'admin/templates/admin'});
|
2013-06-13 13:46:50 -04:00
|
|
|
},
|
|
|
|
|
2013-07-16 13:24:59 -04:00
|
|
|
afterModel: function(adminUser) {
|
2014-02-10 16:59:36 -05:00
|
|
|
return adminUser.loadDetails().then(function () {
|
2013-07-16 13:24:59 -04:00
|
|
|
adminUser.setOriginalTrustLevel();
|
2014-07-23 16:54:04 -04:00
|
|
|
return adminUser;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
Discourse.AdminUserIndexRoute = Discourse.Route.extend({
|
|
|
|
model: function() {
|
|
|
|
return this.modelFor('adminUser');
|
|
|
|
},
|
|
|
|
|
|
|
|
afterModel: function(model) {
|
2014-07-27 21:59:46 -04:00
|
|
|
if(Discourse.User.currentProp('admin')) {
|
|
|
|
var self = this;
|
|
|
|
return Discourse.Group.findAll().then(function(groups){
|
|
|
|
self._availableGroups = groups.filterBy('automatic', false);
|
|
|
|
return model;
|
|
|
|
});
|
|
|
|
}
|
2014-02-10 16:59:36 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
setupController: function(controller, model) {
|
|
|
|
controller.setProperties({
|
|
|
|
originalPrimaryGroupId: model.get('primary_group_id'),
|
2014-07-23 16:54:04 -04:00
|
|
|
availableGroups: this._availableGroups,
|
2014-02-10 16:59:36 -05:00
|
|
|
model: model
|
2013-07-16 13:24:59 -04:00
|
|
|
});
|
2013-11-01 10:47:03 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
actions: {
|
2013-11-07 13:53:32 -05:00
|
|
|
showSuspendModal: function(user) {
|
|
|
|
Discourse.Route.showModal(this, 'admin_suspend_user', user);
|
|
|
|
this.controllerFor('modal').set('modalClass', 'suspend-user-modal');
|
2013-11-01 10:47:03 -04:00
|
|
|
}
|
2013-05-14 12:49:15 -04:00
|
|
|
}
|
2014-01-22 17:09:56 -05:00
|
|
|
});
|