mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 09:42:07 +08:00
41 lines
990 B
JavaScript
41 lines
990 B
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');
|
|
|
|
adminUser.loadDetails().then(function () {
|
|
adminUser.setOriginalTrustLevel();
|
|
controller.set('model', adminUser);
|
|
window.scrollTo(0, 0);
|
|
});
|
|
},
|
|
|
|
actions: {
|
|
showSuspendModal: function(user) {
|
|
Discourse.Route.showModal(this, 'admin_suspend_user', user);
|
|
this.controllerFor('modal').set('modalClass', 'suspend-user-modal');
|
|
}
|
|
}
|
|
|
|
});
|