2013-02-23 04:41:12 +08:00
|
|
|
/**
|
|
|
|
Handles routes related to users in the admin section.
|
2013-02-21 02:15:50 +08:00
|
|
|
|
2013-05-08 01:30:12 +08:00
|
|
|
@class AdminUserRoute
|
2013-02-23 04:41:12 +08:00
|
|
|
@extends Discourse.Route
|
|
|
|
@namespace Discourse
|
|
|
|
@module Discourse
|
|
|
|
**/
|
2013-07-17 01:24:59 +08:00
|
|
|
Discourse.AdminUserRoute = Discourse.Route.extend({
|
2013-06-06 00:40:06 +08:00
|
|
|
|
2013-05-08 01:30:12 +08:00
|
|
|
serialize: function(params) {
|
|
|
|
return { username: Em.get(params, 'username').toLowerCase() };
|
|
|
|
},
|
|
|
|
|
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) {
|
|
|
|
var controller = this.controllerFor('adminUser');
|
|
|
|
|
|
|
|
adminUser.loadDetails().then(function () {
|
|
|
|
adminUser.setOriginalTrustLevel();
|
|
|
|
controller.set('model', adminUser);
|
2013-07-24 01:35:32 +08:00
|
|
|
window.scrollTo(0, 0);
|
2013-07-17 01:24:59 +08:00
|
|
|
});
|
2013-11-01 22:47:03 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
actions: {
|
|
|
|
showBanModal: function(user) {
|
|
|
|
Discourse.Route.showModal(this, 'admin_ban_user', user);
|
|
|
|
this.controllerFor('modal').set('modalClass', 'ban-user-modal');
|
|
|
|
}
|
2013-05-15 00:49:15 +08:00
|
|
|
}
|
2013-05-15 00:03:15 +08:00
|
|
|
|
2013-02-23 04:41:12 +08:00
|
|
|
});
|