In the process of adding the delete button to the invitation panel. Apparently, the delete method doesn't work with the invitation items, so I might need to add some extra logic.

v1.18.x
HSam 9 years ago
parent 5ed3148fe1
commit 4d87f0276b

@ -22,6 +22,24 @@ define('admin/manage/registration', function() {
}); });
return false; return false;
}); });
$('.invites-list').on('click', '[data-action]', function(ev) {
var $this = this;
var parent = $(this).parents('[data-invitation-mail]');
var email = parent.attr('data-invitation-mail');
var action = $(this).attr('data-action');
var method = 'admin.user.deleteInvitation';
if (action === 'delete') {
socket.emit(method, {email: email}, function(err) {
if (err) {
return app.alertError(err.message);
}
parent.remove();
});
}
return false;
});
}; };
return Registration; return Registration;

@ -212,6 +212,10 @@ User.search = function(socket, data, callback) {
}); });
}; };
User.deleteInvitation = function(socket, data, callback) {
user.deleteInvitation(data.email, callback);
};
User.acceptRegistration = function(socket, data, callback) { User.acceptRegistration = function(socket, data, callback) {
user.acceptRegistration(data.username, callback); user.acceptRegistration(data.username, callback);
}; };
@ -221,4 +225,4 @@ User.rejectRegistration = function(socket, data, callback) {
}; };
module.exports = User; module.exports = User;

@ -122,6 +122,7 @@ module.exports = function(User) {
User.deleteInvitation = function(email, callback) { User.deleteInvitation = function(email, callback) {
callback = callback || function() {}; callback = callback || function() {};
console.log('invitation:email:' + email);
db.delete('invitation:email:' + email, callback); db.delete('invitation:email:' + email, callback);
}; };

@ -66,18 +66,23 @@
<br><br> <br><br>
The username will be displayed to the right of the emails for users who have redeemed their invitations. The username will be displayed to the right of the emails for users who have redeemed their invitations.
</p> </p>
<table class="table table-striped users-list"> <table class="table table-striped invites-list">
<tr> <tr>
<th>Inviter Username</th> <th>Inviter Username</th>
<th>Invitee Email</th> <th>Invitee Email</th>
<th>Invitee Username (if registered)</th> <th>Invitee Username (if registered)</th>
</tr> </tr>
<!-- BEGIN invites --> <!-- BEGIN invites -->
<tr> <!-- BEGIN invites.invitations -->
<!-- BEGIN invites.invitations --> <tr data-invitation-mail="{invites.invitations.email}">
<!-- TODO: Upon deletion, this will result in an incorrect visual state until page is reloaded -->
<td><!-- IF @first -->{invites.username}<!-- ENDIF @first --></td> <td><!-- IF @first -->{invites.username}<!-- ENDIF @first --></td>
<td>{invites.invitations.email}</td> <td>{invites.invitations.email}</td>
<td>{invites.invitations.username}</td> <td>{invites.invitations.username}
<div class="btn-group pull-right">
<button class="btn btn-danger btn-xs" data-action="delete"><i class="fa fa-times"></i></button>
</div>
</td>
</tr> </tr>
<!-- END invites.invitations --> <!-- END invites.invitations -->
<!-- END invites --> <!-- END invites -->

Loading…
Cancel
Save