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