From 5025e9771284c54acd4ec4551e7c903ff4e89639 Mon Sep 17 00:00:00 2001 From: Benjamin Kampmann Date: Tue, 15 Jul 2014 15:48:02 +0200 Subject: [PATCH] move available groups loader into router --- .../javascripts/admin/components/admin-group-selector.js.es6 | 5 ----- app/assets/javascripts/admin/routes/admin_user_route.js | 5 +++++ .../javascripts/admin/templates/user_index.js.handlebars | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/assets/javascripts/admin/components/admin-group-selector.js.es6 b/app/assets/javascripts/admin/components/admin-group-selector.js.es6 index 08bcc619f48..4189beed3f1 100644 --- a/app/assets/javascripts/admin/components/admin-group-selector.js.es6 +++ b/app/assets/javascripts/admin/components/admin-group-selector.js.es6 @@ -21,11 +21,6 @@ export default Ember.Component.extend({ ).findBy("id", evt.removed.id)}); } }.bind(this)); - - Discourse.Group.findAll().then(function(groups){ - this.set("available", groups.filterBy("automatic", false)); - }.bind(this)); - this._refreshOnReset(); }, diff --git a/app/assets/javascripts/admin/routes/admin_user_route.js b/app/assets/javascripts/admin/routes/admin_user_route.js index fd78a5ed6bb..96af282ebcb 100644 --- a/app/assets/javascripts/admin/routes/admin_user_route.js +++ b/app/assets/javascripts/admin/routes/admin_user_route.js @@ -23,6 +23,11 @@ Discourse.AdminUserRoute = Discourse.Route.extend({ afterModel: function(adminUser) { var controller = this.controllerFor('adminUser'); + Discourse.Group.findAll().then(function(groups){ + controller.set("availableGroups", groups.filterBy("automatic", false)); + }.bind(this)); + + return adminUser.loadDetails().then(function () { adminUser.setOriginalTrustLevel(); controller.set('model', adminUser); diff --git a/app/assets/javascripts/admin/templates/user_index.js.handlebars b/app/assets/javascripts/admin/templates/user_index.js.handlebars index fccb6d13a22..22d77122a8d 100644 --- a/app/assets/javascripts/admin/templates/user_index.js.handlebars +++ b/app/assets/javascripts/admin/templates/user_index.js.handlebars @@ -55,7 +55,7 @@
{{i18n admin.groups.title}}
- {{admin-group-selector selected=model.groups }} + {{admin-group-selector selected=model.groups available=availableGroups}}
{{#if custom_groups}}