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

View File

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