2015-11-23 16:45:05 -05:00
|
|
|
import { popupAjaxError } from 'discourse/lib/ajax-error';
|
|
|
|
import { bufferedProperty } from 'discourse/mixins/buffered-content';
|
2013-04-04 12:59:44 -04:00
|
|
|
|
2015-11-23 16:45:05 -05:00
|
|
|
export default Ember.Controller.extend(bufferedProperty('siteText'), {
|
|
|
|
saved: false,
|
2013-04-04 12:59:44 -04:00
|
|
|
|
2013-09-16 14:08:55 -04:00
|
|
|
actions: {
|
2015-08-07 14:05:08 -04:00
|
|
|
saveChanges() {
|
2015-11-23 16:45:05 -05:00
|
|
|
const buffered = this.get('buffered');
|
|
|
|
this.get('siteText').save(buffered.getProperties('value')).then(() => {
|
|
|
|
this.commitBuffer();
|
|
|
|
this.set('saved', true);
|
|
|
|
}).catch(popupAjaxError);
|
|
|
|
},
|
|
|
|
|
|
|
|
revertChanges() {
|
|
|
|
this.set('saved', false);
|
|
|
|
bootbox.confirm(I18n.t('admin.site_text.revert_confirm'), result => {
|
|
|
|
if (result) {
|
|
|
|
this.get('siteText').revert().then(props => {
|
|
|
|
const buffered = this.get('buffered');
|
|
|
|
buffered.setProperties(props);
|
|
|
|
this.commitBuffer();
|
|
|
|
}).catch(popupAjaxError);
|
|
|
|
}
|
|
|
|
});
|
2013-09-16 14:08:55 -04:00
|
|
|
}
|
2013-04-04 12:59:44 -04:00
|
|
|
}
|
2013-09-16 14:08:55 -04:00
|
|
|
});
|