This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/components/group-manage-save-button.js.es6
2018-04-13 10:18:09 +08:00

26 lines
589 B
JavaScript

import { popupAjaxError } from 'discourse/lib/ajax-error';
import computed from 'ember-addons/ember-computed-decorators';
export default Ember.Component.extend({
saving: null,
@computed('saving')
savingText(saving) {
if (saving) return I18n.t("saving");
return saving ? I18n.t("saving") : I18n.t("save");
},
actions: {
save() {
this.set('saving', true);
return this.get('model').save()
.then(() => {
this.set("saved", true);
})
.catch(popupAjaxError)
.finally(() => this.set('saving', false));
}
},
});