Merge pull request #3 from EaterOfCode/fixRevokationNotResetingInterface

reset interface before opening revoke modal and remove certificate row afterwards
master
Corné Oppelaar 9 years ago committed by GitHub
commit 8cb1a5ddd6

@ -4,23 +4,26 @@ $(function(){
var selected = false; var selected = false;
$('.revoke').click(function () { $('.revoke').click(function () {
selected = $(this).data('name'); selected = $(this);
$('.revoke-modal').modal('show'); $('.revoke-modal').modal('show');
error.hide();
}); });
$('.revoke-confirm').click(function () { $('.revoke-confirm').click(function () {
var selectedSnapshot = selected; var selectedSnapshot = selected;
error.hide();
$.post('/panel/certificates/revoke', { $.post('/panel/certificates/revoke', {
name: selectedSnapshot, name: selectedSnapshot.data('name'),
password: $('.revoke-password').val() password: $('.revoke-password').val()
}, function(data) { }, function(data) {
if (data.success) { if (data.success) {
$('#certificates').after(success.text("Successfully revoked '" + selectedSnapshot + "'")); $('#certificates').after(success.text("Successfully revoked '" + selectedSnapshot.data('name') + "'").delay(3000).hide(0));
$('.revoke-modal').modal('hide'); $('.revoke-modal').modal('hide');
$(selectedSnapshot).parents('tr').first().remove();
} else { } else {
$('#revoke-put-error-after-me').after(error.text(data.error)); $('#revoke-put-error-after-me').after(error.text(data.error).show());
} }
}); });

Loading…
Cancel
Save