UX: Show spinning icon while group members load.

This commit is contained in:
Guo Xiang Tan 2017-01-03 14:58:14 +08:00
parent 3aed15c99e
commit 7ce4bc2e90
2 changed files with 12 additions and 3 deletions

View File

@ -1,6 +1,6 @@
import { popupAjaxError } from 'discourse/lib/ajax-error';
import Group from 'discourse/models/group';
import { observes } from 'ember-addons/ember-computed-decorators';
import { default as computed, observes } from 'ember-addons/ember-computed-decorators';
export default Ember.Controller.extend({
queryParams: ['order', 'desc'],
@ -14,8 +14,17 @@ export default Ember.Controller.extend({
@observes('order', 'desc')
refreshMembers() {
this.set('loading', true);
this.get('model') &&
this.get('model').findMembers({ order: this.get('order'), desc: this.get('desc') });
this.get('model')
.findMembers({ order: this.get('order'), desc: this.get('desc') })
.finally(() => this.set('loading', false));
},
@computed('model.members')
hasMembers(members) {
return members && members.length > 0;
},
actions: {

View File

@ -1,4 +1,4 @@
{{#if model.members}}
{{#if hasMembers}}
{{group-membership-button model=model
createNewMessageViaParams='createNewMessageViaParams'}}