mirror of
https://github.com/vale981/Vulcan
synced 2025-03-10 12:36:39 -04:00
35 lines
904 B
JavaScript
35 lines
904 B
JavaScript
AutoForm.addHooks(['updateSettingsForm', 'insertSettingsForm'], {
|
|
onSuccess: function(operation, result) {
|
|
this.template.$('button[type=submit]').removeClass('loading');
|
|
Messages.flash(i18n.t('settings_saved'), 'success');
|
|
Messages.clearSeen();
|
|
$('body').scrollTop(0);
|
|
},
|
|
|
|
onError: function(operation, error) {
|
|
this.template.$('button[type=submit]').removeClass('loading');
|
|
Messages.flash(error, 'error');
|
|
Messages.clearSeen();
|
|
$('body').scrollTop(0);
|
|
}
|
|
});
|
|
|
|
AutoForm.hooks({
|
|
updateSettingsForm: {
|
|
before: {
|
|
update: function(modifier) {
|
|
this.template.$('button[type=submit]').addClass('loading');
|
|
return modifier;
|
|
}
|
|
}
|
|
|
|
},
|
|
insertSettingsForm: {
|
|
before: {
|
|
insert: function(doc) {
|
|
this.template.$('button[type=submit]').addClass('loading');
|
|
return doc;
|
|
}
|
|
}
|
|
}
|
|
});
|