2013-02-22 15:41:12 -05:00
|
|
|
/**
|
|
|
|
Handles routes related to users in the admin section.
|
2013-02-20 13:15:50 -05:00
|
|
|
|
2013-05-07 13:30:12 -04:00
|
|
|
@class AdminUserRoute
|
2013-02-22 15:41:12 -05:00
|
|
|
@extends Discourse.Route
|
|
|
|
@namespace Discourse
|
|
|
|
@module Discourse
|
|
|
|
**/
|
2013-07-16 13:24:59 -04:00
|
|
|
Discourse.AdminUserRoute = Discourse.Route.extend({
|
2013-06-05 12:40:06 -04:00
|
|
|
|
2013-05-07 13:30:12 -04:00
|
|
|
serialize: function(params) {
|
|
|
|
return { username: Em.get(params, 'username').toLowerCase() };
|
|
|
|
},
|
|
|
|
|
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) {
|
|
|
|
var controller = this.controllerFor('adminUser');
|
|
|
|
|
|
|
|
adminUser.loadDetails().then(function () {
|
|
|
|
adminUser.setOriginalTrustLevel();
|
|
|
|
controller.set('model', adminUser);
|
2013-07-23 13:35:32 -04:00
|
|
|
window.scrollTo(0, 0);
|
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
|
|
|
}
|
2013-05-14 12:03:15 -04:00
|
|
|
|
2013-02-22 15:41:12 -05:00
|
|
|
});
|