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 01:20:38 -04:00
refreshingAutoGroups: false,
2013-09-16 14:08:55 -04:00
actions: {
2013-09-16 14:08:55 -04:00
refreshAutoGroups: function(){
var self = this,
groups = this.get('model');
2013-09-16 14:08:55 -04: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-16 14:08:55 -04:00
});
});
2013-09-16 14:08:55 -04:00
});
}
}
});