0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-20 22:42:53 -05:00

Minor UI fixes for invitations

issue #5652
- display "Sending Invite..." text after clicking "RESEND" link
- change "Invitation sent" alert to notification
This commit is contained in:
Kevin Ansfield 2015-08-20 10:25:30 +01:00
parent 4e4de10e19
commit ffb04114a2
3 changed files with 17 additions and 8 deletions

View file

@ -4,6 +4,7 @@ export default Ember.Component.extend({
tagName: '', tagName: '',
user: null, user: null,
isSending: false,
notifications: Ember.inject.service(), notifications: Ember.inject.service(),
@ -16,8 +17,10 @@ export default Ember.Component.extend({
actions: { actions: {
resend: function () { resend: function () {
var user = this.get('user'), var user = this.get('user'),
notifications = this.get('notifications'); notifications = this.get('notifications'),
self = this;
this.set('isSending', true);
user.resendInvite().then(function (result) { user.resendInvite().then(function (result) {
var notificationText = 'Invitation resent! (' + user.get('email') + ')'; var notificationText = 'Invitation resent! (' + user.get('email') + ')';
@ -31,6 +34,8 @@ export default Ember.Component.extend({
} }
}).catch(function (error) { }).catch(function (error) {
notifications.showAPIError(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') { if (newUser.get('status') === 'invited-pending') {
self.get('notifications').showAlert('Invitation email was not sent. Please try resending.', {type: 'error'}); self.get('notifications').showAlert('Invitation email was not sent. Please try resending.', {type: 'error'});
} else { } else {
self.get('notifications').showAlert(notificationText, {type: 'success'}); self.get('notifications').showNotification(notificationText);
} }
}).catch(function (errors) { }).catch(function (errors) {
newUser.deleteRecord(); newUser.deleteRecord();

View file

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