created moderation_popup

This commit is contained in:
Václav Šmejkal 2024-05-25 16:42:13 +02:00
parent 769ebac593
commit 6727ac0a41
Signed by: ENGO150
GPG Key ID: 4A57E86482968843
3 changed files with 58 additions and 2 deletions

View File

@ -12,14 +12,20 @@
<img id="image_popup_img" src="//:0">
<img id="close_btn" onclick="close_image()" src="./res/forum/images/close.png" alt="Tlačítko pro zavření obrázku">
</div>
<div id="moderation_popup">
<div id="moderation_post_title">A</div>
<button class="btn" id="archive_btn">Archivovat příspěvek</button>
</div>
<div id="posts"></div>
<script>
$.ajax
({
url: "./res/forum/api/get_posts.php",
success: function(result)
success: async function(result)
{
let am_i_admin = await is_admin();
for (let i in result)
{
$("#posts").append
@ -31,9 +37,10 @@
"<div class=\"post_info\">" +
"<div>Název: <span class=\"post_name\">" + result[i].title + "</span></div>" +
"<div>Autor: " + result[i].username + "</div>" +
"<div>Autor: <span class=\"post_author\">" + result[i].username + "</span></div>" +
((result[i].description != null) ? "<div class=\"post_desc\">Popis: <div class=\"post_desc_text\">" + result[i].description + "</div></div>" : "") +
"</div>" +
((am_i_admin) ? "<img class=\"post_options\" alt=\"Zobrazení možností příspěvku\" src=\"./res/forum/images/post_options.png\">" : "") +
"</div>"
);
}
@ -105,6 +112,21 @@
$("#image_popup").children("#image_popup_img").attr("alt", $(this).parent(".post").children(".post_info").children("div").children(".post_name").html());
});
$(document).on("click", ".post_options", function(event)
{
let post_title = $(this).parent(".post").children(".post_info").children("div").children(".post_author").html() + " - " + $(this).parent(".post").children(".post_info").children("div").children(".post_name").html();
if ($("#moderation_post_title").html() !== post_title)
{
$("#moderation_popup").css("display", "flex");
$("#moderation_post_title").html(post_title);
} else
{
$("#moderation_popup").css("display", "none");
$("#moderation_post_title").html("");
}
});
function close_image()
{
$("#image_popup").css("display", "none");

Binary file not shown.

After

Width:  |  Height:  |  Size: 600 B

View File

@ -338,4 +338,38 @@ body
border: 1px solid #3E392F;
border-right: none;
border-top: none;
}
.post_options
{
height: 2vh;
}
#moderation_popup
{
z-index: 10;
position: absolute;
display: none;
flex-direction: column;
align-items: center;
width: fit-content;
height: fit-content;
padding: 2vh;
border: solid 1px #3E392F;
border-radius: 0.5vh 0.5vh;
background: #6F7270;
left: 0;
right: 0;
top: 0;
bottom: 0;
margin: auto;
}
#moderation_post_title
{
margin-bottom: 1vh;
}