implemented selections in admin
This commit is contained in:
parent
3824b6904a
commit
c5eaf569fe
@ -38,26 +38,17 @@
|
|||||||
$.ajax
|
$.ajax
|
||||||
({
|
({
|
||||||
url: "./res/forum/api/user_info.php?username=" + event.target.innerHTML,
|
url: "./res/forum/api/user_info.php?username=" + event.target.innerHTML,
|
||||||
success: function(result)
|
success: async function(result)
|
||||||
{
|
{
|
||||||
var sex_codes =
|
let admin_select = await selection("admin", result.admin);
|
||||||
{
|
let sex_select = await selection("sex", result.sex);
|
||||||
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 output =
|
let output =
|
||||||
`Uživatelské jméno: ${result.username}<br>
|
`Uživatelské jméno: <input class="editable" type="text" value="${result.username}"><br>
|
||||||
Přezdívka: ${result.nickname}<br>
|
Přezdívka: <input class="editable" type="text" value="${result.nickname}"><br>
|
||||||
Admin: ${admin}<br>
|
Admin: ${admin_select}<br>
|
||||||
Pohlaví: ${sex}<br>
|
Pohlaví: ${sex_select}<br>
|
||||||
Bio: ${result.bio}<br>`;
|
Bio: <input class="editable" type="text" value="${result.bio}"><br>`;
|
||||||
|
|
||||||
$("#right_panel").html(output + right_panel_buffer);
|
$("#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>
|
</script>
|
Loading…
x
Reference in New Issue
Block a user