From df2a7184461c4d71dbf225ffb12d75bfec3a35ad Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Tue, 14 May 2013 12:03:15 -0400 Subject: [PATCH] FIX: Load more user admin details, even when passed from a list --- .../admin_users_list_controller.js | 20 +++++++++---------- .../admin/routes/admin_user_route.js | 13 +++++++----- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/app/assets/javascripts/admin/controllers/admin_users_list_controller.js b/app/assets/javascripts/admin/controllers/admin_users_list_controller.js index 9ea1fbb0828..265f23c0207 100644 --- a/app/assets/javascripts/admin/controllers/admin_users_list_controller.js +++ b/app/assets/javascripts/admin/controllers/admin_users_list_controller.js @@ -18,12 +18,12 @@ Discourse.AdminUsersListController = Ember.ArrayController.extend(Discourse.Pres @event selectAll **/ - selectAllChanged: (function() { + selectAllChanged: function() { var _this = this; this.get('content').each(function(user) { user.set('selected', _this.get('selectAll')); }); - }).observes('selectAll'), + }.observes('selectAll'), /** Triggered when the username filter is changed @@ -39,9 +39,9 @@ Discourse.AdminUsersListController = Ember.ArrayController.extend(Discourse.Pres @event orderChanged **/ - orderChanged: (function() { + orderChanged: function() { this.refreshUsers(); - }).observes('query'), + }.observes('query'), /** The title of the user list, based on which query was performed. @@ -57,30 +57,30 @@ Discourse.AdminUsersListController = Ember.ArrayController.extend(Discourse.Pres @property showApproval **/ - showApproval: (function() { + showApproval: function() { if (!Discourse.SiteSettings.must_approve_users) return false; if (this.get('query') === 'new') return true; if (this.get('query') === 'pending') return true; - }).property('query'), + }.property('query'), /** How many users are currently selected @property selectedCount **/ - selectedCount: (function() { + selectedCount: function() { if (this.blank('content')) return 0; return this.get('content').filterProperty('selected').length; - }).property('content.@each.selected'), + }.property('content.@each.selected'), /** Do we have any selected users? @property hasSelection **/ - hasSelection: (function() { + hasSelection: function() { return this.get('selectedCount') > 0; - }).property('selectedCount'), + }.property('selectedCount'), /** Refresh the current list of users. diff --git a/app/assets/javascripts/admin/routes/admin_user_route.js b/app/assets/javascripts/admin/routes/admin_user_route.js index ad9d9693693..339b12ddf39 100644 --- a/app/assets/javascripts/admin/routes/admin_user_route.js +++ b/app/assets/javascripts/admin/routes/admin_user_route.js @@ -7,15 +7,18 @@ @module Discourse **/ Discourse.AdminUserRoute = Discourse.Route.extend({ - model: function(params) { - return Discourse.AdminUser.find(params.username); - }, - serialize: function(params) { return { username: Em.get(params, 'username').toLowerCase() }; }, renderTemplate: function() { this.render('admin/templates/user', {into: 'admin/templates/admin'}); - } + }, + + setupController: function(controller, model) { + Discourse.AdminUser.find(Em.get(model, 'username').toLowerCase()).then(function (u) { + controller.set('content', u); + }); + }, + });