Merge pull request #1260 from sir-pinecone/reactivate-admin-refresh-btn

Fix auto-group refresh response so that ajax callback runs
This commit is contained in:
Sam 2013-07-28 22:22:55 -07:00
commit 22893e203a
3 changed files with 6 additions and 5 deletions

View File

@ -10,9 +10,10 @@ Discourse.AdminGroupsController = Ember.Controller.extend({
var controller = this;
this.set('refreshingAutoGroups', true);
Discourse.ajax('/admin/groups/refresh_automatic_groups', {type: 'POST'}).then(function(){
Discourse.ajax('/admin/groups/refresh_automatic_groups', {type: 'POST'})
.then(function() {
controller.set('model', Discourse.Group.findAll());
controller.set('refreshingAutoGroups',false);
controller.set('refreshingAutoGroups', false);
});
},

View File

@ -44,7 +44,7 @@ Discourse.Group = Discourse.Model.extend({
return Discourse.ajax("/admin/groups/" + group.get('id'), {type: "DELETE"})
.then(function(){
return true;
}, function(jqXHR, status, error) {
}, function(error) {
group.set('disableSave', false);
bootbox.alert(I18n.t("admin.groups.delete_failed"));
return false;

View File

@ -6,7 +6,7 @@ class Admin::GroupsController < Admin::AdminController
def refresh_automatic_groups
Group.refresh_automatic_groups!
render json: "ok"
render json: success_json
end
def users
@ -22,7 +22,7 @@ class Admin::GroupsController < Admin::AdminController
group.usernames = params[:group][:usernames]
group.name = params[:group][:name] if params[:group][:name]
if group.save
render json: "ok"
render json: success_json
else
render_json_error group
end