This commit is contained in:
Alex Ling
2020-02-14 00:57:39 +00:00
parent 83f6fc25f0
commit 042df2bf1f
10 changed files with 162 additions and 40 deletions

View File

@@ -1,3 +1,4 @@
<div id="alert"></div>
<table class="uk-table uk-table-divider">
<thead>
<tr>
@@ -27,8 +28,24 @@
<% content_for "script" do %>
<script>
function remove(username) {
alert(username);
}
function alert(level, text) {
hideAlert();
var html = '<div class="uk-alert-' + level + '" uk-alert><a class="uk-alert-close" uk-close></a><p>' + text + '</p></div>';
$('#alert').append(html);
}
function hideAlert() {
$('#alert').empty();
}
function remove(username) {
$.post('/api/admin/user/delete/' + username, function(data) {
if (data.success) {
location.reload();
}
else {
error = data.error;
alert('danger', error);
}
});
}
</script>
<% end %>