2014-07-22 23:20:45 -04:00
|
|
|
export default Ember.ArrayController.extend({
|
2014-04-23 13:25:02 -04:00
|
|
|
sortProperties: ['name'],
|
2013-05-08 01:20:38 -04:00
|
|
|
|
2014-04-23 13:25:02 -04:00
|
|
|
refreshingAutoGroups: false,
|
2013-09-16 14:08:55 -04:00
|
|
|
|
2014-04-23 13:25:02 -04:00
|
|
|
actions: {
|
2013-09-16 14:08:55 -04:00
|
|
|
refreshAutoGroups: function(){
|
2014-04-23 13:25:02 -04:00
|
|
|
var self = this,
|
|
|
|
groups = this.get('model');
|
2013-09-16 14:08:55 -04:00
|
|
|
|
|
|
|
self.set('refreshingAutoGroups', true);
|
2014-04-23 13:25:02 -04:00
|
|
|
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
|
|
|
});
|
2014-04-23 13:25:02 -04:00
|
|
|
});
|
2013-09-16 14:08:55 -04:00
|
|
|
});
|
|
|
|
}
|
2013-05-09 03:37:34 -04:00
|
|
|
}
|
2013-04-17 03:08:21 -04:00
|
|
|
});
|