FIX: Impersonate was hidden when navigating to user details page in admin from list.

This commit is contained in:
Robin Ward 2013-06-13 13:46:50 -04:00
parent 4db8204a15
commit cb6774a895
2 changed files with 18 additions and 1 deletions

View file

@ -216,6 +216,17 @@ Discourse.AdminUser = Discourse.User.extend({
});
}
});
},
loadDetails: function() {
var model = this;
if (model.get('loadedDetails')) { return; }
Discourse.AdminUser.find(model.get('username_lower')).then(function (result) {
console.log("loaded details");
model.setProperties(result);
model.set('loadedDetails', true);
});
}
});
@ -243,6 +254,7 @@ Discourse.AdminUser.reopenClass({
find: function(username) {
return Discourse.ajax("/admin/users/" + username).then(function (result) {
result.loadedDetails = true;
return Discourse.AdminUser.create(result);
});
},

View file

@ -6,7 +6,7 @@
@namespace Discourse
@module Discourse
**/
Discourse.AdminUserRoute = Discourse.Route.extend({
Discourse.AdminUserRoute = Discourse.Route.extend(Discourse.ModelReady, {
serialize: function(params) {
return { username: Em.get(params, 'username').toLowerCase() };
@ -18,6 +18,11 @@ Discourse.AdminUserRoute = Discourse.Route.extend({
renderTemplate: function() {
this.render({into: 'admin/templates/admin'});
},
modelReady: function(controller, adminUser) {
adminUser.loadDetails();
controller.set('model', adminUser);
}
});