Frontend, Bugfixes
This commit is contained in:
26
js/admin.js
26
js/admin.js
@@ -1,4 +1,6 @@
|
||||
$(document).ready(function() {
|
||||
|
||||
// Login
|
||||
$("#username").keypress(function(e) { if(e.which == 13) $("#password").focus(); });
|
||||
$("#password").keypress(function(e) { if(e.which == 13) $("#btnLogin").click(); });
|
||||
$("#btnLogin").click(function() {
|
||||
@@ -24,8 +26,26 @@ $(document).ready(function() {
|
||||
});
|
||||
});
|
||||
|
||||
$("#toggleSidebar").click(function() {
|
||||
$(".main-wrapper").toggleClass("sidebar-collapsed");
|
||||
$(".main-sidebar").toggleClass("collapsed");
|
||||
$("#userTableRefresh").click(function() {
|
||||
let tbody = $("#userTable > tbody");
|
||||
let page = parseInt($("#userPageNavigation li.active > a").text().trim());
|
||||
tbody.find("tr").remove();
|
||||
tbody.append("<tr><td colspan=\"4\" class=\"text-center\">Loading… " + createLoadingIcon() + "</td></tr>");
|
||||
|
||||
jsCore.apiCall("/user/fetch", { page: page}, function (data) {
|
||||
let pageCount = data["pages"];
|
||||
let users = data["users"];
|
||||
let userRows = [];
|
||||
|
||||
// TODO: .. maybe use ts instead of plain js?
|
||||
for(let userId in users) {
|
||||
let user = users[userId];
|
||||
userRows.push("<tr><td>" + user.name + "</td><td>" + user.email + "</td><td></td><td></td></tr>");
|
||||
}
|
||||
|
||||
tbody.html(userRows.join(""));
|
||||
}, function (err) {
|
||||
alert(err);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -274,3 +274,7 @@ let jsCore = new Core();
|
||||
$(document).ready(function() {
|
||||
|
||||
});
|
||||
|
||||
function createLoadingIcon() {
|
||||
return '<i class="fas fa-spin fa-spinner"></i>';
|
||||
}
|
||||
Reference in New Issue
Block a user