mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-12-18 03:25:31 -05:00
b61df08d1b
and apply a CSS class to their posts.
52 lines
1.3 KiB
JavaScript
52 lines
1.3 KiB
JavaScript
/**
|
|
Handles routes related to users in the admin section.
|
|
|
|
@class AdminUserRoute
|
|
@extends Discourse.Route
|
|
@namespace Discourse
|
|
@module Discourse
|
|
**/
|
|
Discourse.AdminUserRoute = Discourse.Route.extend({
|
|
|
|
serialize: function(params) {
|
|
return { username: Em.get(params, 'username').toLowerCase() };
|
|
},
|
|
|
|
model: function(params) {
|
|
return Discourse.AdminUser.find(Em.get(params, 'username').toLowerCase());
|
|
},
|
|
|
|
renderTemplate: function() {
|
|
this.render({into: 'admin/templates/admin'});
|
|
},
|
|
|
|
afterModel: function(adminUser) {
|
|
var controller = this.controllerFor('adminUser');
|
|
|
|
return adminUser.loadDetails().then(function () {
|
|
adminUser.setOriginalTrustLevel();
|
|
controller.set('model', adminUser);
|
|
});
|
|
},
|
|
|
|
setupController: function(controller, model) {
|
|
controller.setProperties({
|
|
originalPrimaryGroupId: model.get('primary_group_id'),
|
|
model: model
|
|
});
|
|
},
|
|
|
|
actions: {
|
|
showSuspendModal: function(user) {
|
|
Discourse.Route.showModal(this, 'admin_suspend_user', user);
|
|
this.controllerFor('modal').set('modalClass', 'suspend-user-modal');
|
|
}
|
|
}
|
|
|
|
});
|
|
|
|
Discourse.AdminUserIndexRoute = Discourse.Route.extend({
|
|
setupController: function(c) {
|
|
c.set('model', this.controllerFor('adminUser').get('model'));
|
|
}
|
|
});
|