display group validation errors in alert modal

This commit is contained in:
Michael Campagnaro
2013-07-24 00:31:15 -04:00
parent 38b8e9b1b4
commit 867ce0310c
2 changed files with 15 additions and 5 deletions

View File

@@ -60,13 +60,20 @@ Discourse.Group = Discourse.Model.extend({
name: this.get('name'),
usernames: this.get('usernames')
}
}}).then(function(r){
}}).then(function(resp) {
group.set('disableSave', false);
group.set('id', r.id);
group.set('id', resp.id);
}, function (error) {
group.set('disableSave', false);
if (error && error.responseText) {
bootbox.alert($.parseJSON(error.responseText).errors);
}
else {
bootbox.alert(I18n.t('generic_error'));
}
});
},
save: function(){
var group = this;
group.set('disableSave', true);