discourse/app/assets/javascripts/admin/controllers/admin-groups.js.es6

25 lines
707 B
Plaintext
Raw Normal View History

export default Ember.ArrayController.extend({
sortProperties: ['name'],
2013-05-08 13:20:38 +08:00
refreshingAutoGroups: false,
2013-09-17 02:08:55 +08:00
actions: {
2013-09-17 02:08:55 +08:00
refreshAutoGroups: function(){
var self = this,
groups = this.get('model');
2013-09-17 02:08:55 +08:00
self.set('refreshingAutoGroups', true);
this.transitionToRoute('adminGroups.index').then(function() {
Discourse.ajax('/admin/groups/refresh_automatic_groups', {type: 'POST'}).then(function() {
return Discourse.Group.findAll().then(function(newGroups) {
groups.clear();
groups.addObjects(newGroups);
}).finally(function() {
self.set('refreshingAutoGroups', false);
2013-09-17 02:08:55 +08:00
});
});
2013-09-17 02:08:55 +08:00
});
}
}
});