From 778ae06000c40616e4b93e8665bd853b97865a2a Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Mon, 28 Dec 2015 11:21:07 +0800 Subject: [PATCH] UX: Add saving status to groups admin. --- .../javascripts/admin/controllers/admin-group.js.es6 | 10 +++++++--- app/assets/javascripts/admin/routes/admin-group.js.es6 | 1 + app/assets/javascripts/admin/templates/group.hbs | 1 + 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/admin/controllers/admin-group.js.es6 b/app/assets/javascripts/admin/controllers/admin-group.js.es6 index 542e15c9870..e477ba4b0a1 100644 --- a/app/assets/javascripts/admin/controllers/admin-group.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-group.js.es6 @@ -4,6 +4,7 @@ import { propertyEqual } from 'discourse/lib/computed'; export default Ember.Controller.extend({ needs: ['adminGroupsType'], disableSave: false, + savingStatus: '', currentPage: function() { if (this.get("model.user_count") === 0) { return 0; } @@ -95,12 +96,15 @@ export default Ember.Controller.extend({ groupType = groupsController.get("type"); this.set('disableSave', true); + this.set('savingStatus', I18n.t('saving')); let promise = group.get("id") ? group.save() : group.create().then(() => groupsController.addObject(group)); - promise.then(() => this.transitionToRoute("adminGroup", groupType, group.get('name'))) - .catch(popupAjaxError) - .finally(() => this.set('disableSave', false)); + promise.then(() => { + this.transitionToRoute("adminGroup", groupType, group.get('name')); + this.set('savingStatus', I18n.t('saved')); + }).catch(popupAjaxError) + .finally(() => this.set('disableSave', false)); }, destroy() { diff --git a/app/assets/javascripts/admin/routes/admin-group.js.es6 b/app/assets/javascripts/admin/routes/admin-group.js.es6 index b46022a6460..1555c4200a5 100644 --- a/app/assets/javascripts/admin/routes/admin-group.js.es6 +++ b/app/assets/javascripts/admin/routes/admin-group.js.es6 @@ -21,6 +21,7 @@ export default Discourse.Route.extend({ setupController: function(controller, model) { controller.set("model", model); controller.set("model.usernames", null); + controller.set("savingStatus", ''); model.findMembers(); } diff --git a/app/assets/javascripts/admin/templates/group.hbs b/app/assets/javascripts/admin/templates/group.hbs index 51dbc23cef4..585df0bcaf7 100644 --- a/app/assets/javascripts/admin/templates/group.hbs +++ b/app/assets/javascripts/admin/templates/group.hbs @@ -106,6 +106,7 @@ {{#unless model.automatic}} {{/unless}} + {{savingStatus}}