Merge pull request #5694 from kevinansfield/zelda-invite-fixes

Minor UI fixes for invitations
This commit is contained in:
Hannah Wolfe 2015-08-24 12:41:43 +01:00
commit 566bc03f5f
3 changed files with 17 additions and 8 deletions

View File

@ -4,6 +4,7 @@ export default Ember.Component.extend({
tagName: '',
user: null,
isSending: false,
notifications: Ember.inject.service(),
@ -16,8 +17,10 @@ export default Ember.Component.extend({
actions: {
resend: function () {
var user = this.get('user'),
notifications = this.get('notifications');
notifications = this.get('notifications'),
self = this;
this.set('isSending', true);
user.resendInvite().then(function (result) {
var notificationText = 'Invitation resent! (' + user.get('email') + ')';
@ -31,6 +34,8 @@ export default Ember.Component.extend({
}
}).catch(function (error) {
notifications.showAPIError(error);
}).finally(function () {
self.set('isSending', false);
});
},

View File

@ -74,7 +74,7 @@ export default Ember.Controller.extend({
if (newUser.get('status') === 'invited-pending') {
self.get('notifications').showAlert('Invitation email was not sent. Please try resending.', {type: 'error'});
} else {
self.get('notifications').showAlert(notificationText, {type: 'success'});
self.get('notifications').showNotification(notificationText);
}
}).catch(function (errors) {
newUser.deleteRecord();

View File

@ -37,12 +37,16 @@
{{/if}}
</div>
<aside class="user-list-item-aside">
<a class="user-list-action" href="#" {{action "revoke" target=component}}>
Revoke
</a>
<a class="user-list-action" href="#" {{action "resend" target=component}}>
Resend
</a>
{{#if component.isSending}}
<span>Sending Invite...</span>
{{else}}
<a class="user-list-action" href="#" {{action "revoke" target=component}}>
Revoke
</a>
<a class="user-list-action" href="#" {{action "resend" target=component}}>
Resend
</a>
{{/if}}
</aside>
</div>
{{/gh-user-invited}}