FEATURE: provide more details when performing a bulk add to group

This commit is contained in:
Arpit Jalan
2017-04-27 00:30:05 +05:30
parent f499180bb3
commit 285c167fae
7 changed files with 38 additions and 5 deletions
@@ -0,0 +1,4 @@
export default Ember.Controller.extend({
adminGroupsBulk: Ember.inject.controller(),
bulkAddResponse: Ember.computed.alias('adminGroupsBulk.bulkAddResponse')
});
@@ -6,6 +6,7 @@ export default Ember.Controller.extend({
users: null,
groupId: null,
saving: false,
bulkAddResponse: null,
@computed('saving', 'users', 'groupId')
buttonDisabled(saving, users, groupId) {
@@ -24,7 +25,8 @@ export default Ember.Controller.extend({
ajax('/admin/groups/bulk', {
data: { users, group_id: this.get('groupId') },
method: 'PUT'
}).then(() => {
}).then(result => {
this.set('bulkAddResponse', result);
this.transitionToRoute('adminGroups.bulkComplete');
}).catch(popupAjaxError).finally(() => {
this.set('saving', false);
@@ -1 +1,11 @@
<p>{{i18n "admin.groups.bulk_complete"}}</p>
{{#if bulkAddResponse}}
<p>{{{bulkAddResponse.message}}}</p>
{{#if bulkAddResponse.users_not_added}}
<p>{{i18n "admin.groups.bulk_complete_users_not_added"}}</p>
{{#each bulkAddResponse.users_not_added as |user|}}
{{user}}<br/>
{{/each}}
{{/if}}
{{else}}
<p>{{i18n "admin.groups.bulk_complete"}}</p>
{{/if}}