Can revert changes to email templates

This commit is contained in:
Robin Ward
2015-11-20 12:30:04 -05:00
parent bb1d0dea8a
commit 8eeb027c65
10 changed files with 75 additions and 11 deletions

View File

@ -6,11 +6,23 @@ export default Ember.Controller.extend(bufferedProperty('emailTemplate'), {
actions: {
saveChanges() {
const model = this.get('emailTemplate');
const buffered = this.get('buffered');
model.save(buffered.getProperties('subject', 'body')).then(() => {
this.get('emailTemplate').save(buffered.getProperties('subject', 'body')).then(() => {
this.set('saved', true);
}).catch(popupAjaxError);
},
revertChanges() {
this.set('saved', false);
bootbox.confirm(I18n.t('admin.customize.email_templates.revert_confirm'), result => {
if (result) {
this.get('emailTemplate').revert().then(props => {
const buffered = this.get('buffered');
buffered.setProperties(props);
this.commitBuffer();
}).catch(popupAjaxError);
}
});
}
}
});