discourse/app/assets/javascripts/admin/controllers/admin_groups_controller.js

27 lines
728 B
JavaScript
Raw Normal View History

Discourse.AdminGroupsController = 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
});
}
}
2013-09-16 14:08:55 -04:00
});