2013-07-17 01:24:59 +08:00
|
|
|
Discourse.AdminUserRoute = Discourse.Route.extend({
|
2014-03-19 14:32:27 +08:00
|
|
|
serialize: function(model) {
|
|
|
|
return { username: model.get('username').toLowerCase() };
|
2013-05-08 01:30:12 +08:00
|
|
|
},
|
|
|
|
|
2013-06-06 00:40:06 +08:00
|
|
|
model: function(params) {
|
|
|
|
return Discourse.AdminUser.find(Em.get(params, 'username').toLowerCase());
|
2013-05-15 00:03:15 +08:00
|
|
|
},
|
|
|
|
|
2013-06-06 00:40:06 +08:00
|
|
|
renderTemplate: function() {
|
2013-06-04 04:12:24 +08:00
|
|
|
this.render({into: 'admin/templates/admin'});
|
2013-06-14 01:46:50 +08:00
|
|
|
},
|
|
|
|
|
2013-07-17 01:24:59 +08:00
|
|
|
afterModel: function(adminUser) {
|
2014-02-11 05:59:36 +08:00
|
|
|
return adminUser.loadDetails().then(function () {
|
2013-07-17 01:24:59 +08:00
|
|
|
adminUser.setOriginalTrustLevel();
|
2014-07-24 04:54:04 +08:00
|
|
|
return adminUser;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
Discourse.AdminUserIndexRoute = Discourse.Route.extend({
|
|
|
|
model: function() {
|
|
|
|
return this.modelFor('adminUser');
|
|
|
|
},
|
|
|
|
|
|
|
|
afterModel: function(model) {
|
2014-07-28 09:59:46 +08: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-11 05:59:36 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
setupController: function(controller, model) {
|
|
|
|
controller.setProperties({
|
|
|
|
originalPrimaryGroupId: model.get('primary_group_id'),
|
2014-07-24 04:54:04 +08:00
|
|
|
availableGroups: this._availableGroups,
|
2014-02-11 05:59:36 +08:00
|
|
|
model: model
|
2013-07-17 01:24:59 +08:00
|
|
|
});
|
2013-11-01 22:47:03 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
actions: {
|
2013-11-08 02:53:32 +08:00
|
|
|
showSuspendModal: function(user) {
|
|
|
|
Discourse.Route.showModal(this, 'admin_suspend_user', user);
|
|
|
|
this.controllerFor('modal').set('modalClass', 'suspend-user-modal');
|
2013-11-01 22:47:03 +08:00
|
|
|
}
|
2013-05-15 00:49:15 +08:00
|
|
|
}
|
2014-01-23 06:09:56 +08:00
|
|
|
});
|