UX: Better 'saved' indication on group manage form.

This commit is contained in:
Guo Xiang Tan 2018-04-13 10:18:09 +08:00
parent b3a88109a8
commit 67ab6ab751
2 changed files with 14 additions and 6 deletions

View File

@ -6,9 +6,8 @@ export default Ember.Component.extend({
@computed('saving') @computed('saving')
savingText(saving) { savingText(saving) {
if (saving !== undefined) { if (saving) return I18n.t("saving");
return saving ? I18n.t('saving') : I18n.t('saved'); return saving ? I18n.t("saving") : I18n.t("save");
}
}, },
actions: { actions: {
@ -16,6 +15,9 @@ export default Ember.Component.extend({
this.set('saving', true); this.set('saving', true);
return this.get('model').save() return this.get('model').save()
.then(() => {
this.set("saved", true);
})
.catch(popupAjaxError) .catch(popupAjaxError)
.finally(() => this.set('saving', false)); .finally(() => this.set('saving', false));
} }

View File

@ -1,6 +1,12 @@
<div class='control-group buttons'> <div class='control-group buttons'>
{{d-button action="save" {{#d-button action="save"
disabled=saving disabled=saving
class='btn btn-primary group-form-save' class='btn btn-primary group-manage-save'}}
label="save"}}
{{savingText}}
{{/d-button}}
{{#if saved}}
<span>{{i18n 'saved'}}</span>
{{/if}}
</div> </div>