move available groups loader into router

This commit is contained in:
Benjamin Kampmann 2014-07-15 15:48:02 +02:00
parent 2435961b58
commit 5025e97712
3 changed files with 6 additions and 6 deletions

View File

@ -21,11 +21,6 @@ export default Ember.Component.extend({
).findBy("id", evt.removed.id)}); ).findBy("id", evt.removed.id)});
} }
}.bind(this)); }.bind(this));
Discourse.Group.findAll().then(function(groups){
this.set("available", groups.filterBy("automatic", false));
}.bind(this));
this._refreshOnReset(); this._refreshOnReset();
}, },

View File

@ -23,6 +23,11 @@ Discourse.AdminUserRoute = Discourse.Route.extend({
afterModel: function(adminUser) { afterModel: function(adminUser) {
var controller = this.controllerFor('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 () { return adminUser.loadDetails().then(function () {
adminUser.setOriginalTrustLevel(); adminUser.setOriginalTrustLevel();
controller.set('model', adminUser); controller.set('model', adminUser);

View File

@ -55,7 +55,7 @@
<div class='display-row'> <div class='display-row'>
<div class='field'>{{i18n admin.groups.title}}</div> <div class='field'>{{i18n admin.groups.title}}</div>
<div class='value'> <div class='value'>
{{admin-group-selector selected=model.groups }} {{admin-group-selector selected=model.groups available=availableGroups}}
</div> </div>
<div class='controls'> <div class='controls'>
{{#if custom_groups}} {{#if custom_groups}}