From a62e31dc7058d85bf343ca71d661f7956de2409f Mon Sep 17 00:00:00 2001 From: HSam Date: Sun, 6 Mar 2016 14:12:24 -0600 Subject: [PATCH] Finished the invite removal button changes. --- public/src/admin/manage/registration.js | 21 +++++++++++++++++---- src/views/admin/manage/registration.tpl | 2 +- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/public/src/admin/manage/registration.js b/public/src/admin/manage/registration.js index 6de647b467..451c01f716 100644 --- a/public/src/admin/manage/registration.js +++ b/public/src/admin/manage/registration.js @@ -31,12 +31,25 @@ define('admin/manage/registration', function() { var action = $(this).attr('data-action'); var method = 'admin.user.deleteInvitation'; + var removeRow = function () { + var nextRow = parent.next(), + thisRowinvitedBy = parent.find('.invited-by'), + nextRowInvitedBy = nextRow.find('.invited-by'); + if (nextRowInvitedBy.html() !== undefined && nextRowInvitedBy.html().length < 2) { + nextRowInvitedBy.html(thisRowinvitedBy.html()); + } + parent.remove(); + }; if (action === 'delete') { - socket.emit(method, {email: email, invitedBy: invitedBy}, function(err) { - if (err) { - return app.alertError(err.message); + bootbox.confirm('Are you sure you wish to delete this invitation?', function(confirm) { + if (confirm) { + socket.emit(method, {email: email, invitedBy: invitedBy}, function(err) { + if (err) { + return app.alertError(err.message); + } + removeRow(); + }); } - parent.remove(); }); } return false; diff --git a/src/views/admin/manage/registration.tpl b/src/views/admin/manage/registration.tpl index 7abc4f34b9..c3fd4400c2 100644 --- a/src/views/admin/manage/registration.tpl +++ b/src/views/admin/manage/registration.tpl @@ -76,7 +76,7 @@ - {invites.username} + {invites.username} {invites.invitations.email} {invites.invitations.username}