implemented selections in admin
This commit is contained in:
parent
3824b6904a
commit
c5eaf569fe
@ -38,26 +38,17 @@
|
||||
$.ajax
|
||||
({
|
||||
url: "./res/forum/api/user_info.php?username=" + event.target.innerHTML,
|
||||
success: function(result)
|
||||
success: async function(result)
|
||||
{
|
||||
var sex_codes =
|
||||
{
|
||||
0: "Nespecifikováno",
|
||||
1: "Muž",
|
||||
2: "Žena",
|
||||
9: "Jiné",
|
||||
default: "???"
|
||||
};
|
||||
|
||||
let sex = sex_codes[result.sex] || sex_codes.default;
|
||||
let admin = result.admin == 0 ? "Ne" : "Ano";
|
||||
let admin_select = await selection("admin", result.admin);
|
||||
let sex_select = await selection("sex", result.sex);
|
||||
|
||||
let output =
|
||||
`Uživatelské jméno: ${result.username}<br>
|
||||
Přezdívka: ${result.nickname}<br>
|
||||
Admin: ${admin}<br>
|
||||
Pohlaví: ${sex}<br>
|
||||
Bio: ${result.bio}<br>`;
|
||||
`Uživatelské jméno: <input class="editable" type="text" value="${result.username}"><br>
|
||||
Přezdívka: <input class="editable" type="text" value="${result.nickname}"><br>
|
||||
Admin: ${admin_select}<br>
|
||||
Pohlaví: ${sex_select}<br>
|
||||
Bio: <input class="editable" type="text" value="${result.bio}"><br>`;
|
||||
|
||||
$("#right_panel").html(output + right_panel_buffer);
|
||||
}
|
||||
@ -76,4 +67,20 @@
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function selection(type, value)
|
||||
{
|
||||
return new Promise(function(resolve)
|
||||
{
|
||||
$.ajax
|
||||
({
|
||||
url: "./res/forum/admin/" + type + "_selection.html",
|
||||
dataType: "html",
|
||||
success: function(result)
|
||||
{
|
||||
resolve(result.replace("value=\"" + value, "selected value=\"" + value));
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
</script>
|
Loading…
x
Reference in New Issue
Block a user